Package de.jungblut.classification
Class UntrainableClassifier
- java.lang.Object
-
- de.jungblut.classification.UntrainableClassifier
-
- All Implemented Interfaces:
Classifier,Predictor
public class UntrainableClassifier extends java.lang.Object implements Classifier
-
-
Constructor Summary
Constructors Constructor Description UntrainableClassifier(Predictor predictor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intextractPredictedClass(de.jungblut.math.DoubleVector predict)Given an already done prediction, choose the class.intextractPredictedClass(de.jungblut.math.DoubleVector predict, double threshold)Given an already done prediction, choose the class with a threshold.de.jungblut.math.DoubleVectorpredict(de.jungblut.math.DoubleVector features)Classifies the given features.intpredictedClass(de.jungblut.math.DoubleVector features)Classifies the given features.intpredictedClass(de.jungblut.math.DoubleVector features, double threshold)Classifies the given features.de.jungblut.math.DoubleVectorpredictProbability(de.jungblut.math.DoubleVector features)Classifies the given features.voidtrain(de.jungblut.math.DoubleVector[] features, de.jungblut.math.DoubleVector[] outcome)Trains this classifier with the given features and the outcome.voidtrain(java.lang.Iterable<de.jungblut.math.DoubleVector> features, java.lang.Iterable<de.jungblut.math.DoubleVector> outcome)Trains this classifier with the given features and the outcome.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.jungblut.classification.Predictor
asClassifier
-
-
-
-
Constructor Detail
-
UntrainableClassifier
public UntrainableClassifier(Predictor predictor)
-
-
Method Detail
-
predict
public de.jungblut.math.DoubleVector predict(de.jungblut.math.DoubleVector features)
Description copied from interface:PredictorClassifies the given features.
-
predictProbability
public de.jungblut.math.DoubleVector predictProbability(de.jungblut.math.DoubleVector features)
Description copied from interface:PredictorClassifies the given features.- Specified by:
predictProbabilityin interfacePredictor- Returns:
- a vector that returns the probability of all outcomes. The output vector should sum to one.
-
predictedClass
public int predictedClass(de.jungblut.math.DoubleVector features, double threshold)Description copied from interface:PredictorClassifies the given features.- Specified by:
predictedClassin interfacePredictorthreshold- the threshold for the prediction "probability". In the sigmoid and binary case, you want to set everything greater (>) 0.5 to 1d and everything below (<=) to 0d.- Returns:
- the predicted class as an integer for the output of a classifier.
-
predictedClass
public int predictedClass(de.jungblut.math.DoubleVector features)
Description copied from interface:PredictorClassifies the given features.- Specified by:
predictedClassin interfacePredictor- Returns:
- the predicted class as an integer for the output of a classifier.
-
extractPredictedClass
public int extractPredictedClass(de.jungblut.math.DoubleVector predict)
Description copied from interface:PredictorGiven an already done prediction, choose the class.- Specified by:
extractPredictedClassin interfacePredictor- Returns:
- the class index as integer.
-
extractPredictedClass
public int extractPredictedClass(de.jungblut.math.DoubleVector predict, double threshold)Description copied from interface:PredictorGiven an already done prediction, choose the class with a threshold.- Specified by:
extractPredictedClassin interfacePredictor- Returns:
- the class index as integer.
-
train
public void train(java.lang.Iterable<de.jungblut.math.DoubleVector> features, java.lang.Iterable<de.jungblut.math.DoubleVector> outcome)Description copied from interface:ClassifierTrains this classifier with the given features and the outcome. This is the streaming method for training, it takes parallel iterables.- Specified by:
trainin interfaceClassifieroutcome- the outcome must have classes labeled as doubles. E.G. in the binary case you have a single element and decide between 0d and 1d. In higher dimensional cases you have each of these single elements mapped to a dimension.
-
train
public void train(de.jungblut.math.DoubleVector[] features, de.jungblut.math.DoubleVector[] outcome)Description copied from interface:ClassifierTrains this classifier with the given features and the outcome.- Specified by:
trainin interfaceClassifieroutcome- the outcome must have classes labeled as doubles. E.G. in the binary case you have a single element and decide between 0d and 1d. In higher dimensional cases you have each of these single elements mapped to a dimension.
-
-