mulan.classifier.lazy
Class BRkNN

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

public class BRkNN
extends MultiLabelKNN

Simple BR implementation of the KNN algorithm.For more information, see

Eleftherios Spyromitros, Grigorios Tsoumakas, Ioannis Vlahavas: An Empirical Study of Lazy Multilabel Classification Algorithms. In: Proc. 5th Hellenic Conference on Artificial Intelligence (SETN 2008), 2008.

BibTeX:

 @inproceedings{EleftheriosSpyromitros2008,
    author = {Eleftherios Spyromitros, Grigorios Tsoumakas, Ioannis Vlahavas},
    booktitle = {Proc. 5th Hellenic Conference on Artificial Intelligence (SETN 2008)},
    title = {An Empirical Study of Lazy Multilabel Classification Algorithms},
    year = {2008},
    location = {Syros, Greece}
 }
 

Version:
2010.12.29
Author:
Eleftherios Spyromitros-Xioufis, Grigorios Tsoumakas
See Also:
Serialized Form

Nested Class Summary
static class BRkNN.ExtensionType
          The two types of extensions
 
Field Summary
 
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
BRkNN()
          Default constructor
BRkNN(int numOfNeighbors)
          A constructor that sets the number of neighbors
BRkNN(int numOfNeighbors, BRkNN.ExtensionType ext)
          Constructor giving the option to select an extension of the base version
 
Method Summary
protected  void buildInternal(MultiLabelInstances aTrain)
          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  boolean[] labelsFromConfidences2(double[] confidences)
          used for BRknn-a
protected  boolean[] labelsFromConfidences3(double[] confidences)
          used for BRkNN-b (break ties arbitrarily)
protected  MultiLabelOutput makePredictionInternal(Instance instance)
          weka Ibk style prediction
 void setCvMaxK(int cvMaxK)
          set the maximum number of neighbors to be evaluated via cross-validation
 void setkSelectionViaCV(boolean flag)
           
 
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
 

Constructor Detail

BRkNN

public BRkNN()
Default constructor


BRkNN

public BRkNN(int numOfNeighbors)
A constructor that sets the number of neighbors

Parameters:
numOfNeighbors -

BRkNN

public BRkNN(int numOfNeighbors,
             BRkNN.ExtensionType ext)
Constructor giving the option to select an extension of the base version

Parameters:
numOfNeighbors -
ext - the extension to use (see BRkNN.ExtensionType)
Method Detail

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 aTrain)
                      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:
aTrain - the training data set
Throws:
Exception - if learner model was not created successfully

setkSelectionViaCV

public void setkSelectionViaCV(boolean flag)
Parameters:
flag - if true the k is selected via cross-validation

makePredictionInternal

protected MultiLabelOutput makePredictionInternal(Instance instance)
                                           throws Exception
weka Ibk style prediction

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 nearest neighbours search fails

labelsFromConfidences2

protected boolean[] labelsFromConfidences2(double[] confidences)
used for BRknn-a

Parameters:
confidences - the probabilities for each label
Returns:
a bipartition

labelsFromConfidences3

protected boolean[] labelsFromConfidences3(double[] confidences)
used for BRkNN-b (break ties arbitrarily)

Parameters:
confidences - the probabilities for each label
Returns:
a bipartition

setCvMaxK

public void setCvMaxK(int cvMaxK)
set the maximum number of neighbors to be evaluated via cross-validation

Parameters:
cvMaxK -

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