---
name: "mlpack_decision_tree"
section: "1"
platform: "linux"
package: "mlpack-bin"
version: "4.6.0-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mlpack_decision_tree"
---

# mlpack\_decision\_tree(1)

decision tree

## NAME

**mlpack\_decision\_tree** - decision tree

## SYNOPSIS

```
 mlpack_decision_tree [-m unknown] [-l unknown] [-D int] [-g double] [-n int] [-a bool] [-T string] [-L unknown] [-t string] [-V bool] [-w unknown] [-M unknown] [-p unknown] [-P unknown] [-h -v]
```

## DESCRIPTION

Train and evaluate using a decision tree. Given a dataset containing numeric or categorical features, and associated labels for each point in the dataset, this program can train a decision tree on that data.

The training set and 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\]\`. Optionally, if '**--labels\_file** (**-l**)' is not specified, the labels are assumed to be the last dimension of the training dataset.

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. The '**--input\_model\_file** (**-m**)' parameter may not be specified when the '**--training\_file** (**-t**)' parameter is specified. 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 '**--minimum\_gain\_split** (**-g**)' parameter specifies the minimum gain that is needed for the node to split. The '**--maximum\_depth** (**-D**)' parameter specifies the maximum depth of the tree. If '**--print\_training\_accuracy** (**-a**)' is specified, the training accuracy will be printed.

Test data may be specified with the '**--test\_file** (**-T**)' parameter, and if performance numbers are desired for that test set, labels 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.

For example, to train a decision tree with a minimum leaf size of 20 on the dataset contained in 'data.csv' with labels 'labels.csv', saving the output model to 'tree.bin' and printing the training error, one could call

$ **mlpack\_decision\_tree** **--training\_file** data.arff **--labels\_file** labels.csv **--output\_model\_file** tree.bin **--minimum\_leaf\_size** 20 **--minimum\_gain\_split** 0.001 **--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\_decision\_tree** **--input\_model\_file** tree.bin **--test\_file** test\_set.arff **--test\_labels\_file** test\_labels.csv **--predictions\_file** predictions.csv

## OPTIONAL INPUT OPTIONS

- **--help (-h) \[*bool*\]**

  Default help info.

- **--info \[*string*\]**

  Print help on a specific option. Default value ''.

- **--input\_model\_file (-m) \[*unknown*\]**

  Pre-trained decision tree, to be used with test points.  **--labels\_file** (**-l**) \[*unknown*\] Training labels.

- **--maximum\_depth (-D) \[*int*\]**

  Maximum depth of the tree (0 means no limit).  Default value 0.

- **--minimum\_gain\_split (-g) \[*double*\]**

  Minimum gain for node splitting. Default value 1e-07.

- **--minimum\_leaf\_size (-n) \[*int*\]**

  Minimum number of points in a leaf. Default value 20.

- **--print\_training\_accuracy (-a) \[*bool*\]**

  Print the training accuracy.

- **--test\_file (-T) \[*string*\]**

  Testing dataset (may be categorical).

- **--test\_labels\_file (-L) \[*unknown*\]**

  Test point labels, if accuracy calculation is desired.

- **--training\_file (-t) \[*string*\]**

  Training dataset (may be categorical).

- **--verbose (-v) \[*bool*\]**

  Display informational messages and the full list of parameters and timers at the end of execution.

- **--version (-V) \[*bool*\]**

  Display the version of mlpack.

- **--weights\_file (-w) \[*unknown*\]**

  The weight of labels

## OPTIONAL OUTPUT OPTIONS

- **--output\_model\_file (-M) \[*unknown*\]**

  Output for trained decision tree.

- **--predictions\_file (-p) \[*unknown*\]**

  Class predictions for each test point.

- **--probabilities\_file (-P) \[*unknown*\]**

  Class probabilities for each test point.

## 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.
