package de.ugoe.cs.cpdp.dataprocessing;
import org.apache.commons.collections4.list.SetUniqueList;
import weka.core.Attribute;
import weka.core.Instance;
import weka.core.Instances;
/**
* Standardization procedure after Watanabe et al.: Adapting a Fault Prediction Model to Allow Inter Language Reuse.
*
* In comparison to Watanabe et al., we transform training data instead of the test data. Otherwise, this approach would not be feasible with multiple projects.
* @author Steffen Herbold
*/
public class AverageStandardization implements ISetWiseProcessingStrategy, IProcessesingStrategy {
/**
* Does not have parameters. String is ignored.
* @param parameters ignored
*/
@Override
public void setParameter(String parameters) {
// dummy
}
/**
* @see de.ugoe.cs.cpdp.dataprocessing.SetWiseProcessingStrategy#apply(weka.core.Instances, org.apache.commons.collections4.list.SetUniqueList)
*/
@Override
public void apply(Instances testdata, SetUniqueList traindataSet) {
final Attribute classAttribute = testdata.classAttribute();
final double[] meanTest = new double[testdata.numAttributes()];
// get means of testdata
for( int j=0 ; j