@Title(value="Prior Probability Classifier") @Description(value="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,Result>
Modifier and Type | Field and Description |
---|---|
protected double[] |
distribution
Holds the prior probabilities.
|
protected java.util.ArrayList<ClassLabel> |
labels
Class labels seen.
|
private static Logging |
LOG
The logger for this class.
|
protected ClassLabel |
prediction
Index of the most abundant class.
|
ALGORITHM_ID
Constructor and Description |
---|
PriorProbabilityClassifier()
Constructor.
|
Modifier and Type | Method and 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.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
java.lang.String |
model()
Produce a String representation of the classification model.
|
alignLabels, run
private static final Logging LOG
protected double[] distribution
protected ClassLabel prediction
protected java.util.ArrayList<ClassLabel> labels
public void buildClassifier(Database database, Relation<? extends ClassLabel> labelrep)
database
- the database to build the model onlabelrep
- the classes to be learnedpublic double[] classProbabilities(java.lang.Object instance, java.util.ArrayList<ClassLabel> labels)
public ClassLabel classify(java.lang.Object instance)
Classifier
instance
- an instance to classifypublic java.lang.String model()
Classifier
public TypeInformation[] getInputTypeRestriction()
AbstractAlgorithm
getInputTypeRestriction
in interface Algorithm
getInputTypeRestriction
in class AbstractAlgorithm<Result>
protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<Result>
Copyright © 2019 ELKI Development Team. License information.