|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mulan.classifier.MultiLabelLearnerBase mulan.classifier.lazy.MultiLabelKNN
public abstract class MultiLabelKNN
Superclass of all KNN based multi-label algorithms
Field Summary | |
---|---|
protected DistanceFunction |
dfunc
Implementing Euclidean distance (or similarity) function. |
protected int |
distanceWeighting
Whether the neighbors should be distance-weighted. |
protected LinearNNSearch |
lnn
Class implementing the brute force search algorithm for nearest neighbor search. |
protected int |
numOfNeighbors
Number of neighbors used in the k-nearest neighbor algorithm |
protected Instances |
train
The training instances |
static int |
WEIGHT_INVERSE
weight by 1/distance. |
static int |
WEIGHT_NONE
no weighting. |
static int |
WEIGHT_SIMILARITY
weight by 1-distance. |
Fields inherited from class mulan.classifier.MultiLabelLearnerBase |
---|
featureIndices, labelIndices, numLabels |
Constructor Summary | |
---|---|
MultiLabelKNN()
The default constructor |
|
MultiLabelKNN(int numOfNeighbors)
Initializes the number of neighbors |
Method Summary | |
---|---|
protected void |
buildInternal(MultiLabelInstances trainSet)
Learner specific implementation of building the model from MultiLabelInstances
training data set. |
boolean |
isUpdatable()
Returns value indicating if learner is updatable, so if learner is able to perform on-line learning. |
void |
setDfunc(DistanceFunction dfunc)
Sets a distance function |
void |
setDistanceWeighting(int distanceWeighting)
|
Methods inherited from class mulan.classifier.MultiLabelLearnerBase |
---|
build, debug, getDebug, getTechnicalInformation, globalInfo, isModelInitialized, makeCopy, makePrediction, makePredictionInternal, setDebug |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int distanceWeighting
public static final int WEIGHT_NONE
public static final int WEIGHT_INVERSE
public static final int WEIGHT_SIMILARITY
protected int numOfNeighbors
protected LinearNNSearch lnn
protected DistanceFunction dfunc
protected Instances train
Constructor Detail |
---|
public MultiLabelKNN()
public MultiLabelKNN(int numOfNeighbors)
numOfNeighbors
- the number of neighborsMethod Detail |
---|
public void setDfunc(DistanceFunction dfunc)
dfunc
- the distance functionprotected void buildInternal(MultiLabelInstances trainSet) throws Exception
MultiLabelLearnerBase
MultiLabelInstances
training data set. This method is called from MultiLabelLearnerBase.build(MultiLabelInstances)
method,
where behavior common across all learners is applied.
buildInternal
in class MultiLabelLearnerBase
trainSet
- the training data set
Exception
- if learner model was not created successfullypublic boolean isUpdatable()
MultiLabelLearner
MultiLabelLearner.build(MultiLabelInstances)
method.false
is returned, each call of the
MultiLabelLearner.build(MultiLabelInstances)
will initialize the learner from
the scratch, removing any potential knowledge built by previously entered training data.
When true
is returned, then on the first call of the
MultiLabelLearner.build(MultiLabelInstances)
the learner is initialized
with the passed training data. All other calls contribute to the existing learner's
model with new data.
isUpdatable
in interface MultiLabelLearner
isUpdatable
in class MultiLabelLearnerBase
true
if learner is updatable (on-line), false
otherwise.public void setDistanceWeighting(int distanceWeighting)
distanceWeighting
- the distanceWeighting to set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |