- Timestamp:
- 07/18/16 12:26:03 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/dataprocessing/TCAPlusNormalization.java
r86 r135 19 19 import weka.core.Instances; 20 20 21 // normalization selected according to TCA+ rules (TCA has to be applied separately 21 /** 22 * <p> 23 * Normalization selected according to the TCA+ rules after Nam et al. (Transfer Defect Learning). 24 * </p> 25 * 26 * @author Steffen Herbold 27 */ 22 28 public class TCAPlusNormalization implements IProcessesingStrategy { 23 29 … … 30 36 @Override 31 37 public void setParameter(String parameters) { 32 // TODO Auto-generated method stub 33 38 // dummy, paramters not used 34 39 } 35 40 41 /* 42 * (non-Javadoc) 43 * 44 * @see de.ugoe.cs.cpdp.dataprocessing.IProcessesingStrategy#apply(weka.core.Instances, 45 * weka.core.Instances) 46 */ 36 47 @Override 37 48 public void apply(Instances testdata, Instances traindata) { 38 49 applyTCAPlus(testdata, traindata); 39 50 } 40 51 41 52 private void applyTCAPlus(Instances testdata, Instances traindata) { 42 53 DistChar dcTest = WekaUtils.datasetDistance(testdata); 43 54 DistChar dcTrain = WekaUtils.datasetDistance(traindata); 44 55 45 56 // RULE 1: 46 if( 0.9*dcTrain.mean<=dcTest.mean && 1.1*dcTrain.mean>=dcTest.mean && 47 0.9*dcTrain.std<=dcTest.std && 1.1*dcTrain.std>=dcTest.std) { 57 if (0.9 * dcTrain.mean <= dcTest.mean && 1.1 * dcTrain.mean >= dcTest.mean && 58 0.9 * dcTrain.std <= dcTest.std && 1.1 * dcTrain.std >= dcTest.std) 59 { 48 60 // do nothing 49 61 } 50 62 // RULE 2: 51 else if((0.4*dcTrain.min>dcTest.min || 1.6*dcTrain.min<dcTest.min) && 52 (0.4*dcTrain.max>dcTest.max || 1.6*dcTrain.min<dcTest.max) && 53 (0.4*dcTrain.min>dcTest.num || 1.6*dcTrain.min<dcTest.num)) { 63 else if ((0.4 * dcTrain.min > dcTest.min || 1.6 * dcTrain.min < dcTest.min) && 64 (0.4 * dcTrain.max > dcTest.max || 1.6 * dcTrain.min < dcTest.max) && 65 (0.4 * dcTrain.min > dcTest.num || 1.6 * dcTrain.min < dcTest.num)) 66 { 54 67 NormalizationUtil.minMax(testdata); 55 68 NormalizationUtil.minMax(traindata); 56 69 } 57 70 // RULE 3: 58 else if((0.4*dcTrain.std>dcTest.std && dcTrain.num<dcTest.num) || 59 (1.6*dcTrain.std<dcTest.std)&& dcTrain.num>dcTest.num) { 71 else if ((0.4 * dcTrain.std > dcTest.std && dcTrain.num < dcTest.num) || 72 (1.6 * dcTrain.std < dcTest.std) && dcTrain.num > dcTest.num) 73 { 60 74 NormalizationUtil.zScoreTraining(testdata, traindata); 61 75 } 62 76 // RULE 4: 63 else if((0.4*dcTrain.std>dcTest.std && dcTrain.num>dcTest.num) || 64 (1.6*dcTrain.std<dcTest.std)&& dcTrain.num<dcTest.num) { 77 else if ((0.4 * dcTrain.std > dcTest.std && dcTrain.num > dcTest.num) || 78 (1.6 * dcTrain.std < dcTest.std) && dcTrain.num < dcTest.num) 79 { 65 80 NormalizationUtil.zScoreTarget(testdata, traindata); 66 81 } 67 // RULE 5:82 // RULE 5: 68 83 else { 69 84 NormalizationUtil.zScore(testdata);
Note: See TracChangeset
for help on using the changeset viewer.