mlpack_random_forest(1)

πŸ¦‹ NAME πŸ¦‹

mlpack_random_forest β€” random forests, bestie πŸ’–

(and yes, you are reading the mlpack_random_forest(1) manual page, the user commands one, hi hello welcome, pull up a chair 🫢)


✨ SYNOPSIS ✨

mlpack_random_forest [-m unknown] [-l unknown] [-D int] [-g double] [-n int] [-N int] [-a bool] [-s int] [-d int] [-T unknown] [-L unknown] [-t unknown] [-V bool] [-w bool] [-M unknown] [-p unknown] [-P unknown] [-h -v]

πŸ’– DESCRIPTION πŸ’–

okay so. This program is literally an implementation of the standard random forest classification algorithm, and it's by Leo Breiman, an absolute icon, no cap πŸ‘‘. A random forest can be trained and saved for later use, OR a random forest may be loaded and then it can generate predictions or class probabilities for points. Both things. It's giving versatility. πŸ’…

The training set and its associated labels are specified with the --training_file (-t) and --labels_file (-l) parameters, respectively. The labels should be in the range [0, num_classes - 1]. And optionally, if --labels_file (-l) is not specified, the labels are assumed to be the last dimension of the training dataset. Sneaky but iconic.

When a model is trained, the --output_model_file (-M) output parameter may be used to save the trained model πŸŽ€. A model may be loaded for predictions with the --input_model_file (-m) parameter.

🚨 bestie listen. The --input_model_file (-m) parameter may not be specified when the --training_file (-t) parameter is specified. Pick a lane. Not both.

The --minimum_leaf_size (-n) parameter specifies the minimum number of training points that must fall into each leaf for it to be split. The --num_trees (-N) controls the number of trees in the random forest 🌳🌳🌳. The --minimum_gain_split (-g) parameter controls the minimum required gain for a decision tree node to split β€” larger values will force higher-confidence splits. The --maximum_depth (-D) parameter specifies the maximum depth of the tree. The --subspace_dim (-d) parameter is used to control the number of random dimensions chosen for an individual node's split. And if --print_training_accuracy (-a) is specified, the calculated accuracy on the training set will be printed. ✨

Test data may be specified with the --test_file (-T) parameter, and if performance measures are desired for that test set, labels for the test points may be specified with the --test_labels_file (-L) parameter. Predictions for each test point may be saved via the --predictions_file (-p) output parameter. Class probabilities for each prediction may be saved with the --probabilities_file (-P) output parameter πŸ’œ.


🌸 the example era 🌸

For example, to train a random forest with a minimum leaf size of 20 using 10 trees on the dataset contained in data.csv with labels labels.csv, saving the output random forest to rf_model.bin and printing the training error, one could call:

$ mlpack_random_forest --training_file data.csv --labels_file labels.csv --minimum_leaf_size 20 --num_trees 10 --output_model_file rf_model.bin --print_training_accuracy

Then, to use that model to classify points in test_set.csv and print the test error given the labels test_labels.csv using that model, while saving the predictions for each point to predictions.csv, one could call:

$ mlpack_random_forest --input_model_file rf_model.bin --test_file test_set.csv --test_labels_file test_labels.csv --predictions_file predictions.csv

ate. πŸ“


πŸŽ€ OPTIONAL INPUT OPTIONS πŸŽ€

  • --help (-h) [bool] β€” Default help info. The classic. The moment. πŸ’…
  • --info [string] β€” Print help on a specific option. Default value ''.
  • --input_model_file (-m) [unknown] β€” Pre-trained random forest to use for classification. Your glowed-up, already-trained bestie 🧚
  • --labels_file (-l) [unknown] β€” Labels for training dataset.
  • --maximum_depth (-D) [int] β€” Maximum depth of the tree (0 means no limit). Default value 0.
  • --minimum_gain_split (-g) [double] β€” Minimum gain needed to make a split when building a tree. Default value 0.
  • --minimum_leaf_size (-n) [int] β€” Minimum number of points in each leaf node. Default value 1.
  • --num_trees (-N) [int] β€” Number of trees in the random forest. Default value 10.
  • --print_training_accuracy (-a) [bool] β€” If set, then the accuracy of the model on the training set will be predicted (verbose must also be specified πŸ‘€).
  • --seed (-s) [int] β€” Random seed. If 0, std::time(NULL) is used. Default value 0.
  • --subspace_dim (-d) [int] β€” Dimensionality of random subspace to use for each split. 0 will autoselect the square root of data dimensionality. Default value 0.
  • --test_file (-T) [unknown] β€” Test dataset to produce predictions for.
  • --test_labels_file (-L) [unknown] β€” Test dataset labels, if accuracy calculation is desired.
  • --training_file (-t) [unknown] β€” Training dataset.
  • --verbose (-v) [bool] β€” Display informational messages and the full list of parameters and timers at the end of execution. The receipts, fr fr πŸ“‹
  • --version (-V) [bool] β€” Display the version of mlpack.
  • --warm_start (-w) [bool] β€” If true and passed along with training and input_model then trains more trees on top of existing model. Growth mindset, literally 🌱

πŸ’œ OPTIONAL OUTPUT OPTIONS πŸ’œ

  • --output_model_file (-M) [unknown] β€” Model to save trained random forest to. Save your work bestie, please 😭
  • --predictions_file (-p) [unknown] β€” Predicted classes for each point in the test set.
  • --probabilities_file (-P) [unknown] β€” Predicted class probabilities for each point in the test set.

🌈 ADDITIONAL INFORMATION 🌈

For further information, including relevant papers, citations, and theory, consult the documentation found at http://www.mlpack.org or included with your distribution of mlpack. iykyk πŸ“šβœ¨


okay that's the whole page, you're welcome, go train a forest 🌳🫢. this was mlpack-4.8.0, dated 22 June 2026 β€” mwah, slay, bye bestie πŸ’…πŸ’–πŸŽ€

πŸ“¦ where this page comes from