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 string] [-T string] [-t string] [-V bool] [-o string] [-M unknown] [-p string] [-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 ’--output_file (-o)' output parameter. If saving the trained model is desired, this may be done with the '--output_model_file (-M)' output parameter.

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:

$ 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:

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

OPTIONAL INPUT OPTIONS

--help (-h) [bool]
Default help info.
--incremental_variance (-I) [bool]
The variance of each class will be calculated incrementally.
--info [string]
Get help on a specific module or option. Default value ''.
--input_model_file (-m) [unknown]
Input Naive Bayes model. Default value ''.
--labels_file (-l) [string]
A file containing labels for the training set. Default value ''.
--test_file (-T) [string]
A matrix containing the test set. Default value ''.
--training_file (-t) [string]
A matrix containing the training set. Default value ''.
--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.

OPTIONAL OUTPUT OPTIONS

--output_file (-o) [string]
The matrix in which the predicted labels for the test set will be written. Default value ''.
--output_model_file (-M) [unknown]
File to save trained Naive Bayes model to. Default value ''.
--output_probs_file (-p) [string]
The matrix in which the predicted probability of labels for the test set will be written. Default value ''.

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.
18 November 2018 mlpack-3.0.4