Ignore:
Timestamp:
06/22/16 11:25:46 (8 years ago)
Author:
sherbold
Message:
  • added the same workaround for the problem with Discretize to the TopMetricFilter?. We slightly refactored the implementation within the AbstractCODEP by putting the rescaling of sets to the WekaUtils? to facilitate better re-use.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/util/WekaUtils.java

    r86 r129  
    3737        } 
    3838    } 
     39     
     40    /** 
     41     * Scaling value that moves the decimal point by 5 digets. 
     42     */ 
     43    public final static double SCALER = 10000.0d; 
    3944     
    4045    /** 
     
    151156        return new DistChar(mean, std, min, max, data.numInstances()); 
    152157    } 
     158     
     159    /** 
     160     * <p> 
     161     * Upscales the value of a single attribute. This is a workaround to get BayesNet running for 
     162     * all data. Works on a copy of the training data, i.e., leaves the original data untouched. 
     163     * </p> 
     164     * 
     165     * @param traindata 
     166     *            data from which the attribute is upscaled. 
     167     * @param attributeIndex 
     168     *            index of the attribute 
     169     * @return data with upscaled attribute 
     170     */ 
     171    public static Instances upscaleAttribute(Instances traindata, int attributeIndex) { 
     172        Instances traindataCopy = new Instances(traindata); 
     173        for (int i = 0; i < traindata.size(); i++) { 
     174            traindataCopy.get(i).setValue(attributeIndex, 
     175                                          traindata.get(i).value(attributeIndex) * SCALER); 
     176        } 
     177        return traindataCopy; 
     178    } 
    153179} 
Note: See TracChangeset for help on using the changeset viewer.