1mlpack_nbc(1) User Commands mlpack_nbc(1)
2
3
4
6 mlpack_nbc - parametric naive bayes classifier
7
9 mlpack_nbc [-I bool] [-m unknown] [-l string] [-T string] [-t string] [-V bool] [-o string] [-M unknown] [-p string] [-h -v]
10
12 This program trains the Naive Bayes classifier on the given labeled
13 training set, or loads a model from the given model file, and then may
14 use that trained model to classify the points in a given test set.
15
16 The training set is specified with the '--training_file (-t)' parame‐
17 ter. Labels may be either the last row of the training set, or alter‐
18 nately the ’--labels_file (-l)' parameter may be specified to pass a
19 separate matrix of labels.
20
21 If training is not desired, a pre-existing model may be loaded with the
22 ’--input_model_file (-m)' parameter.
23
24 The '--incremental_variance (-I)' parameter can be used to force the
25 training to use an incremental algorithm for calculating variance. This
26 is slower, but can help avoid loss of precision in some cases.
27
28 If classifying a test set is desired, the test set may be specified
29 with the ’--test_file (-T)' parameter, and the classifications may be
30 saved with the ’--output_file (-o)' output parameter. If saving the
31 trained model is desired, this may be done with the '--out‐
32 put_model_file (-M)' output parameter.
33
34 For example, to train a Naive Bayes classifier on the dataset
35 'data.csv' with labels 'labels.csv' and save the model to
36 'nbc_model.bin', the following command may be used:
37
38 $ nbc --training_file data.csv --labels_file labels.csv --out‐
39 put_model_file nbc_model.bin
40
41 Then, to use 'nbc_model.bin' to predict the classes of the dataset
42 ’test_set.csv' and save the predicted classes to 'predictions.csv', the
43 following command may be used:
44
45 $ nbc --input_model_file nbc_model.bin --test_file test_set.csv --out‐
46 put_file predictions.csv
47
49 --help (-h) [bool]
50 Default help info.
51
52 --incremental_variance (-I) [bool]
53 The variance of each class will be calculated incrementally.
54
55 --info [string]
56 Get help on a specific module or option. Default value ''.
57
58 --input_model_file (-m) [unknown]
59 Input Naive Bayes model. Default value ''.
60
61 --labels_file (-l) [string]
62 A file containing labels for the training set. Default value
63 ''.
64
65 --test_file (-T) [string]
66 A matrix containing the test set. Default value ''.
67
68 --training_file (-t) [string]
69 A matrix containing the training set. Default value ''.
70
71 --verbose (-v) [bool]
72 Display informational messages and the full list of parameters
73 and timers at the end of execution.
74
75 --version (-V) [bool]
76 Display the version of mlpack.
77
79 --output_file (-o) [string]
80 The matrix in which the predicted labels for the test set will
81 be written. Default value ''.
82
83 --output_model_file (-M) [unknown]
84 File to save trained Naive Bayes model to. Default value ''.
85
86 --output_probs_file (-p) [string]
87 The matrix in which the predicted probability of labels for the
88 test set will be written. Default value ''.
89
91 For further information, including relevant papers, citations, and the‐
92 ory, consult the documentation found at http://www.mlpack.org or
93 included with your distribution of mlpack.
94
95
96
97mlpack-3.0.4 21 February 2019 mlpack_nbc(1)