List of usage examples for weka.gui.experiment ExperimenterDefaults getColumn
public final static String getColumn()
From source file:adams.flow.transformer.WekaExperimentEvaluation.java
License:Open Source License
/** * Adds options to the internal list of options. *//* ww w. j ava 2s. co m*/ @Override public void defineOptions() { String[] list; BaseString[] str; int i; super.defineOptions(); m_OptionManager.add("tester", "tester", new PairedCorrectedTTester()); m_OptionManager.add("comparison", "comparisonField", ExperimentStatistic.PERCENT_CORRECT); m_OptionManager.add("significance", "significance", 0.05, 0.0001, 0.9999); m_OptionManager.add("test", "testBase", 0, 0, null); list = ExperimenterDefaults.getRow().split(","); str = new BaseString[list.length]; for (i = 0; i < list.length; i++) str[i] = new BaseString(list[i]); m_OptionManager.add("row", "row", str); list = ExperimenterDefaults.getColumn().split(","); str = new BaseString[list.length]; for (i = 0; i < list.length; i++) str[i] = new BaseString(list[i]); m_OptionManager.add("col", "column", str); m_OptionManager.add("swap", "swapRowsAndColumns", false); m_OptionManager.add("format", "outputFormat", ExperimenterDefaults.getOutputFormat()); m_OptionManager.add("header", "outputHeader", true); }
From source file:adams.flow.transformer.WekaExperimentEvaluation.java
License:Open Source License
/** * Sets up the testing algorithm and returns it. * * @param data the experimental data/*ww w . ja v a2s . c om*/ * @return the configured testing algorithm * @throws Exception If something goes wrong, like testing algorithm of * result matrix cannot be instantiated */ protected Tester getTester(Instances data) throws Exception { Tester ttester; ResultMatrix matrix; String tmpStr; weka.core.Attribute att; List<String> rows; List<String> cols; String selectedList; String selectedListDataset; boolean comparisonFieldSet; int i; String name; Range generatorRange; ttester = (Tester) Utils.deepCopy(m_Tester); matrix = (ResultMatrix) Utils.deepCopy(m_OutputFormat); ttester.setInstances(data); ttester.setSignificanceLevel(m_Significance); ttester.setShowStdDevs(matrix.getShowStdDev()); ttester.setSortColumn(-1); if (!m_SwapRowsAndColumns) { rows = determineColumnNames(m_Row, ExperimenterDefaults.getRow()); cols = determineColumnNames(m_Column, ExperimenterDefaults.getColumn()); } else { cols = determineColumnNames(m_Row, ExperimenterDefaults.getRow()); rows = determineColumnNames(m_Column, ExperimenterDefaults.getColumn()); } selectedList = ""; selectedListDataset = ""; comparisonFieldSet = false; for (i = 0; i < data.numAttributes(); i++) { name = data.attribute(i).name(); if (rows.contains(name.toLowerCase())) { selectedListDataset += "," + (i + 1); } else if (name.toLowerCase().equals("key_run")) { ttester.setRunColumn(i); } else if (name.toLowerCase().equals("key_fold")) { ttester.setFoldColumn(i); } else if (cols.contains(name.toLowerCase())) { selectedList += "," + (i + 1); } else if (name.toLowerCase().contains(ExperimenterDefaults.getComparisonField())) { comparisonFieldSet = true; } else if ((name.toLowerCase().contains("root_relative_squared_error")) && (!comparisonFieldSet)) { comparisonFieldSet = true; } } generatorRange = new Range(); if (selectedList.length() != 0) { try { generatorRange.setRanges(selectedList); } catch (Exception ex) { handleException("Failed to set ranges: " + selectedList, ex); } } ttester.setResultsetKeyColumns(generatorRange); generatorRange = new Range(); if (selectedListDataset.length() != 0) { try { generatorRange.setRanges(selectedListDataset); } catch (Exception ex) { handleException("Failed to set dataset ranges: " + selectedListDataset, ex); } } ttester.setDatasetKeyColumns(generatorRange); tmpStr = m_ComparisonField.getField(); att = data.attribute(tmpStr); if (att == null) throw new Exception("Cannot find comparison field '" + tmpStr + "' in data!"); ttester.setDisplayedResultsets(null); // all ttester.setResultMatrix(matrix); return ttester; }