Package com.tagtraum.core.ml
Class RandomForest
- java.lang.Object
-
- com.tagtraum.core.ml.RandomForest
-
- Direct Known Subclasses:
RandomForestClassifier
,RandomForestRegressor
public abstract class RandomForest extends Object
RandomForest.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
RandomForest.Node
Node.
-
Field Summary
Fields Modifier and Type Field Description protected List<RandomForest.Node>
trees
-
Constructor Summary
Constructors Constructor Description RandomForest(URL model)
Creates a Random Forest based on the provided model file.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract float
predict(float[] features)
byte[]
toBinary()
Create binary representation of this forest.String
toDebugString()
Human readable debug string.String
toString()
-
-
-
Field Detail
-
trees
protected final List<RandomForest.Node> trees
-
-
Constructor Detail
-
RandomForest
public RandomForest(URL model) throws IOException
Creates a Random Forest based on the provided model file. The file may be a text file, like it is produced by Spark'stoDebugString()
. Additionally, gzip compression is supported, if the file name end's in.gz
, and a proprietary binary format generated bytoBinary()
.- Parameters:
model
- model file- Throws:
IOException
-
-
Method Detail
-
predict
public abstract float predict(float[] features)
-
toDebugString
public String toDebugString()
Human readable debug string.- Returns:
- string
-
toBinary
public byte[] toBinary()
Create binary representation of this forest.- Returns:
- binary representation
-
-