Package elki.classification
Class PriorProbabilityClassifier
- java.lang.Object
-
- elki.classification.AbstractClassifier<java.lang.Object,java.lang.Void>
-
- elki.classification.PriorProbabilityClassifier
-
- All Implemented Interfaces:
Algorithm
,Classifier<java.lang.Object>
@Title("Prior Probability Classifier") @Description("Classifier to predict simply prior probabilities for all classes as defined by their relative abundance in a given database.") public class PriorProbabilityClassifier extends AbstractClassifier<java.lang.Object,java.lang.Void>
Classifier to classify instances based on the prior probability of classes in the database, without using the actual data values.- Since:
- 0.7.0
- Author:
- Arthur Zimek
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface elki.Algorithm
Algorithm.Utils
-
-
Field Summary
Fields Modifier and Type Field Description protected double[]
distribution
Holds the prior probabilities.protected java.util.ArrayList<ClassLabel>
labels
Class labels seen.protected ClassLabel
prediction
Index of the most abundant class.
-
Constructor Summary
Constructors Constructor Description PriorProbabilityClassifier()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildClassifier(Database database, Relation<? extends ClassLabel> labelrep)
Learns the prior probability for all classes.ClassLabel
classify(java.lang.Object instance)
Classify a single instance.double[]
classProbabilities(java.lang.Object instance, java.util.ArrayList<ClassLabel> labels)
TypeInformation[]
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.java.lang.String
model()
Produce a String representation of the classification model.-
Methods inherited from class elki.classification.AbstractClassifier
alignLabels, autorun
-
-
-
-
Field Detail
-
distribution
protected double[] distribution
Holds the prior probabilities.
-
prediction
protected ClassLabel prediction
Index of the most abundant class.
-
labels
protected java.util.ArrayList<ClassLabel> labels
Class labels seen.
-
-
Method Detail
-
buildClassifier
public void buildClassifier(Database database, Relation<? extends ClassLabel> labelrep)
Learns the prior probability for all classes.- Parameters:
database
- the database to build the model onlabelrep
- the classes to be learned
-
classProbabilities
public double[] classProbabilities(java.lang.Object instance, java.util.ArrayList<ClassLabel> labels)
-
classify
public ClassLabel classify(java.lang.Object instance)
Description copied from interface:Classifier
Classify a single instance.- Parameters:
instance
- an instance to classify- Returns:
- predicted class label of the given instance
-
model
public java.lang.String model()
Description copied from interface:Classifier
Produce a String representation of the classification model.- Returns:
- a String representation of the classification model
-
getInputTypeRestriction
public TypeInformation[] getInputTypeRestriction()
Description copied from interface:Algorithm
Get the input type restriction used for negotiating the data query.- Returns:
- Type restriction
-
-