All Bundles
RandomForest
Random forest algorithm
Operations
Code example:
forest := RandomForest->New(8);
forest->Train(0.3, data);
result := forest->Query(data);
possible := Bool->Rows(result)->As(Float);
matched := DecisionTree->Matches(result->Columns() - 1, result)->As(Float);
matched_perc := (matched / possible * 100.0)->As(Int);
"matched {$matched_perc}%"->PrintLine();
New
Constructor
New(num_trees:Int)
Parameters
Name | Type | Description |
---|
num_trees | Int | number of trees to generate |
Load
Loads a saved random forest
function : Load(filename:String) ~ RandomForest
Parameters
Name | Type | Description |
---|
filename | String | file to store to |
Return
Query
Splits a matrix based on a list of decisions
method : public : native : Query(input:BoolMatrixRef) ~ Bool[,]
Parameters
Return
Splits a matrix based on a list of decisions
method : public : native : Query(input:Bool[,]) ~ Bool[,]
Parameters
Name | Type | Description |
---|
input | Bool[,] | matrix to be split |
Return
Store
Saves a random forest
method : public : Store(filename:String) ~ Bool
Parameters
Name | Type | Description |
---|
filename | String | file to save to |
Return
Type | Description |
---|
Bool | true if successful, false otherwise |
Train
Calculates a list of decision splits
method : public : native : Train(split_perc:Float, input:BoolMatrixRef) ~ Nil
Parameters
Name | Type | Description |
---|
split_perc | Float | percentage of data to use for training |
input | BoolMatrixRef | training matrix |
Calculates a list of decision splits
method : public : native : Train(split_perc:Float, input:Bool[,]) ~ Nil
Parameters
Name | Type | Description |
---|
split_perc | Float | percentage of data to use for training |
input | Bool[,] | training matrix |