public class MINND extends Classifier implements OptionHandler, MultiInstanceCapabilitiesHandler, TechnicalInformationHandler
@misc{Xu2001, address = {Hamilton, NZ}, author = {Xin Xu}, note = {0657.591B}, school = {University of Waikato}, title = {A nearest distribution approach to multiple-instance learning}, year = {2001} }Valid options are:
-K <number of neighbours> Set number of nearest neighbour for prediction (default 1)
-S <number of neighbours> Set number of nearest neighbour for cleansing the training data (default 1)
-E <number of neighbours> Set number of nearest neighbour for cleansing the testing data (default 1)
Constructor and Description |
---|
MINND() |
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances exs)
As normal Nearest Neighbour algorithm does, it's lazy and simply
records the exemplar information (i.e.
|
double |
classifyInstance(Instance ex)
Use Kullback Leibler distance to find the nearest neighbours of
the given exemplar.
|
Instance |
cleanse(Instance before)
Cleanse the given exemplar according to the valid and noise data
statistics
|
void |
findWeights(int row,
double[][] mean)
Use gradient descent to distort the MU parameter for
the exemplar.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
Capabilities |
getMultiInstanceCapabilities()
Returns the capabilities of this multi-instance classifier for the
relational data.
|
int |
getNumNeighbours()
Returns the number of nearest neighbours to estimate
the class prediction of tests bags
|
int |
getNumTestingNoises()
Returns The number of nearest neighbour instances in the
selection of noises in the test data
|
int |
getNumTrainingNoises()
Returns the number of nearest neighbour instances in the
selection of noises in the training data
|
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier.
|
java.lang.String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
java.lang.String |
globalInfo()
Returns a string describing this filter
|
double |
kullback(double[] mu1,
double[] mu2,
double[] var1,
double[] var2,
int pos)
This function calculates the Kullback Leibler distance between
two normal distributions.
|
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options
|
static void |
main(java.lang.String[] args)
Main method for testing.
|
java.lang.String |
numNeighboursTipText()
Returns the tip text for this property
|
java.lang.String |
numTestingNoisesTipText()
Returns the tip text for this property
|
java.lang.String |
numTrainingNoisesTipText()
Returns the tip text for this property
|
Instance |
preprocess(Instances data,
int pos)
Pre-process the given exemplar according to the other exemplars
in the given exemplars.
|
void |
setNumNeighbours(int numNeighbour)
Sets the number of nearest neighbours to estimate
the class prediction of tests bags
|
void |
setNumTestingNoises(int numTesting)
Sets The number of nearest neighbour exemplars in the
selection of noises in the test data
|
void |
setNumTrainingNoises(int numTraining)
Sets the number of nearest neighbour instances in the
selection of noises in the training data
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
double |
target(double[] x,
double[][] X,
int rowpos,
double[] Y)
Compute the target function to minimize in gradient descent
The formula is:
1/2*sum[i=1..p](f(X, Xi)-var(Y, Yi))^2 where p is the number of exemplars and Y is the class label. |
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, setDebug
public java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public Capabilities getMultiInstanceCapabilities()
getMultiInstanceCapabilities
in interface MultiInstanceCapabilitiesHandler
Capabilities
public void buildClassifier(Instances exs) throws java.lang.Exception
buildClassifier
in class Classifier
exs
- the training exemplarsjava.lang.Exception
- if the model cannot be built properlypublic Instance preprocess(Instances data, int pos) throws java.lang.Exception
data
- the whole exemplarspos
- the position of given exemplar in datajava.lang.Exception
- if the returned exemplar is wrongpublic void findWeights(int row, double[][] mean)
row
- the given row indexmean
- public double target(double[] x, double[][] X, int rowpos, double[] Y)
x
- the weights of the exemplar in questionrowpos
- row index of x in XY
- the observed class labelpublic double classifyInstance(Instance ex) throws java.lang.Exception
classifyInstance
in class Classifier
ex
- the given test exemplarjava.lang.Exception
- if the exemplar could not be classified
successfullypublic Instance cleanse(Instance before) throws java.lang.Exception
before
- the given exemplarjava.lang.Exception
- if the returned exemplar is wrongpublic double kullback(double[] mu1, double[] mu2, double[] var1, double[] var2, int pos)
mu1
- mu of the first normal distributionmu2
- mu of the second normal distributionvar1
- variance(SIGMA^2) of the first normal distributionvar2
- variance(SIGMA^2) of the second normal distributionpublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-K <number of neighbours> Set number of nearest neighbour for prediction (default 1)
-S <number of neighbours> Set number of nearest neighbour for cleansing the training data (default 1)
-E <number of neighbours> Set number of nearest neighbour for cleansing the testing data (default 1)
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public java.lang.String numNeighboursTipText()
public void setNumNeighbours(int numNeighbour)
numNeighbour
- the number of citerspublic int getNumNeighbours()
public java.lang.String numTrainingNoisesTipText()
public void setNumTrainingNoises(int numTraining)
numTraining
- the number of noises in training datapublic int getNumTrainingNoises()
public java.lang.String numTestingNoisesTipText()
public int getNumTestingNoises()
public void setNumTestingNoises(int numTesting)
numTesting
- the number of noises in test datapublic java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(java.lang.String[] args)
args
- the options for the classifier