public class KNNClassifier
extends java.lang.Object
Constructor and Description |
---|
KNNClassifier() |
Modifier and Type | Method and Description |
---|---|
static double |
accuracy()
Estimates the LVO (Leave-one-out) accuracy of the classifier
over the training data.
|
static int |
classifyNewInstance(double[] example)
Classifies a new example
|
static int |
classifyTrainingInstance(int index)
Classifies a training example
|
static double |
computeFSReduction()
Computes reduction rates over features
|
static double |
computeISReduction()
Computes reduction rates over instances
|
static int[] |
getFS()
Get a vector with the features currently selected
|
static int[] |
getIS()
Get a vector with the instances currently selected
|
static java.lang.String |
printFS()
Returns a string representation of the features selection vector
|
static void |
setAllFeatures()
On the features selector vector, sets the all the features to 1 (selected)
|
static void |
setAllInstances()
On the instance selector vector, sets the all the instances to 1 (selected)
|
static void |
setClasses(int value)
Sets the number of classes in the data
|
static void |
setData(double[][] newData)
Loads the training data into the classifier
|
static void |
setFeatures(int[] selected)
Sets the vector of features selected
|
static void |
setInstances(int[] selected)
Sets the vector of instances selected
|
static void |
setK(int value)
Sets the K value
|
static void |
setOutput(int[] newOutput)
Loads the training output into the classifier
|
public static void setClasses(int value)
value
- Number of classespublic static void setK(int value)
value
- K valuepublic static void setData(double[][] newData)
newData
- Data represented with continuous valuespublic static void setOutput(int[] newOutput)
newOutput
- Output attribute of the training datapublic static void setInstances(int[] selected)
selected
- Vector of instances selectedpublic static void setFeatures(int[] selected)
selected
- Vector of features selectedpublic static void setAllInstances()
public static void setAllFeatures()
public static double accuracy()
public static int classifyNewInstance(double[] example)
example
- Example to classifypublic static int classifyTrainingInstance(int index)
index
- Training example to classifypublic static double computeISReduction()
public static double computeFSReduction()
public static int[] getIS()
public static int[] getFS()
public static java.lang.String printFS()