Changeset 41 for trunk/CrossPare/src/de/ugoe/cs/cpdp/execution
- Timestamp:
- 09/24/15 10:59:05 (9 years ago)
- Location:
- trunk/CrossPare/src/de/ugoe/cs/cpdp/execution
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/execution/ClassifierCreationExperiment.java
r33 r41 1 // Copyright 2015 Georg-August-Universität Göttingen, Germany 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 1 15 package de.ugoe.cs.cpdp.execution; 2 16 … … 19 33 20 34 /** 21 * Class responsible for executing an experiment according to an {@link ExperimentConfiguration}. The steps22 * of this ClassifierCreationExperiment are as follows:35 * Class responsible for executing an experiment according to an {@link ExperimentConfiguration}. 36 * The steps of this ClassifierCreationExperiment are as follows: 23 37 * <ul> 24 * <li>load the data from the provided data path</li> 25 * <li>check if given resultsdir exists, if not create one</li> 26 * <li>execute the following steps for each data set: 27 * <ul> 28 * <li>load the dataset</li> 29 * <li>set testdata == traindata</li> 30 * <li>preprocess the data</li> 31 * <li>postprocess the data</li> 32 * <li>for each configured trainer do the following:</li> 33 * <ul> 34 * <li>if the classifier should be saved, train it with the dataset</li> 35 * <li>save it in the results dir</li> 36 * <li>For each configured evaluator: Do the evaluation and save results</li> 37 * </ul> 38 * </ul> 38 * <li>load the data from the provided data path</li> 39 * <li>check if given resultsdir exists, if not create one</li> 40 * <li>execute the following steps for each data set: 41 * <ul> 42 * <li>load the dataset</li> 43 * <li>set testdata == traindata</li> 44 * <li>preprocess the data</li> 45 * <li>postprocess the data</li> 46 * <li>for each configured trainer do the following:</li> 47 * <ul> 48 * <li>if the classifier should be saved, train it with the dataset</li> 49 * <li>save it in the results dir</li> 50 * <li>For each configured evaluator: Do the evaluation and save results</li> 39 51 * </ul> 40 * 41 * Note that this class implements {@link IExectuionStrategy}, i.e., each experiment can be started 52 * </ul> 53 * </ul> 54 * 55 * Note that this class implements {@link IExectuionStrategy}, i.e., each experiment can be started 42 56 * in its own thread. 43 57 * … … 46 60 public class ClassifierCreationExperiment implements IExecutionStrategy { 47 61 48 /** 49 * configuration of the experiment 50 */ 51 private final ExperimentConfiguration config; 52 53 /** 54 * Constructor. Creates a new experiment based on a configuration. 55 * @param config configuration of the experiment 56 */ 57 public ClassifierCreationExperiment(ExperimentConfiguration config) { 58 this.config = config; 59 } 60 61 /** 62 * Executes the experiment with the steps as described in the class comment. 63 * @see Runnable#run() 64 */ 65 @Override 66 public void run() { 67 final List<SoftwareVersion> versions = new LinkedList<>(); 68 69 boolean writeHeader = true; 70 71 for(IVersionLoader loader : config.getLoaders()) { 72 versions.addAll(loader.load()); 73 } 74 62 /** 63 * configuration of the experiment 64 */ 65 private final ExperimentConfiguration config; 75 66 76 File resultsDir = new File(config.getResultsPath()); 77 if (!resultsDir.exists()) { 78 resultsDir.mkdir(); 79 } 80 81 82 int versionCount = 1; 83 for( SoftwareVersion testVersion : versions ) { 84 85 // At first: traindata == testdata 86 Instances testdata = testVersion.getInstances(); 87 Instances traindata = new Instances(testdata); 88 89 // Give the dataset a new name 90 testdata.setRelationName(testVersion.getProject()); 91 92 for( IProcessesingStrategy processor : config.getPreProcessors() ) { 93 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying preprocessor %s", config.getExperimentName(), versionCount, versions.size(), testVersion.getProject(), processor.getClass().getName())); 94 processor.apply(testdata, traindata); 95 } 96 97 for( IPointWiseDataselectionStrategy dataselector : config.getPointWiseSelectors() ) { 98 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying pointwise selection %s", config.getExperimentName(), versionCount, versions.size(), testVersion.getProject(), dataselector.getClass().getName())); 99 traindata = dataselector.apply(testdata, traindata); 100 } 101 102 for( IProcessesingStrategy processor : config.getPostProcessors() ) { 103 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", config.getExperimentName(), versionCount, versions.size(), testVersion.getProject(), processor.getClass().getName())); 104 processor.apply(testdata, traindata); 105 } 106 107 108 109 110 // Trainerlist for evaluation later on 111 List<ITrainer> allTrainers = new LinkedList<>(); 112 113 for( ITrainingStrategy trainer : config.getTrainers() ) { 67 /** 68 * Constructor. Creates a new experiment based on a configuration. 69 * 70 * @param config 71 * configuration of the experiment 72 */ 73 public ClassifierCreationExperiment(ExperimentConfiguration config) { 74 this.config = config; 75 } 114 76 115 // Add trainer to list for evaluation 116 allTrainers.add(trainer); 117 118 // Train classifier 119 trainer.apply(traindata); 120 121 if(config.getSaveClassifier()) { 122 // If classifier should be saved, train him and save him 123 // be careful with typecasting here! 124 IWekaCompatibleTrainer trainerToSave = (IWekaCompatibleTrainer) trainer; 125 //Console.println(trainerToSave.getClassifier().toString()); 126 try { 127 weka.core.SerializationHelper.write(resultsDir.getAbsolutePath()+"/"+trainer.getName()+"-"+testVersion.getProject(), trainerToSave.getClassifier()); 128 } catch (Exception e) { 129 e.printStackTrace(); 130 } 131 132 } 133 } 134 135 136 137 for( IEvaluationStrategy evaluator : config.getEvaluators() ) { 138 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying evaluator %s", config.getExperimentName(), versionCount, versions.size(), testVersion.getProject(), evaluator.getClass().getName())); 77 /** 78 * Executes the experiment with the steps as described in the class comment. 79 * 80 * @see Runnable#run() 81 */ 82 @Override 83 public void run() { 84 final List<SoftwareVersion> versions = new LinkedList<>(); 139 85 140 if( writeHeader ) { 141 evaluator.setParameter(config.getResultsPath() + "/" + config.getExperimentName() + ".csv"); 142 } 143 evaluator.apply(testdata, traindata, allTrainers, writeHeader); 144 writeHeader = false; 145 } 146 147 versionCount++; 148 149 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: finished", config.getExperimentName(), versionCount, versions.size(), testVersion.getProject())); 150 151 } 152 153 } 154 86 boolean writeHeader = true; 87 88 for (IVersionLoader loader : config.getLoaders()) { 89 versions.addAll(loader.load()); 90 } 91 92 File resultsDir = new File(config.getResultsPath()); 93 if (!resultsDir.exists()) { 94 resultsDir.mkdir(); 95 } 96 97 int versionCount = 1; 98 for (SoftwareVersion testVersion : versions) { 99 100 // At first: traindata == testdata 101 Instances testdata = testVersion.getInstances(); 102 Instances traindata = new Instances(testdata); 103 104 // Give the dataset a new name 105 testdata.setRelationName(testVersion.getProject()); 106 107 for (IProcessesingStrategy processor : config.getPreProcessors()) { 108 Console.traceln(Level.FINE, String 109 .format("[%s] [%02d/%02d] %s: applying preprocessor %s", 110 config.getExperimentName(), versionCount, versions.size(), 111 testVersion.getProject(), processor.getClass().getName())); 112 processor.apply(testdata, traindata); 113 } 114 115 for (IPointWiseDataselectionStrategy dataselector : config.getPointWiseSelectors()) { 116 Console.traceln(Level.FINE, String 117 .format("[%s] [%02d/%02d] %s: applying pointwise selection %s", 118 config.getExperimentName(), versionCount, versions.size(), 119 testVersion.getProject(), dataselector.getClass().getName())); 120 traindata = dataselector.apply(testdata, traindata); 121 } 122 123 for (IProcessesingStrategy processor : config.getPostProcessors()) { 124 Console.traceln(Level.FINE, String 125 .format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", 126 config.getExperimentName(), versionCount, versions.size(), 127 testVersion.getProject(), processor.getClass().getName())); 128 processor.apply(testdata, traindata); 129 } 130 131 // Trainerlist for evaluation later on 132 List<ITrainer> allTrainers = new LinkedList<>(); 133 134 for (ITrainingStrategy trainer : config.getTrainers()) { 135 136 // Add trainer to list for evaluation 137 allTrainers.add(trainer); 138 139 // Train classifier 140 trainer.apply(traindata); 141 142 if (config.getSaveClassifier()) { 143 // If classifier should be saved, train him and save him 144 // be careful with typecasting here! 145 IWekaCompatibleTrainer trainerToSave = (IWekaCompatibleTrainer) trainer; 146 // Console.println(trainerToSave.getClassifier().toString()); 147 try { 148 weka.core.SerializationHelper.write(resultsDir.getAbsolutePath() + "/" + 149 trainer.getName() + "-" + 150 testVersion.getProject(), 151 trainerToSave.getClassifier()); 152 } 153 catch (Exception e) { 154 e.printStackTrace(); 155 } 156 157 } 158 } 159 160 for (IEvaluationStrategy evaluator : config.getEvaluators()) { 161 Console.traceln(Level.FINE, String 162 .format("[%s] [%02d/%02d] %s: applying evaluator %s", 163 config.getExperimentName(), versionCount, versions.size(), 164 testVersion.getProject(), evaluator.getClass().getName())); 165 166 if (writeHeader) { 167 evaluator.setParameter(config.getResultsPath() + "/" + 168 config.getExperimentName() + ".csv"); 169 } 170 evaluator.apply(testdata, traindata, allTrainers, writeHeader); 171 writeHeader = false; 172 } 173 174 versionCount++; 175 176 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: finished", 177 config.getExperimentName(), versionCount, 178 versions.size(), testVersion.getProject())); 179 180 } 181 182 } 183 155 184 } -
trunk/CrossPare/src/de/ugoe/cs/cpdp/execution/CrossProjectExperiment.java
r32 r41 1 // Copyright 2015 Georg-August-Universität Göttingen, Germany 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 1 15 package de.ugoe.cs.cpdp.execution; 2 16 … … 25 39 26 40 /** 27 * Class responsible for executing an experiment according to an {@link ExperimentConfiguration}. The steps of an experiment are as follows: 41 * Class responsible for executing an experiment according to an {@link ExperimentConfiguration}. 42 * The steps of an experiment are as follows: 28 43 * <ul> 29 * <li>load the data from the provided data path</li> 30 * <li>filter the data sets according to the provided version filters</li> 31 * <li>execute the following steps for each data sets as test data that is not ignored through the test version filter: 32 * <ul> 33 * <li>filter the data sets to setup the candidate training data: 34 * <ul> 35 * <li>remove all data sets from the same project</li> 36 * <li>filter all data sets according to the training data filter 37 * </ul></li> 38 * <li>apply the setwise preprocessors</li> 39 * <li>apply the setwise data selection algorithms</li> 40 * <li>apply the setwise postprocessors</li> 41 * <li>train the setwise training classifiers</li> 42 * <li>unify all remaining training data into one data set</li> 43 * <li>apply the preprocessors</li> 44 * <li>apply the pointwise data selection algorithms</li> 45 * <li>apply the postprocessors</li> 46 * <li>train the normal classifiers</li> 47 * <li>evaluate the results for all trained classifiers on the training data</li> 48 * </ul></li> 44 * <li>load the data from the provided data path</li> 45 * <li>filter the data sets according to the provided version filters</li> 46 * <li>execute the following steps for each data sets as test data that is not ignored through the 47 * test version filter: 48 * <ul> 49 * <li>filter the data sets to setup the candidate training data: 50 * <ul> 51 * <li>remove all data sets from the same project</li> 52 * <li>filter all data sets according to the training data filter 53 * </ul> 54 * </li> 55 * <li>apply the setwise preprocessors</li> 56 * <li>apply the setwise data selection algorithms</li> 57 * <li>apply the setwise postprocessors</li> 58 * <li>train the setwise training classifiers</li> 59 * <li>unify all remaining training data into one data set</li> 60 * <li>apply the preprocessors</li> 61 * <li>apply the pointwise data selection algorithms</li> 62 * <li>apply the postprocessors</li> 63 * <li>train the normal classifiers</li> 64 * <li>evaluate the results for all trained classifiers on the training data</li> 65 * </ul> 66 * </li> 49 67 * </ul> 50 68 * 51 * Note that this class implements {@link Runnable}, i.e., each experiment can be started in its own thread. 69 * Note that this class implements {@link Runnable}, i.e., each experiment can be started in its own 70 * thread. 71 * 52 72 * @author Steffen Herbold 53 73 */ 54 74 public class CrossProjectExperiment implements IExecutionStrategy { 55 75 56 /** 57 * configuration of the experiment 58 */ 59 private final ExperimentConfiguration config; 60 61 /** 62 * Constructor. Creates a new experiment based on a configuration. 63 * @param config configuration of the experiment 64 */ 65 public CrossProjectExperiment(ExperimentConfiguration config) { 66 this.config = config; 67 } 68 69 /** 70 * Executes the experiment with the steps as described in the class comment. 71 * @see Runnable#run() 72 */ 73 @Override 74 public void run() { 75 final List<SoftwareVersion> versions = new LinkedList<>(); 76 77 for(IVersionLoader loader : config.getLoaders()) { 78 versions.addAll(loader.load()); 79 } 80 81 for( IVersionFilter filter : config.getVersionFilters() ) { 82 filter.apply(versions); 83 } 84 boolean writeHeader = true; 85 int versionCount = 1; 86 int testVersionCount = 0; 87 88 for( SoftwareVersion testVersion : versions ) { 89 if( isVersion(testVersion, config.getTestVersionFilters()) ) { 90 testVersionCount++; 91 } 92 } 93 94 // sort versions 95 Collections.sort(versions); 96 97 for( SoftwareVersion testVersion : versions ) { 98 if( isVersion(testVersion, config.getTestVersionFilters()) ) { 99 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: starting", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion())); 100 101 // Setup testdata and training data 102 Instances testdata = testVersion.getInstances(); 103 String testProject = testVersion.getProject(); 104 SetUniqueList<Instances> traindataSet = SetUniqueList.setUniqueList(new LinkedList<Instances>()); 105 for( SoftwareVersion trainingVersion : versions ) { 106 if( isVersion(trainingVersion, config.getTrainingVersionFilters()) ) { 107 if( trainingVersion!=testVersion ) { 108 if( !trainingVersion.getProject().equals(testProject) ) { 109 traindataSet.add(trainingVersion.getInstances()); 110 } 111 } 112 } 113 } 114 115 for( ISetWiseProcessingStrategy processor : config.getSetWisePreprocessors() ) { 116 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise preprocessor %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), processor.getClass().getName())); 117 processor.apply(testdata, traindataSet); 118 } 119 for( ISetWiseDataselectionStrategy dataselector : config.getSetWiseSelectors() ) { 120 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise selection %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), dataselector.getClass().getName())); 121 dataselector.apply(testdata, traindataSet); 122 } 123 for( ISetWiseProcessingStrategy processor : config.getSetWisePostprocessors() ) { 124 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), processor.getClass().getName())); 125 processor.apply(testdata, traindataSet); 126 } 127 for( ISetWiseTrainingStrategy setwiseTrainer : config.getSetWiseTrainers() ) { 128 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise trainer %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), setwiseTrainer.getName())); 129 setwiseTrainer.apply(traindataSet); 130 } 131 Instances traindata = makeSingleTrainingSet(traindataSet); 132 for( IProcessesingStrategy processor : config.getPreProcessors() ) { 133 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying preprocessor %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), processor.getClass().getName())); 134 processor.apply(testdata, traindata); 135 } 136 for( IPointWiseDataselectionStrategy dataselector : config.getPointWiseSelectors() ) { 137 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying pointwise selection %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), dataselector.getClass().getName())); 138 traindata = dataselector.apply(testdata, traindata); 139 } 140 for( IProcessesingStrategy processor : config.getPostProcessors() ) { 141 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), processor.getClass().getName())); 142 processor.apply(testdata, traindata); 143 } 144 for( ITrainingStrategy trainer : config.getTrainers() ) { 145 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying trainer %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), trainer.getName())); 146 trainer.apply(traindata); 147 } 148 File resultsDir = new File(config.getResultsPath()); 149 if (!resultsDir.exists()) { 150 resultsDir.mkdir(); 151 } 152 for( IEvaluationStrategy evaluator : config.getEvaluators() ) { 153 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying evaluator %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), evaluator.getClass().getName())); 154 List<ITrainer> allTrainers = new LinkedList<>(); 155 for( ISetWiseTrainingStrategy setwiseTrainer : config.getSetWiseTrainers() ) { 156 allTrainers.add(setwiseTrainer); 157 } 158 for( ITrainingStrategy trainer : config.getTrainers() ) { 159 allTrainers.add(trainer); 160 } 161 if( writeHeader ) { 162 evaluator.setParameter(config.getResultsPath() + "/" + config.getExperimentName() + ".csv"); 163 } 164 evaluator.apply(testdata, traindata, allTrainers, writeHeader); 165 writeHeader = false; 166 } 167 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: finished", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion())); 168 versionCount++; 169 } 170 } 171 } 172 173 /** 174 * Helper method that checks if a version passes all filters. 175 * @param version version that is checked 176 * @param filters list of the filters 177 * @return true, if the version passes all filters, false otherwise 178 */ 179 private boolean isVersion(SoftwareVersion version, List<IVersionFilter> filters) { 180 boolean result = true; 181 for( IVersionFilter filter : filters) { 182 result &= !filter.apply(version); 183 } 184 return result; 185 } 186 187 /** 188 * Helper method that combines a set of Weka {@link Instances} sets into a single {@link Instances} set. 189 * @param traindataSet set of {@link Instances} to be combines 190 * @return single {@link Instances} set 191 */ 192 public static Instances makeSingleTrainingSet(SetUniqueList<Instances> traindataSet) { 193 Instances traindataFull = null; 194 for( Instances traindata : traindataSet) { 195 if( traindataFull==null ) { 196 traindataFull = new Instances(traindata); 197 } else { 198 for( int i=0 ; i<traindata.numInstances() ; i++ ) { 199 traindataFull.add(traindata.instance(i)); 200 } 201 } 202 } 203 return traindataFull; 204 } 76 /** 77 * configuration of the experiment 78 */ 79 private final ExperimentConfiguration config; 80 81 /** 82 * Constructor. Creates a new experiment based on a configuration. 83 * 84 * @param config 85 * configuration of the experiment 86 */ 87 public CrossProjectExperiment(ExperimentConfiguration config) { 88 this.config = config; 89 } 90 91 /** 92 * Executes the experiment with the steps as described in the class comment. 93 * 94 * @see Runnable#run() 95 */ 96 @Override 97 public void run() { 98 final List<SoftwareVersion> versions = new LinkedList<>(); 99 100 for (IVersionLoader loader : config.getLoaders()) { 101 versions.addAll(loader.load()); 102 } 103 104 for (IVersionFilter filter : config.getVersionFilters()) { 105 filter.apply(versions); 106 } 107 boolean writeHeader = true; 108 int versionCount = 1; 109 int testVersionCount = 0; 110 111 for (SoftwareVersion testVersion : versions) { 112 if (isVersion(testVersion, config.getTestVersionFilters())) { 113 testVersionCount++; 114 } 115 } 116 117 // sort versions 118 Collections.sort(versions); 119 120 for (SoftwareVersion testVersion : versions) { 121 if (isVersion(testVersion, config.getTestVersionFilters())) { 122 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: starting", 123 config.getExperimentName(), versionCount, 124 testVersionCount, 125 testVersion.getVersion())); 126 127 // Setup testdata and training data 128 Instances testdata = testVersion.getInstances(); 129 String testProject = testVersion.getProject(); 130 SetUniqueList<Instances> traindataSet = 131 SetUniqueList.setUniqueList(new LinkedList<Instances>()); 132 for (SoftwareVersion trainingVersion : versions) { 133 if (isVersion(trainingVersion, config.getTrainingVersionFilters())) { 134 if (trainingVersion != testVersion) { 135 if (!trainingVersion.getProject().equals(testProject)) { 136 traindataSet.add(trainingVersion.getInstances()); 137 } 138 } 139 } 140 } 141 142 for (ISetWiseProcessingStrategy processor : config.getSetWisePreprocessors()) { 143 Console.traceln(Level.FINE, String 144 .format("[%s] [%02d/%02d] %s: applying setwise preprocessor %s", 145 config.getExperimentName(), versionCount, testVersionCount, 146 testVersion.getVersion(), processor.getClass().getName())); 147 processor.apply(testdata, traindataSet); 148 } 149 for (ISetWiseDataselectionStrategy dataselector : config.getSetWiseSelectors()) { 150 Console.traceln(Level.FINE, String 151 .format("[%s] [%02d/%02d] %s: applying setwise selection %s", 152 config.getExperimentName(), versionCount, testVersionCount, 153 testVersion.getVersion(), dataselector.getClass().getName())); 154 dataselector.apply(testdata, traindataSet); 155 } 156 for (ISetWiseProcessingStrategy processor : config.getSetWisePostprocessors()) { 157 Console.traceln(Level.FINE, String 158 .format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", 159 config.getExperimentName(), versionCount, testVersionCount, 160 testVersion.getVersion(), processor.getClass().getName())); 161 processor.apply(testdata, traindataSet); 162 } 163 for (ISetWiseTrainingStrategy setwiseTrainer : config.getSetWiseTrainers()) { 164 Console.traceln(Level.FINE, String 165 .format("[%s] [%02d/%02d] %s: applying setwise trainer %s", 166 config.getExperimentName(), versionCount, testVersionCount, 167 testVersion.getVersion(), setwiseTrainer.getName())); 168 setwiseTrainer.apply(traindataSet); 169 } 170 Instances traindata = makeSingleTrainingSet(traindataSet); 171 for (IProcessesingStrategy processor : config.getPreProcessors()) { 172 Console.traceln(Level.FINE, String 173 .format("[%s] [%02d/%02d] %s: applying preprocessor %s", 174 config.getExperimentName(), versionCount, testVersionCount, 175 testVersion.getVersion(), processor.getClass().getName())); 176 processor.apply(testdata, traindata); 177 } 178 for (IPointWiseDataselectionStrategy dataselector : config.getPointWiseSelectors()) 179 { 180 Console.traceln(Level.FINE, String 181 .format("[%s] [%02d/%02d] %s: applying pointwise selection %s", 182 config.getExperimentName(), versionCount, testVersionCount, 183 testVersion.getVersion(), dataselector.getClass().getName())); 184 traindata = dataselector.apply(testdata, traindata); 185 } 186 for (IProcessesingStrategy processor : config.getPostProcessors()) { 187 Console.traceln(Level.FINE, String 188 .format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", 189 config.getExperimentName(), versionCount, testVersionCount, 190 testVersion.getVersion(), processor.getClass().getName())); 191 processor.apply(testdata, traindata); 192 } 193 for (ITrainingStrategy trainer : config.getTrainers()) { 194 Console.traceln(Level.FINE, String 195 .format("[%s] [%02d/%02d] %s: applying trainer %s", 196 config.getExperimentName(), versionCount, testVersionCount, 197 testVersion.getVersion(), trainer.getName())); 198 trainer.apply(traindata); 199 } 200 File resultsDir = new File(config.getResultsPath()); 201 if (!resultsDir.exists()) { 202 resultsDir.mkdir(); 203 } 204 for (IEvaluationStrategy evaluator : config.getEvaluators()) { 205 Console.traceln(Level.FINE, String 206 .format("[%s] [%02d/%02d] %s: applying evaluator %s", 207 config.getExperimentName(), versionCount, testVersionCount, 208 testVersion.getVersion(), evaluator.getClass().getName())); 209 List<ITrainer> allTrainers = new LinkedList<>(); 210 for (ISetWiseTrainingStrategy setwiseTrainer : config.getSetWiseTrainers()) { 211 allTrainers.add(setwiseTrainer); 212 } 213 for (ITrainingStrategy trainer : config.getTrainers()) { 214 allTrainers.add(trainer); 215 } 216 if (writeHeader) { 217 evaluator.setParameter(config.getResultsPath() + "/" + 218 config.getExperimentName() + ".csv"); 219 } 220 evaluator.apply(testdata, traindata, allTrainers, writeHeader); 221 writeHeader = false; 222 } 223 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: finished", 224 config.getExperimentName(), versionCount, 225 testVersionCount, 226 testVersion.getVersion())); 227 versionCount++; 228 } 229 } 230 } 231 232 /** 233 * Helper method that checks if a version passes all filters. 234 * 235 * @param version 236 * version that is checked 237 * @param filters 238 * list of the filters 239 * @return true, if the version passes all filters, false otherwise 240 */ 241 private boolean isVersion(SoftwareVersion version, List<IVersionFilter> filters) { 242 boolean result = true; 243 for (IVersionFilter filter : filters) { 244 result &= !filter.apply(version); 245 } 246 return result; 247 } 248 249 /** 250 * Helper method that combines a set of Weka {@link Instances} sets into a single 251 * {@link Instances} set. 252 * 253 * @param traindataSet 254 * set of {@link Instances} to be combines 255 * @return single {@link Instances} set 256 */ 257 public static Instances makeSingleTrainingSet(SetUniqueList<Instances> traindataSet) { 258 Instances traindataFull = null; 259 for (Instances traindata : traindataSet) { 260 if (traindataFull == null) { 261 traindataFull = new Instances(traindata); 262 } 263 else { 264 for (int i = 0; i < traindata.numInstances(); i++) { 265 traindataFull.add(traindata.instance(i)); 266 } 267 } 268 } 269 return traindataFull; 270 } 205 271 } -
trunk/CrossPare/src/de/ugoe/cs/cpdp/execution/IExecutionStrategy.java
r32 r41 1 // Copyright 2015 Georg-August-Universität Göttingen, Germany 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 1 15 package de.ugoe.cs.cpdp.execution; 2 16 … … 4 18 5 19 /** 6 * Interface that must be implemented from the different experiments 7 * (e.g.ClassifierCreationExeperiment) to be runnable by {@link Runner}20 * Interface that must be implemented from the different experiments (e.g. 21 * ClassifierCreationExeperiment) to be runnable by {@link Runner} 8 22 * 9 23 * @author Fabian Trautsch 10 * 24 * 11 25 */ 12 public interface IExecutionStrategy extends Runnable {26 public interface IExecutionStrategy extends Runnable { 13 27 14 28 } -
trunk/CrossPare/src/de/ugoe/cs/cpdp/execution/RelaxedCrossProjectExperiment.java
r39 r41 1 // Copyright 2015 Georg-August-Universität Göttingen, Germany 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 1 15 package de.ugoe.cs.cpdp.execution; 2 16 … … 25 39 26 40 /** 27 * Class responsible for executing an experiment according to an {@link ExperimentConfiguration}. The steps of an experiment are as follows: 41 * Class responsible for executing an experiment according to an {@link ExperimentConfiguration}. 42 * The steps of an experiment are as follows: 28 43 * <ul> 29 * <li>load the data from the provided data path</li> 30 * <li>filter the data sets according to the provided version filters</li> 31 * <li>execute the following steps for each data sets as test data that is not ignored through the test version filter: 32 * <ul> 33 * <li>filter the data sets to setup the candidate training data: 34 * <ul> 35 * <li>filter all data sets according to the training data filter 36 * </ul></li> 37 * <li>apply the setwise preprocessors</li> 38 * <li>apply the setwise data selection algorithms</li> 39 * <li>apply the setwise postprocessors</li> 40 * <li>train the setwise training classifiers</li> 41 * <li>unify all remaining training data into one data set</li> 42 * <li>apply the preprocessors</li> 43 * <li>apply the pointwise data selection algorithms</li> 44 * <li>apply the postprocessors</li> 45 * <li>train the normal classifiers</li> 46 * <li>evaluate the results for all trained classifiers on the training data</li> 47 * </ul></li> 44 * <li>load the data from the provided data path</li> 45 * <li>filter the data sets according to the provided version filters</li> 46 * <li>execute the following steps for each data sets as test data that is not ignored through the 47 * test version filter: 48 * <ul> 49 * <li>filter the data sets to setup the candidate training data: 50 * <ul> 51 * <li>filter all data sets according to the training data filter 52 * </ul> 53 * </li> 54 * <li>apply the setwise preprocessors</li> 55 * <li>apply the setwise data selection algorithms</li> 56 * <li>apply the setwise postprocessors</li> 57 * <li>train the setwise training classifiers</li> 58 * <li>unify all remaining training data into one data set</li> 59 * <li>apply the preprocessors</li> 60 * <li>apply the pointwise data selection algorithms</li> 61 * <li>apply the postprocessors</li> 62 * <li>train the normal classifiers</li> 63 * <li>evaluate the results for all trained classifiers on the training data</li> 64 * </ul> 65 * </li> 48 66 * </ul> 49 67 * 50 * Note that this class implements {@link Runnable}, i.e., each experiment can be started in its own thread. 68 * Note that this class implements {@link Runnable}, i.e., each experiment can be started in its own 69 * thread. 70 * 51 71 * @author Steffen Herbold 52 72 */ 53 73 public class RelaxedCrossProjectExperiment implements IExecutionStrategy { 54 74 55 /** 56 * configuration of the experiment 57 */ 58 private final ExperimentConfiguration config; 59 60 /** 61 * Constructor. Creates a new experiment based on a configuration. 62 * @param config configuration of the experiment 63 */ 64 public RelaxedCrossProjectExperiment(ExperimentConfiguration config) { 65 this.config = config; 66 } 67 68 /** 69 * Executes the experiment with the steps as described in the class comment. 70 * @see Runnable#run() 71 */ 72 @Override 73 public void run() { 74 final List<SoftwareVersion> versions = new LinkedList<>(); 75 76 for(IVersionLoader loader : config.getLoaders()) { 77 versions.addAll(loader.load()); 78 } 79 80 for( IVersionFilter filter : config.getVersionFilters() ) { 81 filter.apply(versions); 82 } 83 boolean writeHeader = true; 84 int versionCount = 1; 85 int testVersionCount = 0; 86 87 for( SoftwareVersion testVersion : versions ) { 88 if( isVersion(testVersion, config.getTestVersionFilters()) ) { 89 testVersionCount++; 90 } 91 } 92 93 // sort versions 94 Collections.sort(versions); 95 96 for( SoftwareVersion testVersion : versions ) { 97 if( isVersion(testVersion, config.getTestVersionFilters()) ) { 98 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: starting", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion())); 99 100 // Setup testdata and training data 101 Instances testdata = testVersion.getInstances(); 102 String testProject = testVersion.getProject(); 103 SetUniqueList<Instances> traindataSet = SetUniqueList.setUniqueList(new LinkedList<Instances>()); 104 for( SoftwareVersion trainingVersion : versions ) { 105 if( isVersion(trainingVersion, config.getTrainingVersionFilters()) ) { 106 if( trainingVersion!=testVersion ) { 107 if( trainingVersion.getProject().equals(testProject) ) { 108 if( trainingVersion.compareTo(testVersion)<0 ) { 109 // only add if older 110 traindataSet.add(trainingVersion.getInstances()); 111 } 112 } else { 113 traindataSet.add(trainingVersion.getInstances()); 114 } 115 } 116 } 117 } 118 119 for( ISetWiseProcessingStrategy processor : config.getSetWisePreprocessors() ) { 120 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise preprocessor %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), processor.getClass().getName())); 121 processor.apply(testdata, traindataSet); 122 } 123 for( ISetWiseDataselectionStrategy dataselector : config.getSetWiseSelectors() ) { 124 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise selection %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), dataselector.getClass().getName())); 125 dataselector.apply(testdata, traindataSet); 126 } 127 for( ISetWiseProcessingStrategy processor : config.getSetWisePostprocessors() ) { 128 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), processor.getClass().getName())); 129 processor.apply(testdata, traindataSet); 130 } 131 for( ISetWiseTrainingStrategy setwiseTrainer : config.getSetWiseTrainers() ) { 132 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise trainer %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), setwiseTrainer.getName())); 133 setwiseTrainer.apply(traindataSet); 134 } 135 Instances traindata = makeSingleTrainingSet(traindataSet); 136 for( IProcessesingStrategy processor : config.getPreProcessors() ) { 137 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying preprocessor %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), processor.getClass().getName())); 138 processor.apply(testdata, traindata); 139 } 140 for( IPointWiseDataselectionStrategy dataselector : config.getPointWiseSelectors() ) { 141 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying pointwise selection %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), dataselector.getClass().getName())); 142 traindata = dataselector.apply(testdata, traindata); 143 } 144 for( IProcessesingStrategy processor : config.getPostProcessors() ) { 145 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), processor.getClass().getName())); 146 processor.apply(testdata, traindata); 147 } 148 for( ITrainingStrategy trainer : config.getTrainers() ) { 149 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying trainer %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), trainer.getName())); 150 trainer.apply(traindata); 151 } 152 File resultsDir = new File(config.getResultsPath()); 153 if (!resultsDir.exists()) { 154 resultsDir.mkdir(); 155 } 156 for( IEvaluationStrategy evaluator : config.getEvaluators() ) { 157 Console.traceln(Level.FINE, String.format("[%s] [%02d/%02d] %s: applying evaluator %s", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion(), evaluator.getClass().getName())); 158 List<ITrainer> allTrainers = new LinkedList<>(); 159 for( ISetWiseTrainingStrategy setwiseTrainer : config.getSetWiseTrainers() ) { 160 allTrainers.add(setwiseTrainer); 161 } 162 for( ITrainingStrategy trainer : config.getTrainers() ) { 163 allTrainers.add(trainer); 164 } 165 if( writeHeader ) { 166 evaluator.setParameter(config.getResultsPath() + "/" + config.getExperimentName() + ".csv"); 167 } 168 evaluator.apply(testdata, traindata, allTrainers, writeHeader); 169 writeHeader = false; 170 } 171 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: finished", config.getExperimentName(), versionCount, testVersionCount, testVersion.getVersion())); 172 versionCount++; 173 } 174 } 175 } 176 177 /** 178 * Helper method that checks if a version passes all filters. 179 * @param version version that is checked 180 * @param filters list of the filters 181 * @return true, if the version passes all filters, false otherwise 182 */ 183 private boolean isVersion(SoftwareVersion version, List<IVersionFilter> filters) { 184 boolean result = true; 185 for( IVersionFilter filter : filters) { 186 result &= !filter.apply(version); 187 } 188 return result; 189 } 190 191 /** 192 * Helper method that combines a set of Weka {@link Instances} sets into a single {@link Instances} set. 193 * @param traindataSet set of {@link Instances} to be combines 194 * @return single {@link Instances} set 195 */ 196 public static Instances makeSingleTrainingSet(SetUniqueList<Instances> traindataSet) { 197 Instances traindataFull = null; 198 for( Instances traindata : traindataSet) { 199 if( traindataFull==null ) { 200 traindataFull = new Instances(traindata); 201 } else { 202 for( int i=0 ; i<traindata.numInstances() ; i++ ) { 203 traindataFull.add(traindata.instance(i)); 204 } 205 } 206 } 207 return traindataFull; 208 } 75 /** 76 * configuration of the experiment 77 */ 78 private final ExperimentConfiguration config; 79 80 /** 81 * Constructor. Creates a new experiment based on a configuration. 82 * 83 * @param config 84 * configuration of the experiment 85 */ 86 public RelaxedCrossProjectExperiment(ExperimentConfiguration config) { 87 this.config = config; 88 } 89 90 /** 91 * Executes the experiment with the steps as described in the class comment. 92 * 93 * @see Runnable#run() 94 */ 95 @Override 96 public void run() { 97 final List<SoftwareVersion> versions = new LinkedList<>(); 98 99 for (IVersionLoader loader : config.getLoaders()) { 100 versions.addAll(loader.load()); 101 } 102 103 for (IVersionFilter filter : config.getVersionFilters()) { 104 filter.apply(versions); 105 } 106 boolean writeHeader = true; 107 int versionCount = 1; 108 int testVersionCount = 0; 109 110 for (SoftwareVersion testVersion : versions) { 111 if (isVersion(testVersion, config.getTestVersionFilters())) { 112 testVersionCount++; 113 } 114 } 115 116 // sort versions 117 Collections.sort(versions); 118 119 for (SoftwareVersion testVersion : versions) { 120 if (isVersion(testVersion, config.getTestVersionFilters())) { 121 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: starting", 122 config.getExperimentName(), versionCount, 123 testVersionCount, 124 testVersion.getVersion())); 125 126 // Setup testdata and training data 127 Instances testdata = testVersion.getInstances(); 128 String testProject = testVersion.getProject(); 129 SetUniqueList<Instances> traindataSet = 130 SetUniqueList.setUniqueList(new LinkedList<Instances>()); 131 for (SoftwareVersion trainingVersion : versions) { 132 if (isVersion(trainingVersion, config.getTrainingVersionFilters())) { 133 if (trainingVersion != testVersion) { 134 if (trainingVersion.getProject().equals(testProject)) { 135 if (trainingVersion.compareTo(testVersion) < 0) { 136 // only add if older 137 traindataSet.add(trainingVersion.getInstances()); 138 } 139 } 140 else { 141 traindataSet.add(trainingVersion.getInstances()); 142 } 143 } 144 } 145 } 146 147 for (ISetWiseProcessingStrategy processor : config.getSetWisePreprocessors()) { 148 Console.traceln(Level.FINE, String 149 .format("[%s] [%02d/%02d] %s: applying setwise preprocessor %s", 150 config.getExperimentName(), versionCount, testVersionCount, 151 testVersion.getVersion(), processor.getClass().getName())); 152 processor.apply(testdata, traindataSet); 153 } 154 for (ISetWiseDataselectionStrategy dataselector : config.getSetWiseSelectors()) { 155 Console.traceln(Level.FINE, String 156 .format("[%s] [%02d/%02d] %s: applying setwise selection %s", 157 config.getExperimentName(), versionCount, testVersionCount, 158 testVersion.getVersion(), dataselector.getClass().getName())); 159 dataselector.apply(testdata, traindataSet); 160 } 161 for (ISetWiseProcessingStrategy processor : config.getSetWisePostprocessors()) { 162 Console.traceln(Level.FINE, String 163 .format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", 164 config.getExperimentName(), versionCount, testVersionCount, 165 testVersion.getVersion(), processor.getClass().getName())); 166 processor.apply(testdata, traindataSet); 167 } 168 for (ISetWiseTrainingStrategy setwiseTrainer : config.getSetWiseTrainers()) { 169 Console.traceln(Level.FINE, String 170 .format("[%s] [%02d/%02d] %s: applying setwise trainer %s", 171 config.getExperimentName(), versionCount, testVersionCount, 172 testVersion.getVersion(), setwiseTrainer.getName())); 173 setwiseTrainer.apply(traindataSet); 174 } 175 Instances traindata = makeSingleTrainingSet(traindataSet); 176 for (IProcessesingStrategy processor : config.getPreProcessors()) { 177 Console.traceln(Level.FINE, String 178 .format("[%s] [%02d/%02d] %s: applying preprocessor %s", 179 config.getExperimentName(), versionCount, testVersionCount, 180 testVersion.getVersion(), processor.getClass().getName())); 181 processor.apply(testdata, traindata); 182 } 183 for (IPointWiseDataselectionStrategy dataselector : config.getPointWiseSelectors()) 184 { 185 Console.traceln(Level.FINE, String 186 .format("[%s] [%02d/%02d] %s: applying pointwise selection %s", 187 config.getExperimentName(), versionCount, testVersionCount, 188 testVersion.getVersion(), dataselector.getClass().getName())); 189 traindata = dataselector.apply(testdata, traindata); 190 } 191 for (IProcessesingStrategy processor : config.getPostProcessors()) { 192 Console.traceln(Level.FINE, String 193 .format("[%s] [%02d/%02d] %s: applying setwise postprocessor %s", 194 config.getExperimentName(), versionCount, testVersionCount, 195 testVersion.getVersion(), processor.getClass().getName())); 196 processor.apply(testdata, traindata); 197 } 198 for (ITrainingStrategy trainer : config.getTrainers()) { 199 Console.traceln(Level.FINE, String 200 .format("[%s] [%02d/%02d] %s: applying trainer %s", 201 config.getExperimentName(), versionCount, testVersionCount, 202 testVersion.getVersion(), trainer.getName())); 203 trainer.apply(traindata); 204 } 205 File resultsDir = new File(config.getResultsPath()); 206 if (!resultsDir.exists()) { 207 resultsDir.mkdir(); 208 } 209 for (IEvaluationStrategy evaluator : config.getEvaluators()) { 210 Console.traceln(Level.FINE, String 211 .format("[%s] [%02d/%02d] %s: applying evaluator %s", 212 config.getExperimentName(), versionCount, testVersionCount, 213 testVersion.getVersion(), evaluator.getClass().getName())); 214 List<ITrainer> allTrainers = new LinkedList<>(); 215 for (ISetWiseTrainingStrategy setwiseTrainer : config.getSetWiseTrainers()) { 216 allTrainers.add(setwiseTrainer); 217 } 218 for (ITrainingStrategy trainer : config.getTrainers()) { 219 allTrainers.add(trainer); 220 } 221 if (writeHeader) { 222 evaluator.setParameter(config.getResultsPath() + "/" + 223 config.getExperimentName() + ".csv"); 224 } 225 evaluator.apply(testdata, traindata, allTrainers, writeHeader); 226 writeHeader = false; 227 } 228 Console.traceln(Level.INFO, String.format("[%s] [%02d/%02d] %s: finished", 229 config.getExperimentName(), versionCount, 230 testVersionCount, 231 testVersion.getVersion())); 232 versionCount++; 233 } 234 } 235 } 236 237 /** 238 * Helper method that checks if a version passes all filters. 239 * 240 * @param version 241 * version that is checked 242 * @param filters 243 * list of the filters 244 * @return true, if the version passes all filters, false otherwise 245 */ 246 private boolean isVersion(SoftwareVersion version, List<IVersionFilter> filters) { 247 boolean result = true; 248 for (IVersionFilter filter : filters) { 249 result &= !filter.apply(version); 250 } 251 return result; 252 } 253 254 /** 255 * Helper method that combines a set of Weka {@link Instances} sets into a single 256 * {@link Instances} set. 257 * 258 * @param traindataSet 259 * set of {@link Instances} to be combines 260 * @return single {@link Instances} set 261 */ 262 public static Instances makeSingleTrainingSet(SetUniqueList<Instances> traindataSet) { 263 Instances traindataFull = null; 264 for (Instances traindata : traindataSet) { 265 if (traindataFull == null) { 266 traindataFull = new Instances(traindata); 267 } 268 else { 269 for (int i = 0; i < traindata.numInstances(); i++) { 270 traindataFull.add(traindata.instance(i)); 271 } 272 } 273 } 274 return traindataFull; 275 } 209 276 }
Note: See TracChangeset
for help on using the changeset viewer.