mlpack.random_forest
random_forest(...)Random forests
>>> from mlpack import random_forest
This program is an implementation of the standard random forest classification algorithm by Leo Breiman. A random forest can be trained and saved for later use, or a random forest may be loaded and predictions or class probabilities for points may be generated.
This documentation will be rewritten once #880 is merged.
input options
- copy_all_inputs (bool): If specified, all input parameters will be deep copied before the method is run. This is useful for debugging problems where the input parameters are being modified by the algorithm, but can slow down the code.
- input_model (mlpack.RandomForestModelType): Pre-trained random forest to use for classification.
- labels (numpy vector or array, int/long dtype): Labels for training dataset.
- minimum_leaf_size (int): Minimum number of points in each leaf node. Default value 20.
- num_trees (int): Number of trees in the random forest. Default value 10.
- print_training_accuracy (bool): If set, then the accuracy of the model on the training set will be predicted (verbose must also be specified).
- test (numpy matrix or arraylike, float dtype): Test dataset to produce predictions for.
- test_labels (numpy vector or array, int/long dtype): Test dataset labels, if accuracy calculation is desired.
- training (numpy matrix or arraylike, float dtype): Training dataset.
- verbose (bool): Display informational messages and the full list of parameters and timers at the end of execution.
output options
The return value from the binding is a dict containing the following elements:
- output_model (mlpack.RandomForestModelType): Model to save trained random forest to.
- predictions (numpy vector, int dtype): Predicted classes for each point in the test set.
- probabilities (numpy matrix, float dtype): Predicted class probabilities for each point in the test set.