@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<Object,Result>
Modifier and Type | Field and Description |
---|---|
protected double[] |
distribution
Holds the prior probabilities.
|
protected ArrayList<ClassLabel> |
labels
Class labels seen.
|
private static Logging |
LOG
The logger for this class.
|
protected ClassLabel |
prediction
Index of the most abundant class.
|
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(Object instance)
Classify a single instance.
|
double[] |
classProbabilities(Object instance,
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.
|
String |
model()
Produce a String representation of the classification model.
|
alignLabels, run
makeParameterDistanceFunction
private static final Logging LOG
protected double[] distribution
protected ClassLabel prediction
protected 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(Object instance, ArrayList<ClassLabel> labels)
public ClassLabel classify(Object instance)
Classifier
instance
- an instance to classifypublic 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 © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.