public class knnImpute
extends java.lang.Object
This class computes the mean (numerical) or mode (nominal) value of the attributes with missing values for the selected neighbours for a given instance with missing values
Constructor and Description |
---|
knnImpute(java.lang.String fileParam)
Creates a new instance of MostCommonValue
|
Modifier and Type | Method and Description |
---|---|
double |
boundValueToAttributeLimits(double value,
Attribute a)
Takes a value and checks if it belongs to the attribute interval.
|
protected Instance |
nearestValidNeighbor(Instance inst,
int a)
Finds the nearest neighbor with a valid value in the specified attribute
|
void |
process()
Process the training and test files provided in the parameters file to the constructor.
|
protected boolean |
sameMissingInputAttributes(Instance inst1,
Instance inst2)
Checks if two instances present MVs for the same attributes
|
public knnImpute(java.lang.String fileParam)
fileParam
- The path to the configuration file with all the parameters in KEEL formatprotected boolean sameMissingInputAttributes(Instance inst1, Instance inst2)
Checks if two instances present MVs for the same attributes
inst1
- the first instanceinst2
- the second instanceprotected Instance nearestValidNeighbor(Instance inst, int a)
inst
- the instance to be taken as referencea
- the attribute which will be checkedpublic double boundValueToAttributeLimits(double value, Attribute a)
Takes a value and checks if it belongs to the attribute interval. If not, it returns the nearest limit. IT DOES NOT CHECK IF THE ATTRIBUTE IS NOT NOMINAL
value
- the value to be checkeda
- the attribute to which the value will be checked againstpublic void process()
Process the training and test files provided in the parameters file to the constructor.