mulan.classifier.lazy
Class MLkNN

java.lang.Object
  extended by mulan.classifier.MultiLabelLearnerBase
      extended by mulan.classifier.lazy.MultiLabelKNN
          extended by mulan.classifier.lazy.MLkNN
All Implemented Interfaces:
Serializable, MultiLabelLearner, TechnicalInformationHandler

public class MLkNN
extends MultiLabelKNN

Class implementing the ML-kNN (Multi-Label k Nearest Neighbours) algorithm.

For more information, see

Min-Ling Zhang, Zhi-Hua Zhou (2007). ML-KNN: A lazy learning approach to multi-label learning. Pattern Recogn.. 40(7):2038--2048.

BibTeX:

 @article{Zhang2007,
    address = {New York, NY, USA},
    author = {Min-Ling Zhang and Zhi-Hua Zhou},
    journal = {Pattern Recogn.},
    number = {7},
    pages = {2038--2048},
    publisher = {Elsevier Science Inc.},
    title = {ML-KNN: A lazy learning approach to multi-label learning},
    volume = {40},
    year = {2007},
    ISSN = {0031-3203}
 }
 

Version:
2012.07.16
Author:
Eleftherios Spyromitros-Xioufis
See Also:
Serialized Form

Field Summary
protected  double smooth
          Smoothing parameter controlling the strength of uniform prior
(Default value is set to 1 which yields the Laplace smoothing).
 
Fields inherited from class mulan.classifier.lazy.MultiLabelKNN
dfunc, distanceWeighting, lnn, numOfNeighbors, train, WEIGHT_INVERSE, WEIGHT_NONE, WEIGHT_SIMILARITY
 
Fields inherited from class mulan.classifier.MultiLabelLearnerBase
featureIndices, labelIndices, numLabels
 
Constructor Summary
MLkNN()
          The default constructor
MLkNN(int numOfNeighbors, double smooth)
           
 
Method Summary
protected  void buildInternal(MultiLabelInstances train)
          Learner specific implementation of building the model from MultiLabelInstances training data set.
 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.
 String globalInfo()
          Returns a string describing the multi-label learner.
protected  MultiLabelOutput makePredictionInternal(Instance instance)
          Learner specific implementation for predicting on specified data based on trained model.
 
Methods inherited from class mulan.classifier.lazy.MultiLabelKNN
isUpdatable, setDfunc, setDistanceWeighting
 
Methods inherited from class mulan.classifier.MultiLabelLearnerBase
build, debug, getDebug, isModelInitialized, makeCopy, makePrediction, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

smooth

protected double smooth
Smoothing parameter controlling the strength of uniform prior
(Default value is set to 1 which yields the Laplace smoothing).

Constructor Detail

MLkNN

public MLkNN(int numOfNeighbors,
             double smooth)
Parameters:
numOfNeighbors - : the number of neighbors
smooth - : the smoothing factor

MLkNN

public MLkNN()
The default constructor

Method Detail

globalInfo

public String globalInfo()
Description copied from class: MultiLabelLearnerBase
Returns a string describing the multi-label learner.

Specified by:
globalInfo in class MultiLabelLearnerBase
Returns:
a description suitable for displaying in a future gui

getTechnicalInformation

public TechnicalInformation getTechnicalInformation()
Description copied from class: MultiLabelLearnerBase
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.

Specified by:
getTechnicalInformation in interface TechnicalInformationHandler
Specified by:
getTechnicalInformation in class MultiLabelLearnerBase
Returns:
the technical information about this class

buildInternal

protected void buildInternal(MultiLabelInstances train)
                      throws Exception
Description copied from class: MultiLabelLearnerBase
Learner specific implementation of building the model from MultiLabelInstances training data set. This method is called from MultiLabelLearnerBase.build(MultiLabelInstances) method, where behavior common across all learners is applied.

Overrides:
buildInternal in class MultiLabelKNN
Parameters:
train - the training data set
Throws:
Exception - if learner model was not created successfully

makePredictionInternal

protected MultiLabelOutput makePredictionInternal(Instance instance)
                                           throws Exception
Description copied from class: MultiLabelLearnerBase
Learner specific implementation for predicting on specified data based on trained model. This method is called from MultiLabelLearnerBase.makePrediction(weka.core.Instance) which guards for model initialization and apply common handling/behavior.

Specified by:
makePredictionInternal in class MultiLabelLearnerBase
Parameters:
instance - the data instance to predict on
Returns:
the output of the learner for the given instance
Throws:
Exception - if an error occurs while making the prediction.
InvalidDataException - if specified instance data is invalid and can not be processed by the learner