Scroll to navigation

mlpack_nbc(1) User Commands mlpack_nbc(1)

NAME

mlpack_nbc - parametric naive bayes classifier

SYNOPSIS


mlpack_nbc [-I bool] [-m unknown] [-l unknown] [-T unknown] [-t unknown] [-V bool] [-o unknown] [-M unknown] [--output_probs_file unknown] [-a unknown] [-p unknown] [-h -v]

DESCRIPTION

This program trains the Naive Bayes classifier on the given labeled training set, or loads a model from the given model file, and then may use that trained model to classify the points in a given test set.

The training set is specified with the '--training_file (-t)' parameter. Labels may be either the last row of the training set, or alternately the ’--labels_file (-l)' parameter may be specified to pass a separate matrix of labels.

If training is not desired, a pre-existing model may be loaded with the ’--input_model_file (-m)' parameter.

The '--incremental_variance (-I)' parameter can be used to force the training to use an incremental algorithm for calculating variance. This is slower, but can help avoid loss of precision in some cases.

If classifying a test set is desired, the test set may be specified with the ’--test_file (-T)' parameter, and the classifications may be saved with the ’--predictions_file (-a)'predictions parameter. If saving the trained model is desired, this may be done with the '--output_model_file (-M)' output parameter.

Note: the '--output_file (-o)' and '--output_probs_file' parameters are deprecated and will be removed in mlpack 4.0.0. Use '--predictions_file (-a)' and '--probabilities_file (-p)' instead.

For example, to train a Naive Bayes classifier on the dataset 'data.csv' with labels 'labels.csv' and save the model to 'nbc_model.bin', the following command may be used:

$ mlpack_nbc --training_file data.csv --labels_file labels.csv --output_model_file nbc_model.bin

Then, to use 'nbc_model.bin' to predict the classes of the dataset ’test_set.csv' and save the predicted classes to 'predictions.csv', the following command may be used:

$ mlpack_nbc --input_model_file nbc_model.bin --test_file test_set.csv --output_file predictions.csv

OPTIONAL INPUT OPTIONS

Default help info.
The variance of each class will be calculated incrementally.
Print help on a specific option. Default value ''.
Input Naive Bayes model. --labels_file (-l) [unknown] A file containing labels for the training set.
A matrix containing the test set.
A matrix containing the training set.
Display informational messages and the full list of parameters and timers at the end of execution.
Display the version of mlpack.

OPTIONAL OUTPUT OPTIONS

--output_file (-o) [unknown] The matrix in which the predicted labels for the test set will be written (deprecated).

File to save trained Naive Bayes model to.
The matrix in which the predicted probability of labels for the test set will be written (deprecated).
The matrix in which the predicted labels for the test set will be written.
The matrix in which the predicted probability of labels for the test set will be written.

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.

11 January 2024 mlpack-4.3.0