List of usage examples for org.apache.commons.configuration XMLConfiguration setRootElementName
public void setRootElementName(String name)
From source file:keel.Algorithms.Genetic_Rule_Learning.Bojarczuk_GP.Main.java
/** * <p>//from ww w. j a v a2 s . co m * Configure the execution of the algorithm. * * @param jobFilename Name of the KEEL file with properties of the execution * </p> */ private static void configureJob(String jobFilename) { Properties props = new Properties(); try { InputStream paramsFile = new FileInputStream(jobFilename); props.load(paramsFile); paramsFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(0); } // Files training and test String trainFile; String testFile; StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData")); tokenizer.nextToken(); trainFile = tokenizer.nextToken(); trainFile = trainFile.substring(1, trainFile.length() - 1); testFile = tokenizer.nextToken(); testFile = testFile.substring(1, testFile.length() - 1); tokenizer = new StringTokenizer(props.getProperty("outputData")); String reportTrainFile = tokenizer.nextToken(); reportTrainFile = reportTrainFile.substring(1, reportTrainFile.length() - 1); String reportTestFile = tokenizer.nextToken(); reportTestFile = reportTestFile.substring(1, reportTestFile.length() - 1); String reportRulesFile = tokenizer.nextToken(); reportRulesFile = reportRulesFile.substring(1, reportRulesFile.length() - 1); // Algorithm auxiliar configuration XMLConfiguration algConf = new XMLConfiguration(); algConf.setRootElementName("experiment"); algConf.addProperty("process[@algorithm-type]", "net.sourceforge.jclec.problem.classification.freitas.FreitasAlgorithm"); algConf.addProperty("process.rand-gen-factory[@type]", "net.sourceforge.jclec.util.random.RanecuFactory"); algConf.addProperty("process.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); algConf.addProperty("process.population-size", Integer.parseInt(props.getProperty("population-size"))); algConf.addProperty("process.max-of-generations", Integer.parseInt(props.getProperty("max-generations"))); algConf.addProperty("process.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size"))); algConf.addProperty("process.dataset[@type]", "net.sourceforge.jclec.util.dataset.KeelDataSet"); algConf.addProperty("process.dataset.train-data.file-name", trainFile); algConf.addProperty("process.dataset.test-data.file-name", testFile); algConf.addProperty("process.species[@type]", "net.sourceforge.jclec.problem.classification.freitas.FreitasSyntaxTreeSpecies"); algConf.addProperty("process.evaluator[@type]", "net.sourceforge.jclec.problem.classification.freitas.FreitasEvaluator"); algConf.addProperty("process.provider[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeCreator"); algConf.addProperty("process.parents-selector[@type]", "net.sourceforge.jclec.selector.RouletteSelector"); algConf.addProperty("process.recombinator[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeRecombinator"); algConf.addProperty("process.recombinator[@rec-prob]", Double.parseDouble(props.getProperty("rec-prob"))); algConf.addProperty("process.recombinator.base-op[@type]", "net.sourceforge.jclec.problem.classification.freitas.FreitasCrossover"); algConf.addProperty("process.copy-prob", Double.parseDouble(props.getProperty("copy-prob"))); algConf.addProperty("process.listener[@type]", "net.sourceforge.jclec.problem.classification.freitas.KeelFreitasPopulationReport"); algConf.addProperty("process.listener.report-dir-name", "./"); algConf.addProperty("process.listener.train-report-file", reportTrainFile); algConf.addProperty("process.listener.test-report-file", reportTestFile); algConf.addProperty("process.listener.rules-report-file", reportRulesFile); algConf.addProperty("process.listener.global-report-name", "resumen"); algConf.addProperty("process.listener.report-frequency", 50); try { algConf.save(new File("configure.txt")); } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } net.sourceforge.jclec.RunExperiment.main(new String[] { "configure.txt" }); }
From source file:keel.Algorithms.Genetic_Rule_Learning.Falco_GP.Main.java
/** * <p>//w ww. j av a 2 s. c om * Configure the execution of the algorithm. * * @param jobFilename Name of the KEEL file with properties of the * execution * </p> */ private static void configureJob(String jobFilename) { Properties props = new Properties(); try { InputStream paramsFile = new FileInputStream(jobFilename); props.load(paramsFile); paramsFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(0); } // Files training and test String trainFile; String testFile; StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData")); tokenizer.nextToken(); trainFile = tokenizer.nextToken(); trainFile = trainFile.substring(1, trainFile.length() - 1); testFile = tokenizer.nextToken(); testFile = testFile.substring(1, testFile.length() - 1); tokenizer = new StringTokenizer(props.getProperty("outputData")); String reportTrainFile = tokenizer.nextToken(); reportTrainFile = reportTrainFile.substring(1, reportTrainFile.length() - 1); String reportTestFile = tokenizer.nextToken(); reportTestFile = reportTestFile.substring(1, reportTestFile.length() - 1); String reportRulesFile = tokenizer.nextToken(); reportRulesFile = reportRulesFile.substring(1, reportRulesFile.length() - 1); // Algorithm auxiliar configuration XMLConfiguration algConf = new XMLConfiguration(); algConf.setRootElementName("experiment"); algConf.addProperty("process[@algorithm-type]", "net.sourceforge.jclec.problem.classification.falco.FalcoAlgorithm"); algConf.addProperty("process.rand-gen-factory[@type]", "net.sourceforge.jclec.util.random.RanecuFactory"); algConf.addProperty("process.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); algConf.addProperty("process.population-size", Integer.parseInt(props.getProperty("population-size"))); algConf.addProperty("process.max-of-generations", Integer.parseInt(props.getProperty("max-generations"))); algConf.addProperty("process.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size"))); algConf.addProperty("process.dataset[@type]", "net.sourceforge.jclec.util.dataset.KeelDataSet"); algConf.addProperty("process.dataset.train-data.file-name", trainFile); algConf.addProperty("process.dataset.test-data.file-name", testFile); algConf.addProperty("process.species[@type]", "net.sourceforge.jclec.problem.classification.falco.FalcoSyntaxTreeSpecies"); algConf.addProperty("process.evaluator[@type]", "net.sourceforge.jclec.problem.classification.falco.FalcoEvaluator"); algConf.addProperty("process.evaluator.alpha", Double.parseDouble(props.getProperty("alpha"))); algConf.addProperty("process.provider[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeCreator"); algConf.addProperty("process.parents-selector[@type]", "net.sourceforge.jclec.selector.RouletteSelector"); algConf.addProperty("process.recombinator[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeRecombinator"); algConf.addProperty("process.recombinator[@rec-prob]", Double.parseDouble(props.getProperty("rec-prob"))); algConf.addProperty("process.recombinator.base-op[@type]", "net.sourceforge.jclec.problem.classification.falco.FalcoCrossover"); algConf.addProperty("process.mutator[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeMutator"); algConf.addProperty("process.mutator[@mut-prob]", Double.parseDouble(props.getProperty("mut-prob"))); algConf.addProperty("process.mutator.base-op[@type]", "net.sourceforge.jclec.problem.classification.falco.FalcoMutator"); algConf.addProperty("process.copy-prob", Double.parseDouble(props.getProperty("copy-prob"))); algConf.addProperty("process.listener[@type]", "net.sourceforge.jclec.problem.classification.falco.KeelFalcoPopulationReport"); algConf.addProperty("process.listener.report-dir-name", "./"); algConf.addProperty("process.listener.train-report-file", reportTrainFile); algConf.addProperty("process.listener.test-report-file", reportTestFile); algConf.addProperty("process.listener.rules-report-file", reportRulesFile); algConf.addProperty("process.listener.global-report-name", "resumen"); algConf.addProperty("process.listener.report-frequency", 50); try { algConf.save(new File("configure.txt")); } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } net.sourceforge.jclec.RunExperiment.main(new String[] { "configure.txt" }); }
From source file:keel.Algorithms.Genetic_Rule_Learning.Tan_GP.Main.java
/** * <p>/* w w w . j a v a 2s .c o m*/ * Configure the execution of the algorithm. * * @param jobFilename Name of the KEEL file with properties of the * execution * </p> */ private static void configureJob(String jobFilename) { Properties props = new Properties(); try { InputStream paramsFile = new FileInputStream(jobFilename); props.load(paramsFile); paramsFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(0); } // Files training and test String trainFile; String testFile; StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData")); tokenizer.nextToken(); trainFile = tokenizer.nextToken(); trainFile = trainFile.substring(1, trainFile.length() - 1); testFile = tokenizer.nextToken(); testFile = testFile.substring(1, testFile.length() - 1); tokenizer = new StringTokenizer(props.getProperty("outputData")); String reportTrainFile = tokenizer.nextToken(); reportTrainFile = reportTrainFile.substring(1, reportTrainFile.length() - 1); String reportTestFile = tokenizer.nextToken(); reportTestFile = reportTestFile.substring(1, reportTestFile.length() - 1); String reportRulesFile = tokenizer.nextToken(); reportRulesFile = reportRulesFile.substring(1, reportRulesFile.length() - 1); // Algorithm auxiliar configuration XMLConfiguration algConf = new XMLConfiguration(); algConf.setRootElementName("experiment"); algConf.addProperty("process[@algorithm-type]", "net.sourceforge.jclec.problem.classification.tan.TanAlgorithm"); algConf.addProperty("process.rand-gen-factory[@type]", "net.sourceforge.jclec.util.random.RanecuFactory"); algConf.addProperty("process.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); algConf.addProperty("process.population-size", Integer.parseInt(props.getProperty("population-size"))); algConf.addProperty("process.max-of-generations", Integer.parseInt(props.getProperty("max-generations"))); algConf.addProperty("process.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size"))); algConf.addProperty("process.dataset[@type]", "net.sourceforge.jclec.util.dataset.KeelDataSet"); algConf.addProperty("process.dataset.train-data.file-name", trainFile); algConf.addProperty("process.dataset.test-data.file-name", testFile); algConf.addProperty("process.species[@type]", "net.sourceforge.jclec.problem.classification.tan.TanSyntaxTreeSpecies"); algConf.addProperty("process.evaluator[@type]", "net.sourceforge.jclec.problem.classification.tan.TanEvaluator"); algConf.addProperty("process.evaluator.w1", Double.parseDouble(props.getProperty("w1"))); algConf.addProperty("process.evaluator.w2", Double.parseDouble(props.getProperty("w2"))); algConf.addProperty("process.provider[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeCreator"); algConf.addProperty("process.parents-selector[@type]", "net.sourceforge.jclec.selector.RouletteSelector"); algConf.addProperty("process.recombinator[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeRecombinator"); algConf.addProperty("process.recombinator[@rec-prob]", Double.parseDouble(props.getProperty("rec-prob"))); algConf.addProperty("process.recombinator.base-op[@type]", "net.sourceforge.jclec.problem.classification.tan.TanCrossover"); algConf.addProperty("process.mutator[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeMutator"); algConf.addProperty("process.mutator[@mut-prob]", Double.parseDouble(props.getProperty("mut-prob"))); algConf.addProperty("process.mutator.base-op[@type]", "net.sourceforge.jclec.problem.classification.tan.TanMutator"); algConf.addProperty("process.copy-prob", Double.parseDouble(props.getProperty("copy-prob"))); algConf.addProperty("process.elitist-prob", Double.parseDouble(props.getProperty("elitist-prob"))); algConf.addProperty("process.support", Double.parseDouble(props.getProperty("support"))); algConf.addProperty("process.listener[@type]", "net.sourceforge.jclec.problem.classification.tan.KeelTanPopulationReport"); algConf.addProperty("process.listener.report-dir-name", "./"); algConf.addProperty("process.listener.train-report-file", reportTrainFile); algConf.addProperty("process.listener.test-report-file", reportTestFile); algConf.addProperty("process.listener.rules-report-file", reportRulesFile); algConf.addProperty("process.listener.global-report-name", "resumen"); algConf.addProperty("process.listener.report-frequency", 50); try { algConf.save(new File("configure.txt")); } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } net.sourceforge.jclec.RunExperiment.main(new String[] { "configure.txt" }); }
From source file:keel.Algorithms.MIL.G3PMI.Main.java
/** * <p>/*from w w w .j a v a 2 s . c o m*/ * Configure the execution of the algorithm. * * @param jobFilename Name of the KEEL file with properties of the execution * </p> */ private static void configureJob(String jobFilename) { Properties props = new Properties(); try { InputStream paramsFile = new FileInputStream(jobFilename); props.load(paramsFile); paramsFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(0); } // Files training and test String trainFile; String testFile; StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData")); tokenizer.nextToken(); trainFile = tokenizer.nextToken(); trainFile = trainFile.substring(1, trainFile.length() - 1); testFile = tokenizer.nextToken(); testFile = testFile.substring(1, testFile.length() - 1); tokenizer = new StringTokenizer(props.getProperty("outputData")); String reportTrainFile = tokenizer.nextToken(); reportTrainFile = reportTrainFile.substring(1, reportTrainFile.length() - 1); String reportTestFile = tokenizer.nextToken(); reportTestFile = reportTestFile.substring(1, reportTestFile.length() - 1); //System.out.println("SALIDA: " + reportTestFile); //String reportRulesFile = tokenizer.nextToken(); //reportRulesFile = reportRulesFile.substring(1, reportRulesFile.length()-1); // Algorithm auxiliar configuration XMLConfiguration algConf = new XMLConfiguration(); algConf.setRootElementName("experiment"); algConf.addProperty("process.algorithm[@type]", "org.ayrna.jclec.problem.classification.syntaxtree.multiinstance.G3PMIKeel.G3PMIAlgorithm"); algConf.addProperty("process.algorithm.rand-gen-factory[@type]", "org.ayrna.jclec.util.random.RanecuFactory"); algConf.addProperty("process.algorithm.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); algConf.addProperty("process.algorithm.population-size", Integer.parseInt(props.getProperty("population-size"))); algConf.addProperty("process.algorithm.max-of-generations", Integer.parseInt(props.getProperty("max-generations"))); algConf.addProperty("process.algorithm.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size"))); algConf.addProperty("process.algorithm.species[@type]", "org.ayrna.jclec.problem.classification.syntaxtree.multiinstance.G3PMIKeel.G3PMISyntaxTreeSpecies"); algConf.addProperty("process.algorithm.species.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size"))); algConf.addProperty("process.algorithm.species.dataset[@type]", "org.ayrna.jclec.util.dataset.KeelMultiInstanceDataSet"); algConf.addProperty("process.algorithm.species.dataset.file-name", trainFile); algConf.addProperty("process.algorithm.species.rand-gen-factory[@type]", "org.ayrna.jclec.util.random.RanecuFactory"); algConf.addProperty("process.algorithm.species.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); algConf.addProperty("process.algorithm.evaluator[@type]", "org.ayrna.jclec.problem.classification.syntaxtree.multiinstance.G3PMIKeel.G3PMIEvaluator"); algConf.addProperty("process.algorithm.evaluator.rand-gen-factory[@type]", "org.ayrna.jclec.util.random.RanecuFactory"); algConf.addProperty("process.algorithm.evaluator.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); algConf.addProperty("process.algorithm.evaluator.dataset[@type]", "org.ayrna.jclec.util.dataset.KeelMultiInstanceDataSet"); algConf.addProperty("process.algorithm.evaluator.dataset.file-name", trainFile); algConf.addProperty("process.algorithm.evaluator.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size"))); algConf.addProperty("process.algorithm.provider[@type]", "org.ayrna.jclec.syntaxtree.SyntaxTreeCreator"); algConf.addProperty("process.algorithm.parents-selector[@type]", "org.ayrna.jclec.selector.RouletteSelector"); algConf.addProperty("process.algorithm.recombinator.decorated[@type]", "org.ayrna.jclec.problem.classification.syntaxtree.multiinstance.G3PMIKeel.G3PMICrossover"); algConf.addProperty("process.algorithm.recombinator.recombination-prob", Double.parseDouble(props.getProperty("rec-prob"))); algConf.addProperty("process.algorithm.mutator.decorated[@type]", "org.ayrna.jclec.problem.classification.syntaxtree.multiinstance.G3PMIKeel.G3PMIMutator"); algConf.addProperty("process.algorithm.mutator.mutation-prob", Double.parseDouble(props.getProperty("mut-prob"))); algConf.addProperty("process.listeners.listener[@type]", "org.ayrna.jclec.problem.classification.syntaxtree.multiinstance.G3PMIKeel.G3PMIPopulationReport"); algConf.addProperty("process.listeners.listener.report-dir-name", "./"); algConf.addProperty("process.listeners.listener.train-report-file", reportTrainFile); algConf.addProperty("process.listeners.listener.test-report-file", reportTestFile); algConf.addProperty("process.listeners.listener.global-report-name", "resumen"); algConf.addProperty("process.listeners.listener.report-frequency", 50); algConf.addProperty("process.listeners.listener.test-dataset[@type]", "org.ayrna.jclec.util.dataset.KeelMultiInstanceDataSet"); algConf.addProperty("process.listeners.listener.test-dataset.file-name", testFile); try { algConf.save(new File("configure.txt")); } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } org.ayrna.jclec.genlab.GenLab.main(new String[] { "configure.txt" }); }
From source file:keel.Algorithms.Neural_Networks.NNEP_Clas.KEELWrapperClas.java
/** * <p>//from w ww. j a va 2 s . c om * Configure the execution of the algorithm. * * @param jobFilename Name of the KEEL file with properties of the * execution * </p> */ @SuppressWarnings("unchecked") private static void configureJob(String jobFilename) { Properties props = new Properties(); try { InputStream paramsFile = new FileInputStream(jobFilename); props.load(paramsFile); paramsFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(0); } // Files training and test String trainFile; String testFile; StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData")); tokenizer.nextToken(); trainFile = tokenizer.nextToken(); trainFile = trainFile.substring(1, trainFile.length() - 1); testFile = tokenizer.nextToken(); testFile = testFile.substring(1, testFile.length() - 1); // Classification or Regression ?? byte[] schema = null; try { schema = readSchema(trainFile); } catch (IOException e) { e.printStackTrace(); } catch (DatasetException e) { e.printStackTrace(); } // Algorithm auxiliar configuration XMLConfiguration algConf = new XMLConfiguration(); algConf.setRootElementName("algorithm"); algConf.addProperty("population-size", 1000); algConf.addProperty("max-of-generations", Integer.parseInt(props.getProperty("Generations"))); algConf.addProperty("creation-ratio", 10.0); algConf.addProperty("percentage-second-mutator", 10); algConf.addProperty("max-generations-without-improving-mean", 20); algConf.addProperty("max-generations-without-improving-best", 20); algConf.addProperty("fitness-difference", 0.0000001); algConf.addProperty("species[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.NeuralNetIndividualSpecies"); algConf.addProperty("species.neural-net-type", "keel.Algorithms.Neural_Networks.NNEP_Clas.neuralnet.NeuralNetClassifier"); if (props.getProperty("Transfer").equals("Product_Unit")) { algConf.addProperty("species.hidden-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.ExpLayer"); algConf.addProperty("species.hidden-layer[@biased]", false); algConf.addProperty("evaluator[@log-input-data]", true); } else { algConf.addProperty("species.hidden-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.SigmLayer"); algConf.addProperty("species.hidden-layer[@biased]", true); } int neurons = Integer.parseInt(props.getProperty("Hidden_nodes")); algConf.addProperty("species.hidden-layer.minimum-number-of-neurons", (neurons / 3) != 0 ? (neurons / 3) : 1); algConf.addProperty("species.hidden-layer.initial-maximum-number-of-neurons", (neurons / 2) != 0 ? (neurons / 2) : 1); algConf.addProperty("species.hidden-layer.maximum-number-of-neurons", neurons); algConf.addProperty("species.hidden-layer.initiator-of-links", "keel.Algorithms.Neural_Networks.NNEP_Common.initiators.RandomInitiator"); algConf.addProperty("species.hidden-layer.weight-range[@type]", "net.sf.jclec.util.range.Interval"); algConf.addProperty("species.hidden-layer.weight-range[@closure]", "closed-closed"); algConf.addProperty("species.hidden-layer.weight-range[@left]", -5.0); algConf.addProperty("species.hidden-layer.weight-range[@right]", 5.0); algConf.addProperty("species.output-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.LinearLayer"); algConf.addProperty("species.output-layer[@biased]", true); algConf.addProperty("species.output-layer.initiator-of-links", "keel.Algorithms.Neural_Networks.NNEP_Common.initiators.RandomInitiator"); algConf.addProperty("species.output-layer.weight-range[@type]", "net.sf.jclec.util.range.Interval"); algConf.addProperty("species.output-layer.weight-range[@closure]", "closed-closed"); algConf.addProperty("species.output-layer.weight-range[@left]", -5.0); algConf.addProperty("species.output-layer.weight-range[@right]", 5.0); algConf.addProperty("evaluator[@type]", "keel.Algorithms.Neural_Networks.NNEP_Clas.problem.classification.softmax.SoftmaxClassificationProblemEvaluator"); algConf.addProperty("evaluator[@normalize-data]", true); algConf.addProperty("evaluator.error-function", "keel.Algorithms.Neural_Networks.NNEP_Clas.problem.errorfunctions.LogisticErrorFunction"); algConf.addProperty("evaluator.input-interval[@closure]", "closed-closed"); if (props.getProperty("Transfer").equals("Product_Unit")) { algConf.addProperty("evaluator.input-interval[@left]", 1.0); algConf.addProperty("evaluator.input-interval[@right]", 2.0); } else { algConf.addProperty("evaluator.input-interval[@left]", 0.1); algConf.addProperty("evaluator.input-interval[@right]", 0.9); } algConf.addProperty("evaluator.output-interval[@closure]", "closed-closed"); algConf.addProperty("evaluator.output-interval[@left]", 0.0); algConf.addProperty("evaluator.output-interval[@right]", 1.0); algConf.addProperty("provider[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.NeuralNetCreator"); algConf.addProperty("mutator1[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.mutators.structural.StructuralMutator"); algConf.addProperty("mutator1.temperature-exponent[@value]", 1.0); algConf.addProperty("mutator1.significative-weigth[@value]", 0.0000001); algConf.addProperty("mutator1.neuron-ranges.added[@min]", 1); algConf.addProperty("mutator1.neuron-ranges.added[@max]", 2); algConf.addProperty("mutator1.neuron-ranges.deleted[@min]", 1); algConf.addProperty("mutator1.neuron-ranges.deleted[@max]", 2); algConf.addProperty("mutator1.links-ranges[@relative]", true); algConf.addProperty("mutator1.links-ranges.percentages[@hidden]", 30); algConf.addProperty("mutator1.links-ranges.percentages[@output]", 5); algConf.addProperty("mutator2[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.mutators.parametric.ParametricSRMutator"); algConf.addProperty("mutator2.temperature-exponent[@value]", 0.0); algConf.addProperty("mutator2.amplitude[@value]", 5.0); algConf.addProperty("mutator2.fitness-difference[@value]", 0.0000001); algConf.addProperty("mutator2.initial-alpha-values[@input]", 0.5); algConf.addProperty("mutator2.initial-alpha-values[@output]", 1.0); algConf.addProperty("rand-gen-factory[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.util.random.RanNnepFactory"); algConf.addProperty("rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); // Neural Net Algorithm algorithm = new CCRElitistNeuralNetAlgorithm(); algorithm.configure(algConf); // Read data ProblemEvaluator evaluator = (ProblemEvaluator) algorithm.getEvaluator(); evaluator.readData(schema, new KeelDataSet(trainFile), new KeelDataSet(testFile)); ((NeuralNetIndividualSpecies) algorithm.getSpecies()).setNOfInputs(evaluator.getTrainData().getNofinputs()); ((NeuralNetIndividualSpecies) algorithm.getSpecies()) .setNOfOutputs(evaluator.getTrainData().getNofoutputs() - 1); // Read output files tokenizer = new StringTokenizer(props.getProperty("outputData")); String trainResultFile = tokenizer.nextToken(); trainResultFile = trainResultFile.substring(1, trainResultFile.length() - 1); consoleReporter.setTrainResultFile(trainResultFile); String testResultFile = tokenizer.nextToken(); testResultFile = testResultFile.substring(1, testResultFile.length() - 1); consoleReporter.setTestResultFile(testResultFile); String bestModelResultFile = tokenizer.nextToken(); bestModelResultFile = bestModelResultFile.substring(1, bestModelResultFile.length() - 1); consoleReporter.setBestModelResultFile(bestModelResultFile); listeners.add(consoleReporter); }
From source file:keel.Algorithms.Neural_Networks.NNEP_Regr.KEELWrapperRegr.java
/** * <p>// w w w .j a va 2s . c o m * Configure the execution of the algorithm. * </p> * @param jobFilename Name of the KEEL file with properties of the * execution */ @SuppressWarnings("unchecked") private static void configureJob(String jobFilename) { Properties props = new Properties(); try { InputStream paramsFile = new FileInputStream(jobFilename); props.load(paramsFile); paramsFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(0); } // Files training and test String trainFile; String testFile; StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData")); tokenizer.nextToken(); trainFile = tokenizer.nextToken(); trainFile = trainFile.substring(1, trainFile.length() - 1); testFile = tokenizer.nextToken(); testFile = testFile.substring(1, testFile.length() - 1); // Classification or Regression ?? byte[] schema = null; try { schema = readSchema(trainFile); } catch (IOException e) { e.printStackTrace(); } catch (DatasetException e) { e.printStackTrace(); } // Algorithm auxiliar configuration XMLConfiguration algConf = new XMLConfiguration(); algConf.setRootElementName("algorithm"); algConf.addProperty("population-size", 1000); algConf.addProperty("max-of-generations", Integer.parseInt(props.getProperty("Generations"))); algConf.addProperty("creation-ratio", 10.0); algConf.addProperty("percentage-second-mutator", 10); algConf.addProperty("max-generations-without-improving-mean", 20); algConf.addProperty("max-generations-without-improving-best", 20); algConf.addProperty("fitness-difference", 0.0000001); algConf.addProperty("species[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.NeuralNetIndividualSpecies"); algConf.addProperty("species.neural-net-type", "keel.Algorithms.Neural_Networks.NNEP_Regr.neuralnet.NeuralNetRegressor"); if (props.getProperty("Transfer").equals("Product_Unit")) { algConf.addProperty("species.hidden-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.ExpLayer"); algConf.addProperty("species.hidden-layer[@biased]", false); algConf.addProperty("evaluator[@log-input-data]", true); } else { algConf.addProperty("species.hidden-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.SigmLayer"); algConf.addProperty("species.hidden-layer[@biased]", true); } int neurons = Integer.parseInt(props.getProperty("Hidden_nodes")); algConf.addProperty("species.hidden-layer.minimum-number-of-neurons", (neurons / 3) != 0 ? (neurons / 3) : 1); algConf.addProperty("species.hidden-layer.initial-maximum-number-of-neurons", (neurons / 2) != 0 ? (neurons / 2) : 1); algConf.addProperty("species.hidden-layer.maximum-number-of-neurons", neurons); algConf.addProperty("species.hidden-layer.initiator-of-links", "keel.Algorithms.Neural_Networks.NNEP_Common.initiators.RandomInitiator"); algConf.addProperty("species.hidden-layer.weight-range[@type]", "net.sf.jclec.util.range.Interval"); algConf.addProperty("species.hidden-layer.weight-range[@closure]", "closed-closed"); algConf.addProperty("species.hidden-layer.weight-range[@left]", -5.0); algConf.addProperty("species.hidden-layer.weight-range[@right]", 5.0); algConf.addProperty("species.output-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.LinearLayer"); algConf.addProperty("species.output-layer[@biased]", true); algConf.addProperty("species.output-layer.initiator-of-links", "keel.Algorithms.Neural_Networks.NNEP_Common.initiators.RandomInitiator"); algConf.addProperty("species.output-layer.weight-range[@type]", "net.sf.jclec.util.range.Interval"); algConf.addProperty("species.output-layer.weight-range[@closure]", "closed-closed"); algConf.addProperty("species.output-layer.weight-range[@left]", -5.0); algConf.addProperty("species.output-layer.weight-range[@right]", 5.0); algConf.addProperty("evaluator[@type]", "keel.Algorithms.Neural_Networks.NNEP_Regr.problem.regression.RegressionProblemEvaluator"); algConf.addProperty("evaluator[@normalize-data]", true); algConf.addProperty("evaluator.error-function", "keel.Algorithms.Neural_Networks.NNEP_Regr.problem.errorfunctions.MSEErrorFunction"); algConf.addProperty("evaluator.input-interval[@closure]", "closed-closed"); if (props.getProperty("Transfer").equals("Product_Unit")) { algConf.addProperty("evaluator.input-interval[@left]", 1.0); algConf.addProperty("evaluator.input-interval[@right]", 2.0); } else { algConf.addProperty("evaluator.input-interval[@left]", 0.1); algConf.addProperty("evaluator.input-interval[@right]", 0.9); } algConf.addProperty("evaluator.output-interval[@closure]", "closed-closed"); algConf.addProperty("evaluator.output-interval[@left]", 1.0); algConf.addProperty("evaluator.output-interval[@right]", 2.0); algConf.addProperty("provider[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.NeuralNetCreator"); algConf.addProperty("mutator1[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.mutators.structural.StructuralMutator"); algConf.addProperty("mutator1.temperature-exponent[@value]", 1.0); algConf.addProperty("mutator1.significative-weigth[@value]", 0.0000001); algConf.addProperty("mutator1.neuron-ranges.added[@min]", 1); algConf.addProperty("mutator1.neuron-ranges.added[@max]", 2); algConf.addProperty("mutator1.neuron-ranges.deleted[@min]", 1); algConf.addProperty("mutator1.neuron-ranges.deleted[@max]", 2); algConf.addProperty("mutator1.links-ranges[@relative]", false); algConf.addProperty("mutator1.links-ranges.added[@min]", 1); algConf.addProperty("mutator1.links-ranges.added[@max]", 6); algConf.addProperty("mutator1.links-ranges.deleted[@min]", 1); algConf.addProperty("mutator1.links-ranges.deleted[@max]", 6); algConf.addProperty("mutator2[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.mutators.parametric.ParametricSAMutator"); algConf.addProperty("mutator2.temperature-exponent[@value]", 0.0); algConf.addProperty("mutator2.amplitude[@value]", 5.0); algConf.addProperty("mutator2.fitness-difference[@value]", 0.0000001); algConf.addProperty("mutator2.initial-alpha-values[@input]", 0.5); algConf.addProperty("mutator2.initial-alpha-values[@output]", 1.0); algConf.addProperty("rand-gen-factory[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.util.random.RanNnepFactory"); algConf.addProperty("rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); // Neural Net Algorithm algorithm = new NeuralNetAlgorithm<NeuralNetIndividual>(); algorithm.configure(algConf); // Read data ProblemEvaluator evaluator = (ProblemEvaluator) algorithm.getEvaluator(); evaluator.readData(schema, new KeelDataSet(trainFile), new KeelDataSet(testFile)); ((NeuralNetIndividualSpecies) algorithm.getSpecies()).setNOfInputs(evaluator.getTrainData().getNofinputs()); ((NeuralNetIndividualSpecies) algorithm.getSpecies()) .setNOfOutputs(evaluator.getTrainData().getNofoutputs()); // Read output files tokenizer = new StringTokenizer(props.getProperty("outputData")); String trainResultFile = tokenizer.nextToken(); trainResultFile = trainResultFile.substring(1, trainResultFile.length() - 1); consoleReporter.setTrainResultFile(trainResultFile); String testResultFile = tokenizer.nextToken(); testResultFile = testResultFile.substring(1, testResultFile.length() - 1); consoleReporter.setTestResultFile(testResultFile); String bestModelResultFile = tokenizer.nextToken(); bestModelResultFile = bestModelResultFile.substring(1, bestModelResultFile.length() - 1); consoleReporter.setBestModelResultFile(bestModelResultFile); listeners.add(consoleReporter); }
From source file:keel.Algorithms.Neural_Networks.IRPropPlus_Clas.KEELIRPropPlusWrapperClas.java
/** * <p>/*from w w w. ja va2s . c o m*/ * Configure the execution of the algorithm. * * @param jobFilename Name of the KEEL file with properties of the * execution * </p> */ @SuppressWarnings("unchecked") private static void configureJob(String jobFilename) { Properties props = new Properties(); try { InputStream paramsFile = new FileInputStream(jobFilename); props.load(paramsFile); paramsFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(0); } // Files training and test String trainFile; String testFile; StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData")); tokenizer.nextToken(); trainFile = tokenizer.nextToken(); trainFile = trainFile.substring(1, trainFile.length() - 1); testFile = tokenizer.nextToken(); testFile = testFile.substring(1, testFile.length() - 1); // Configure schema byte[] schema = null; try { schema = readSchema(trainFile); } catch (IOException e) { e.printStackTrace(); } catch (DatasetException e) { e.printStackTrace(); } // Auxiliar configuration file XMLConfiguration conf = new XMLConfiguration(); conf.setRootElementName("algorithm"); // Configure randGenFactory randGenFactory = new RanNnepFactory(); conf.addProperty("rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); if (randGenFactory instanceof IConfigure) ((IConfigure) randGenFactory).configure(conf.subset("rand-gen-factory")); // Configure species NeuralNetIndividualSpecies nnspecies = new NeuralNetIndividualSpecies(); species = (ISpecies) nnspecies; if (props.getProperty("Transfer").equals("Product_Unit")) { conf.addProperty("species.neural-net-type", "keel.Algorithms.Neural_Networks.IRPropPlus_Clas.MSEOptimizablePUNeuralNetClassifier"); conf.addProperty("species.hidden-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.ExpLayer"); conf.addProperty("species.hidden-layer[@biased]", false); } else { conf.addProperty("species.neural-net-type", "keel.Algorithms.Neural_Networks.IRPropPlus_Clas.MSEOptimizableSigmNeuralNetClassifier"); conf.addProperty("species.hidden-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.SigmLayer"); conf.addProperty("species.hidden-layer[@biased]", true); } int neurons = Integer.parseInt(props.getProperty("Hidden_nodes")); conf.addProperty("species.hidden-layer.minimum-number-of-neurons", neurons); conf.addProperty("species.hidden-layer.initial-maximum-number-of-neurons", neurons); conf.addProperty("species.hidden-layer.maximum-number-of-neurons", neurons); conf.addProperty("species.hidden-layer.initiator-of-links", "keel.Algorithms.Neural_Networks.IRPropPlus_Clas.FullRandomInitiator"); conf.addProperty("species.hidden-layer.weight-range[@type]", "net.sf.jclec.util.range.Interval"); conf.addProperty("species.hidden-layer.weight-range[@closure]", "closed-closed"); if (props.getProperty("Transfer").equals("Product_Unit")) { conf.addProperty("species.hidden-layer.weight-range[@left]", -0.1); conf.addProperty("species.hidden-layer.weight-range[@right]", 0.1); } else { conf.addProperty("species.hidden-layer.weight-range[@left]", -5.0); conf.addProperty("species.hidden-layer.weight-range[@right]", 5.0); } conf.addProperty("species.output-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.LinearLayer"); conf.addProperty("species.output-layer[@biased]", true); conf.addProperty("species.output-layer.initiator-of-links", "keel.Algorithms.Neural_Networks.IRPropPlus_Clas.FullRandomInitiator"); conf.addProperty("species.output-layer.weight-range[@type]", "net.sf.jclec.util.range.Interval"); conf.addProperty("species.output-layer.weight-range[@closure]", "closed-closed"); conf.addProperty("species.output-layer.weight-range[@left]", -5.0); conf.addProperty("species.output-layer.weight-range[@right]", 5.0); if (species instanceof IConfigure) ((IConfigure) species).configure(conf.subset("species")); // Configure evaluator evaluator = (IEvaluator) new SoftmaxClassificationProblemEvaluator(); if (props.getProperty("Transfer").equals("Product_Unit")) conf.addProperty("evaluator[@log-input-data]", true); conf.addProperty("evaluator[@normalize-data]", true); conf.addProperty("evaluator.error-function", "keel.Algorithms.Neural_Networks.NNEP_Clas.problem.errorfunctions.LogisticErrorFunction"); conf.addProperty("evaluator.input-interval[@closure]", "closed-closed"); conf.addProperty("evaluator.input-interval[@left]", 0.1); conf.addProperty("evaluator.input-interval[@right]", 0.9); conf.addProperty("evaluator.output-interval[@closure]", "closed-closed"); conf.addProperty("evaluator.output-interval[@left]", 0.0); conf.addProperty("evaluator.output-interval[@right]", 1.0); if (evaluator instanceof IConfigure) ((IConfigure) evaluator).configure(conf.subset("evaluator")); // Configure provider provider = new NeuralNetCreator(); KEELIRPropPlusWrapperClas system = new KEELIRPropPlusWrapperClas(); provider.contextualize(system); // Configure iRProp+ algorithm algorithm = new IRPropPlus(); conf.addProperty("algorithm.initial-step-size[@value]", 0.0125); conf.addProperty("algorithm.minimum-delta[@value]", 0.0); conf.addProperty("algorithm.maximum-delta[@value]", 50.0); conf.addProperty("algorithm.positive-eta[@value]", 1.2); conf.addProperty("algorithm.negative-eta[@value]", 0.2); conf.addProperty("algorithm.cycles[@value]", Integer.parseInt(props.getProperty("Epochs"))); if (algorithm instanceof IConfigure) ((IConfigure) algorithm).configure(conf.subset("algorithm")); // Read data ProblemEvaluator<AbstractIndividual<INeuralNet>> evaluator2 = (ProblemEvaluator<AbstractIndividual<INeuralNet>>) evaluator; evaluator2.readData(schema, new KeelDataSet(trainFile), new KeelDataSet(testFile)); nnspecies.setNOfInputs(evaluator2.getTrainData().getNofinputs()); nnspecies.setNOfOutputs(evaluator2.getTrainData().getNofoutputs() - 1); algorithm.setTrainingData(evaluator2.getTrainData()); // Read output files tokenizer = new StringTokenizer(props.getProperty("outputData")); String trainResultFile = tokenizer.nextToken(); trainResultFile = trainResultFile.substring(1, trainResultFile.length() - 1); consoleReporter.setTrainResultFile(trainResultFile); String testResultFile = tokenizer.nextToken(); testResultFile = testResultFile.substring(1, testResultFile.length() - 1); consoleReporter.setTestResultFile(testResultFile); String bestModelResultFile = tokenizer.nextToken(); bestModelResultFile = bestModelResultFile.substring(1, bestModelResultFile.length() - 1); consoleReporter.setBestModelResultFile(bestModelResultFile); }
From source file:keel.Algorithms.Neural_Networks.IRPropPlus_Regr.KEELIRPropPlusWrapperRegr.java
/** * <p>/*from w ww . ja v a2 s . c o m*/ * Configure the execution of the algorithm. * * @param jobFilename Name of the KEEL file with properties of the * execution * </p> */ @SuppressWarnings("unchecked") private static void configureJob(String jobFilename) { Properties props = new Properties(); try { InputStream paramsFile = new FileInputStream(jobFilename); props.load(paramsFile); paramsFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(0); } // Files training and test String trainFile; String testFile; StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData")); tokenizer.nextToken(); trainFile = tokenizer.nextToken(); trainFile = trainFile.substring(1, trainFile.length() - 1); testFile = tokenizer.nextToken(); testFile = testFile.substring(1, testFile.length() - 1); // Configure schema byte[] schema = null; try { schema = readSchema(trainFile); } catch (IOException e) { e.printStackTrace(); } catch (DatasetException e) { e.printStackTrace(); } // Auxiliar configuration file XMLConfiguration conf = new XMLConfiguration(); conf.setRootElementName("algorithm"); // Configure randGenFactory randGenFactory = new RanNnepFactory(); conf.addProperty("rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed"))); if (randGenFactory instanceof IConfigure) ((IConfigure) randGenFactory).configure(conf.subset("rand-gen-factory")); // Configure species NeuralNetIndividualSpecies nnspecies = new NeuralNetIndividualSpecies(); species = (ISpecies) nnspecies; if (props.getProperty("Transfer").equals("Product_Unit")) { conf.addProperty("species.neural-net-type", "keel.Algorithms.Neural_Networks.IRPropPlus_Regr.MSEOptimizablePUNeuralNetRegressor"); conf.addProperty("species.hidden-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.ExpLayer"); conf.addProperty("species.hidden-layer[@biased]", false); } else { conf.addProperty("species.neural-net-type", "keel.Algorithms.Neural_Networks.IRPropPlus_Regr.MSEOptimizableSigmNeuralNetRegressor"); conf.addProperty("species.hidden-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.SigmLayer"); conf.addProperty("species.hidden-layer[@biased]", true); } int neurons = Integer.parseInt(props.getProperty("Hidden_nodes")); conf.addProperty("species.hidden-layer.minimum-number-of-neurons", neurons); conf.addProperty("species.hidden-layer.initial-maximum-number-of-neurons", neurons); conf.addProperty("species.hidden-layer.maximum-number-of-neurons", neurons); conf.addProperty("species.hidden-layer.initiator-of-links", "keel.Algorithms.Neural_Networks.IRPropPlus_Clas.FullRandomInitiator"); conf.addProperty("species.hidden-layer.weight-range[@type]", "net.sf.jclec.util.range.Interval"); conf.addProperty("species.hidden-layer.weight-range[@closure]", "closed-closed"); if (props.getProperty("Transfer").equals("Product_Unit")) { conf.addProperty("species.hidden-layer.weight-range[@left]", -0.1); conf.addProperty("species.hidden-layer.weight-range[@right]", 0.1); } else { conf.addProperty("species.hidden-layer.weight-range[@left]", -5.0); conf.addProperty("species.hidden-layer.weight-range[@right]", 5.0); } conf.addProperty("species.output-layer[@type]", "keel.Algorithms.Neural_Networks.NNEP_Common.neuralnet.LinearLayer"); conf.addProperty("species.output-layer[@biased]", true); conf.addProperty("species.output-layer.initiator-of-links", "keel.Algorithms.Neural_Networks.IRPropPlus_Clas.FullRandomInitiator"); conf.addProperty("species.output-layer.weight-range[@type]", "net.sf.jclec.util.range.Interval"); conf.addProperty("species.output-layer.weight-range[@closure]", "closed-closed"); conf.addProperty("species.output-layer.weight-range[@left]", -5.0); conf.addProperty("species.output-layer.weight-range[@right]", 5.0); if (species instanceof IConfigure) ((IConfigure) species).configure(conf.subset("species")); // Configure evaluator evaluator = (IEvaluator) new RegressionProblemEvaluator(); if (props.getProperty("Transfer").equals("Product_Unit")) conf.addProperty("evaluator[@log-input-data]", true); conf.addProperty("evaluator[@normalize-data]", true); conf.addProperty("evaluator.error-function", "keel.Algorithms.Neural_Networks.NNEP_Regr.problem.errorfunctions.MSEErrorFunction"); conf.addProperty("evaluator.input-interval[@closure]", "closed-closed"); conf.addProperty("evaluator.input-interval[@left]", 0.1); conf.addProperty("evaluator.input-interval[@right]", 0.9); conf.addProperty("evaluator.output-interval[@closure]", "closed-closed"); conf.addProperty("evaluator.output-interval[@left]", 1.0); conf.addProperty("evaluator.output-interval[@right]", 2.0); if (evaluator instanceof IConfigure) ((IConfigure) evaluator).configure(conf.subset("evaluator")); // Configure provider provider = new NeuralNetCreator(); KEELIRPropPlusWrapperRegr system = new KEELIRPropPlusWrapperRegr(); provider.contextualize(system); // Configure iRProp+ algorithm algorithm = new IRPropPlus(); conf.addProperty("algorithm.initial-step-size[@value]", 0.0125); conf.addProperty("algorithm.minimum-delta[@value]", 0.0); conf.addProperty("algorithm.maximum-delta[@value]", 50.0); conf.addProperty("algorithm.positive-eta[@value]", 1.2); conf.addProperty("algorithm.negative-eta[@value]", 0.2); conf.addProperty("algorithm.cycles[@value]", Integer.parseInt(props.getProperty("Epochs"))); if (algorithm instanceof IConfigure) ((IConfigure) algorithm).configure(conf.subset("algorithm")); // Read data ProblemEvaluator<AbstractIndividual<INeuralNet>> evaluator2 = (ProblemEvaluator<AbstractIndividual<INeuralNet>>) evaluator; evaluator2.readData(schema, new KeelDataSet(trainFile), new KeelDataSet(testFile)); nnspecies.setNOfInputs(evaluator2.getTrainData().getNofinputs()); nnspecies.setNOfOutputs(evaluator2.getTrainData().getNofoutputs()); algorithm.setTrainingData(evaluator2.getTrainData()); // Read output files tokenizer = new StringTokenizer(props.getProperty("outputData")); String trainResultFile = tokenizer.nextToken(); trainResultFile = trainResultFile.substring(1, trainResultFile.length() - 1); consoleReporter.setTrainResultFile(trainResultFile); String testResultFile = tokenizer.nextToken(); testResultFile = testResultFile.substring(1, testResultFile.length() - 1); consoleReporter.setTestResultFile(testResultFile); String bestModelResultFile = tokenizer.nextToken(); bestModelResultFile = bestModelResultFile.substring(1, bestModelResultFile.length() - 1); consoleReporter.setBestModelResultFile(bestModelResultFile); }
From source file:com.eyeq.pivot4j.ui.property.SimplePropertyTest.java
@Test public void testSettingsManagement() throws ConfigurationException { SimpleProperty property = new SimpleProperty("bgColor", "red"); XMLConfiguration configuration = new XMLConfiguration(); configuration.setRootElementName("property"); property.saveSettings(configuration); SimpleProperty property2 = new SimpleProperty(); property2.restoreSettings(configuration); assertThat("Property name has been changed.", property2.getName(), is(equalTo(property.getName()))); assertThat("Property value has been changed.", property2.getValue(), is(equalTo(property.getValue()))); System.out.println("Saved configuration : "); configuration.save(System.out); }
From source file:com.eyeq.pivot4j.ui.condition.NotConditionTest.java
@Test public void testSettingsManagement() throws ConfigurationException { RenderContext context = createDummyRenderContext(); NotCondition not = new NotCondition(conditionFactory); not.setSubCondition(TestCondition.FALSE); XMLConfiguration configuration = new XMLConfiguration(); configuration.setRootElementName("condition"); not.saveSettings(configuration);/*from w w w . ja v a 2 s . co m*/ not = new NotCondition(conditionFactory); not.restoreSettings(configuration); assertThat("Sub condition should not be null.", not.getSubCondition(), is(notNullValue())); assertThat("'!false' should be true.", not.matches(context), is(true)); System.out.println("Saved configuration : "); configuration.save(System.out); }