// Copyright 2015 Georg-August-Universität Göttingen, Germany // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package de.ugoe.cs.cpdp.dataselection; import weka.core.Instances; /** *

* Synonym outlier removal after Amasaki et al. (2015). *

* * @author Steffen Herbold */ public class SynonymOutlierRemoval implements IPointWiseDataselectionStrategy { /* (non-Javadoc) * @see de.ugoe.cs.cpdp.IParameterizable#setParameter(java.lang.String) */ @Override public void setParameter(String parameters) { // do nothing } /* (non-Javadoc) * @see de.ugoe.cs.cpdp.dataselection.IPointWiseDataselectionStrategy#apply(weka.core.Instances, weka.core.Instances) */ @Override public Instances apply(Instances testdata, Instances traindata) { applySynonymRemoval(traindata); return traindata; } /** *

* Applies the synonym outlier removal. *

* * @param traindata data from which the outliers are removed. */ public void applySynonymRemoval(Instances traindata) { double minDistance[][] = new double[traindata.size()][traindata.numAttributes()-1]; double minDistanceAttribute[] = new double[traindata.numAttributes()-1]; double distance; for( int j=0; j=0; i-- ) { boolean hasClosest = false; for( int j=0; !hasClosest && j