- Timestamp:
- 07/18/16 12:26:03 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/training/WekaBaseTraining.java
r131 r135 27 27 28 28 /** 29 * WekaBaseTraining2 29 * <p> 30 * Allows specification of the Weka classifier and its params in the XML experiment configuration. 31 * </p> 32 * <p> 33 * Important conventions of the XML format: Cross Validation params always come last and are 34 * prepended with -CVPARAM.<br> 35 * Example: 30 36 * 31 * Allows specification of the Weka classifier and its params in the XML experiment configuration. 37 * <pre> 38 * {@code 39 * <trainer name="WekaTraining" param="RandomForestLocal weka.classifiers.trees.RandomForest -CVPARAM I 5 25 5"/> 40 * } 41 * </pre> 32 42 * 33 * Important conventions of the XML format: Cross Validation params always come last and are 34 * prepended with -CVPARAM Example: <trainer name="WekaTraining" 35 * param="RandomForestLocal weka.classifiers.trees.RandomForest -CVPARAM I 5 25 5"/> 43 * @author Alexander Trautsch 36 44 */ 37 45 public abstract class WekaBaseTraining implements IWekaCompatibleTrainer { 38 46 47 /** 48 * reference to the Weka classifier 49 */ 39 50 protected Classifier classifier = null; 51 52 /** 53 * qualified class name of the weka classifier 54 */ 40 55 protected String classifierClassName; 56 57 /** 58 * name of the classifier 59 */ 41 60 protected String classifierName; 61 62 /** 63 * parameters of the training 64 */ 42 65 protected String[] classifierParams; 43 66 67 /* 68 * (non-Javadoc) 69 * 70 * @see de.ugoe.cs.cpdp.IParameterizable#setParameter(java.lang.String) 71 */ 44 72 @Override 45 73 public void setParameter(String parameters) { … … 58 86 classifierParams = Arrays.copyOfRange(params, 2, params.length); 59 87 60 // classifier = setupClassifier();88 // classifier = setupClassifier(); 61 89 } 62 90 91 /* 92 * (non-Javadoc) 93 * 94 * @see de.ugoe.cs.cpdp.training.IWekaCompatibleTrainer#getClassifier() 95 */ 63 96 @Override 64 97 public Classifier getClassifier() { … … 66 99 } 67 100 101 /** 102 * <p> 103 * helper function that sets up the Weka classifier including its parameters 104 * </p> 105 * 106 * @return 107 */ 68 108 protected Classifier setupClassifier() { 69 109 Classifier cl = null; … … 95 135 cl = obj; 96 136 97 if ( cl instanceof Vote) {137 if (cl instanceof Vote) { 98 138 Vote votingClassifier = (Vote) cl; 99 for ( Classifier classifier : votingClassifier.getClassifiers()) {100 if ( classifier instanceof BayesNet) {139 for (Classifier classifier : votingClassifier.getClassifiers()) { 140 if (classifier instanceof BayesNet) { 101 141 ((BayesNet) classifier).setUseADTree(false); 102 142 } … … 141 181 } 142 182 183 /* 184 * (non-Javadoc) 185 * 186 * @see de.ugoe.cs.cpdp.training.IWekaCompatibleTrainer#getName() 187 */ 143 188 @Override 144 189 public String getName() {
Note: See TracChangeset
for help on using the changeset viewer.