public final class DecisionTree extends AbstractClassifier
| Modifier and Type | Method and Description |
|---|---|
void |
compileTree()
Compiles this current tree representation into byte code and loads it into
this class.
|
static DecisionTree |
create() |
static DecisionTree |
create(FeatureType[] featureTypes)
Creates a new decision tree with the given feature types.
|
static DecisionTree |
createCompiledTree() |
static DecisionTree |
createCompiledTree(FeatureType[] featureTypes)
Creates a new compiled decision tree with the given feature types.
|
static DecisionTree |
deserialize(DataInput in)
Reads a new tree from the given stream.
|
de.jungblut.math.DoubleVector |
predict(de.jungblut.math.DoubleVector features)
Classifies the given features.
|
static void |
serialize(DecisionTree tree,
DataOutput out)
Writes the given tree to the output stream.
|
DecisionTree |
setCompiled(boolean compiled)
If set to true, this tree will be compiled after training time
automatically.
|
DecisionTree |
setFeatureTypes(FeatureType[] featureTypes)
Sets the type of feature per index.
|
DecisionTree |
setMaxHeight(int max)
Sets the maximum height of this tree.
|
DecisionTree |
setNumRandomFeaturesToChoose(int numRandomFeaturesToChoose)
Sets the number of random features to choose from all features.Zero,
negative numbers or numbers greater than the really available features
indicate all features to be used.
|
DecisionTree |
setSeed(long seed)
Sets the seed for a random number generator if used.
|
void |
train(de.jungblut.math.DoubleVector[] features,
de.jungblut.math.DoubleVector[] outcome)
Trains this classifier with the given features and the outcome.
|
trainextractPredictedClass, extractPredictedClass, predictedClass, predictedClass, predictProbabilityclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasClassifier, extractPredictedClass, extractPredictedClass, predictedClass, predictedClass, predictProbabilitypublic void train(de.jungblut.math.DoubleVector[] features,
de.jungblut.math.DoubleVector[] outcome)
Classifiertrain in interface Classifiertrain in class AbstractClassifieroutcome - 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.public de.jungblut.math.DoubleVector predict(de.jungblut.math.DoubleVector features)
Predictorpublic void compileTree()
throws Exception
Exception - some error might happen during compilation or loading.public DecisionTree setFeatureTypes(FeatureType[] featureTypes)
public DecisionTree setNumRandomFeaturesToChoose(int numRandomFeaturesToChoose)
public DecisionTree setCompiled(boolean compiled)
public DecisionTree setMaxHeight(int max)
public DecisionTree setSeed(long seed)
public static void serialize(DecisionTree tree, DataOutput out) throws IOException
IOExceptionpublic static DecisionTree deserialize(DataInput in) throws IOException
IOExceptionpublic static DecisionTree create()
public static DecisionTree create(FeatureType[] featureTypes)
featureTypes - the types of the feature that must match the number of
features in length.public static DecisionTree createCompiledTree()
public static DecisionTree createCompiledTree(FeatureType[] featureTypes)
featureTypes - the types of the feature that must match the number of
features in length.Copyright © 2016. All rights reserved.