mlpack_nbc(1) | User Commands | mlpack_nbc(1) |
mlpack_nbc - parametric naive bayes classifier
mlpack_nbc [-I bool] [-m unknown] [-l string] [-T string] [-t string] [-V bool] [-o string] [-M unknown] [--output_probs_file string] [-a string] [-p string] [-h -v]
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.
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
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.
12 December 2020 | mlpack-3.4.2 |