- Timestamp:
- 09/17/15 13:46:16 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/dataprocessing/LogarithmTransform.java
r2 r40 35 35 Instance instance = testdata.instance(i); 36 36 for( int j=0 ; j<testdata.numAttributes() ; j++ ) { 37 if( testdata.attribute(j)!=classAttribute ) { 38 instance.setValue(j, Math.log(1+instance.value(j))); 37 if( testdata.attribute(j)!=classAttribute && testdata.attribute(j).isNumeric() ) { 38 if( instance.value(j) < 0 ) { 39 instance.setValue(j, (-1*(Math.log(-1*instance.value(j))))); 40 }else { 41 instance.setValue(j, Math.log(1+instance.value(j))); 42 } 39 43 } 40 44 } … … 46 50 Instance instance = traindata.instance(i); 47 51 for( int j=0 ; j<testdata.numAttributes() ; j++ ) { 48 if( testdata.attribute(j)!=classAttribute ) { 49 instance.setValue(j, Math.log(1+instance.value(j))); 52 if( traindata.attribute(j)!=classAttribute && traindata.attribute(j).isNumeric() ) { 53 if( instance.value(j) < 0 ) { 54 instance.setValue(j, (-1*(Math.log(-1*instance.value(j))))); 55 }else { 56 instance.setValue(j, Math.log(1+instance.value(j))); 57 } 50 58 } 51 59 } … … 65 73 Instance instance = testdata.instance(i); 66 74 for( int j=0 ; j<testdata.numAttributes() ; j++ ) { 67 if( testdata.attribute(j)!=classAttribute ) { 68 instance.setValue(j, Math.log(1+instance.value(j))); 75 if( testdata.attribute(j)!=classAttribute && testdata.attribute(j).isNumeric() ) { 76 if( instance.value(j) < 0 ) { 77 instance.setValue(j, (-1*(Math.log(-1*instance.value(j))))); 78 }else { 79 instance.setValue(j, Math.log(1+instance.value(j))); 80 } 69 81 } 70 82 } … … 75 87 Instance instance = traindata.instance(i); 76 88 for( int j=0 ; j<testdata.numAttributes() ; j++ ) { 77 if( testdata.attribute(j)!=classAttribute ) { 78 instance.setValue(j, Math.log(1+instance.value(j))); 89 if( traindata.attribute(j)!=classAttribute && traindata.attribute(j).isNumeric() ) { 90 if( instance.value(j) < 0 ) { 91 instance.setValue(j, (-1*(Math.log(-1*instance.value(j))))); 92 }else { 93 instance.setValue(j, Math.log(1+instance.value(j))); 94 } 79 95 } 80 96 }
Note: See TracChangeset
for help on using the changeset viewer.