Package se.hb.jcp.nc
Class kNearestSameClassNeighbourNonconformityFunction
- java.lang.Object
-
- se.hb.jcp.nc.ClassifierNonconformityFunctionBase
-
- se.hb.jcp.nc.kNearestSameClassNeighbourNonconformityFunction
-
- All Implemented Interfaces:
java.io.Serializable,IClassifierInformation,IClassificationNonconformityFunction
public class kNearestSameClassNeighbourNonconformityFunction extends ClassifierNonconformityFunctionBase implements java.io.Serializable
This class implements a nonconformity function based on the k-nearest same class neighbour function.- Author:
- anders.gidenstam(at)hb.se
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description kNearestSameClassNeighbourNonconformityFunction(double[] classes, int k)kNearestSameClassNeighbourNonconformityFunction(double[] classes, int k, IClassifier classifier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecalculateNonConformityScore(cern.colt.matrix.DoubleMatrix1D x, double y)Computes the non-conformity score for the instance x with the target y.IClassificationNonconformityFunctionfitNew(cern.colt.matrix.DoubleMatrix2D x, double[] y)Returns a new non-conformity function based on the same parameters as the current one initialized with the supplied data.-
Methods inherited from class se.hb.jcp.nc.ClassifierNonconformityFunctionBase
calc_nc, calc_nc, fit, fitNew, getAttributeCount, getClassifier, getLabels, isTrained, nativeStorageTemplate
-
-
-
-
Constructor Detail
-
kNearestSameClassNeighbourNonconformityFunction
public kNearestSameClassNeighbourNonconformityFunction(double[] classes, int k)
-
kNearestSameClassNeighbourNonconformityFunction
public kNearestSameClassNeighbourNonconformityFunction(double[] classes, int k, IClassifier classifier)
-
-
Method Detail
-
fitNew
public IClassificationNonconformityFunction fitNew(cern.colt.matrix.DoubleMatrix2D x, double[] y)
Description copied from interface:IClassificationNonconformityFunctionReturns a new non-conformity function based on the same parameters as the current one initialized with the supplied data.- Specified by:
fitNewin interfaceIClassificationNonconformityFunction- Specified by:
fitNewin classClassifierNonconformityFunctionBase- Parameters:
x- the instances.y- the targets or classes of the instances.- Returns:
- a new non-conformity function.
-
calculateNonConformityScore
public double calculateNonConformityScore(cern.colt.matrix.DoubleMatrix1D x, double y)Description copied from interface:IClassificationNonconformityFunctionComputes the non-conformity score for the instance x with the target y.- Specified by:
calculateNonConformityScorein interfaceIClassificationNonconformityFunction- Specified by:
calculateNonConformityScorein classClassifierNonconformityFunctionBase- Parameters:
x- the instance.y- the target/class/label.- Returns:
- the non-conformity score. Large means less conforming.
-
-