- Timestamp:
- 10/31/14 15:54:08 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/training/WekaBaseTraining2.java
r7 r20 5 5 6 6 import de.ugoe.cs.util.console.Console; 7 7 8 import weka.core.OptionHandler; 8 9 import weka.classifiers.Classifier; 9 10 import weka.classifiers.meta.CVParameterSelection; 10 11 12 /** 13 * WekaBaseTraining2 14 * 15 * Allows specification of the Weka classifier and its params in the XML experiment configuration. 16 * 17 * Important conventions of the XML format: 18 * Cross Validation params come always last and are prepended with -CVPARAM 19 * Example: <trainer name="WekaClusterTraining2" param="RandomForestLocal weka.classifiers.trees.RandomForest -CVPARAM I 5 25 5"/> 20 */ 11 21 public abstract class WekaBaseTraining2 implements WekaCompatibleTrainer { 12 22 … … 20 30 String[] params = parameters.split(" "); 21 31 22 // first is classifierName32 // first part of the params is the classifierName (e.g. SMORBF) 23 33 classifierName = params[0]; 24 34 25 // allfollowing parameters can be copied from weka!35 // the following parameters can be copied from weka! 26 36 27 // second param is classifierClassName 37 // second param is classifierClassName (e.g. weka.classifiers.functions.SMO) 28 38 classifierClassName = params[1]; 29 39 30 // rest are params to the specified classifier 40 // rest are params to the specified classifier (e.g. -K weka.classifiers.functions.supportVector.RBFKernel) 31 41 classifierParams = Arrays.copyOfRange(params, 2, params.length); 32 42 … … 46 56 Classifier obj = (Classifier) c.newInstance(); 47 57 48 // Filter -CVPARAM58 // Filter out -CVPARAM, these are special because they do not belong to the Weka classifier class as parameters 49 59 String[] param = Arrays.copyOf(classifierParams, classifierParams.length); 50 60 String[] cvparam = {}; … … 68 78 69 79 // we have cross val params 70 // cant check on cvparam.length may not be initialized80 // cant check on cvparam.length here, it may not be initialized 71 81 if(cv) { 72 82 final CVParameterSelection ps = new CVParameterSelection();
Note: See TracChangeset
for help on using the changeset viewer.