Example usage for weka.gui.explorer ExplorerDefaults PROPERTY_FILE

List of usage examples for weka.gui.explorer ExplorerDefaults PROPERTY_FILE

Introduction

In this page you can find the example usage for weka.gui.explorer ExplorerDefaults PROPERTY_FILE.

Prototype

String PROPERTY_FILE

To view the source code for weka.gui.explorer ExplorerDefaults PROPERTY_FILE.

Click Source Link

Document

The name of the properties file.

Usage

From source file:adams.gui.application.WekaExplorerPreferencesPanel.java

License:Open Source License

@Override
protected void initGUI() {
    super.initGUI();

    addPropertyType("Tabs", PropertyType.STRING);
    addPropertyType("InitialDirectory", PropertyType.DIRECTORY_ABSOLUTE);
    addPropertyType("enableUndo", PropertyType.BOOLEAN);
    addPropertyType("undoDirectory", PropertyType.DIRECTORY_ABSOLUTE);
    addPropertyType("Filter", PropertyType.OBJECT_EDITOR);
    setChooser("Filter",
            new GenericObjectEditorPanel(weka.filters.Filter.class, new weka.filters.AllFilter(), true));
    addPropertyType("Classifier", PropertyType.OBJECT_EDITOR);
    setChooser("Classifier", new GenericObjectEditorPanel(weka.classifiers.Classifier.class,
            new weka.classifiers.rules.ZeroR(), true));
    addPropertyType("ClassifierTestMode", PropertyType.LIST);
    setList("ClassifierTestMode", new String[] { "1", "2", "3", "4" });
    setHelp("ClassifierTestMode",
            "1 - cross-validation, 2 - percentage split, 3 - use training set, 4 - supplied test set");
    addPropertyType("ClassifierCrossvalidationFolds", PropertyType.INTEGER);
    addPropertyType("ClassifierPercentageSplit", PropertyType.INTEGER);
    addPropertyType("ClassifierOutputModel", PropertyType.BOOLEAN);
    addPropertyType("ClassifierOutputPerClassStats", PropertyType.BOOLEAN);
    addPropertyType("ClassifierOutputEntropyEvalMeasures", PropertyType.BOOLEAN);
    addPropertyType("ClassifierOutputConfusionMatrix", PropertyType.BOOLEAN);
    addPropertyType("ClassifierStorePredictionsForVis", PropertyType.BOOLEAN);
    addPropertyType("ClassifierOutputPredictions", PropertyType.BOOLEAN);
    addPropertyType("ClassifierOutputAdditionalAttributes", PropertyType.STRING);
    addPropertyType("ClassifierCostSensitiveEval", PropertyType.BOOLEAN);
    addPropertyType("ClassifierRandomSeed", PropertyType.INTEGER);
    addPropertyType("ClassifierPreserveOrder", PropertyType.BOOLEAN);
    addPropertyType("ClassifierOutputSourceCode", PropertyType.BOOLEAN);
    addPropertyType("ClassifierSourceCodeClass", PropertyType.STRING);
    addPropertyType("ClassifierErrorsPlotInstances", PropertyType.STRING);
    addPropertyType("ClassifierErrorsMinimumPlotSizeNumeric", PropertyType.INTEGER);
    addPropertyType("ClassifierErrorsMaximumPlotSizeNumeric", PropertyType.INTEGER);
    addPropertyType("Clusterer", PropertyType.OBJECT_EDITOR);
    setChooser("Clusterer", new GenericObjectEditorPanel(weka.clusterers.Clusterer.class,
            new weka.clusterers.SimpleKMeans(), true));
    addPropertyType("ClustererTestMode", PropertyType.LIST);
    setList("ClustererTestMode", new String[] { "2", "3", "4", "5" });
    setHelp("ClustererTestMode",
            "2 - percentage split, 3 - use training set, 4 - supplied test set, 5 - classes to clusters evaluation");
    addPropertyType("ClustererStoreClustersForVis", PropertyType.BOOLEAN);
    addPropertyType("ClustererAssignmentsPlotInstances", PropertyType.STRING);
    addPropertyType("Associator", PropertyType.OBJECT_EDITOR);
    setChooser("Associator", new GenericObjectEditorPanel(weka.associations.Associator.class,
            new weka.associations.Apriori(), true));
    addPropertyType("ASEvaluation", PropertyType.OBJECT_EDITOR);
    setChooser("ASEvaluation", new GenericObjectEditorPanel(weka.attributeSelection.ASEvaluation.class,
            new weka.attributeSelection.CfsSubsetEval(), true));
    addPropertyType("ASSearch", PropertyType.OBJECT_EDITOR);
    setChooser("ASSearch", new GenericObjectEditorPanel(weka.attributeSelection.ASSearch.class,
            new weka.attributeSelection.BestFirst(), true));
    addPropertyType("ASTestMode", PropertyType.LIST);
    setList("ASTestMode", new String[] { "0", "1" });
    setHelp("ASTestMode", "0 - use full training set, 1 - cross-validation");
    addPropertyType("ASCrossvalidationFolds", PropertyType.INTEGER);
    addPropertyType("ASRandomSeed", PropertyType.INTEGER);

    try {/*from   w  w w.  ja  v  a2  s . com*/
        setPreferences(new Properties(Utils.readProperties(ExplorerDefaults.PROPERTY_FILE)));
    } catch (Exception e) {
        System.err.println("Failed to load WEKA Explorer properties:");
        e.printStackTrace();
        setPreferences(new Properties());
    }
}

From source file:adams.gui.application.WekaExplorerPreferencesPanel.java

License:Open Source License

/**
 * Activates the settings.// w w  w .  j a v a 2  s  .c  o  m
 * 
 * @return      null if successfully activated, otherwise error message
 */
@Override
public String activate() {
    String filename;

    if (!WekaPackageManager.PROPERTIES_DIR.exists()) {
        WekaPackageManager.PROPERTIES_DIR.mkdirs();
        if (!WekaPackageManager.PROPERTIES_DIR.exists())
            return "Failed to create WEKA props directory: " + WekaPackageManager.PROPERTIES_DIR;
    }

    filename = WekaPackageManager.PROPERTIES_DIR.getAbsolutePath() + File.separator
            + new File(ExplorerDefaults.PROPERTY_FILE).getName();
    if (!getPreferences().save(filename))
        return "Failed to save WEKA Explorer properties: " + filename;

    return null;
}