Changeset 129 for trunk/CrossPare/src/de/ugoe/cs/cpdp/wekaclassifier
- Timestamp:
- 06/22/16 11:25:46 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/wekaclassifier/AbstractCODEP.java
r128 r129 23 23 import java.util.regex.Pattern; 24 24 25 import de.ugoe.cs.cpdp.util.WekaUtils; 25 26 import de.ugoe.cs.util.console.Console; 26 27 import weka.classifiers.AbstractClassifier; … … 71 72 private Map<Integer, Integer> upscaleIndex = null; 72 73 73 /**74 * Scaling value that moves the decimal point by 5 digets.75 */76 private final double SCALER = 10000.0d;77 78 74 /* 79 75 * (non-Javadoc) … … 136 132 } 137 133 else { 138 traindataCopy = upscaleAttribute(traindata, attrIndex);134 traindataCopy = WekaUtils.upscaleAttribute(traindata, attrIndex); 139 135 } 140 136 … … 182 178 // instance value must be upscaled 183 179 int attrIndex = upscaleIndex.get(j); 184 double upscaledVal = instance.value(attrIndex) * SCALER;180 double upscaledVal = instance.value(attrIndex) * WekaUtils.SCALER; 185 181 traindataCopy = new Instances(instance.dataset()); 186 182 instance = new DenseInstance(instance.weight(), instance.toDoubleArray()); … … 231 227 /** 232 228 * <p> 233 * Upscales the value of a single attribute. This is a workaround to get BayesNet running for234 * all data. Works on a copy of the training data, i.e., leaves the original data untouched.235 * </p>236 *237 * @param traindata238 * data from which the attribute is upscaled.239 * @param attributeIndex240 * index of the attribute241 * @return data with upscaled attribute242 */243 private Instances upscaleAttribute(Instances traindata, int attributeIndex) {244 Instances traindataCopy = new Instances(traindata);245 for (int i = 0; i < traindata.size(); i++) {246 traindataCopy.get(i).setValue(attributeIndex,247 traindata.get(i).value(attributeIndex) * SCALER);248 }249 return traindataCopy;250 }251 252 /**253 * <p>254 229 * Abstract method through which implementing classes define which classifier is used for the 255 230 * CODEP.
Note: See TracChangeset
for help on using the changeset viewer.