mlpack_logistic_regression(1)
πΈ okay bestie, welcome to the mlpack_logistic_regression(1) page β that's the User Commands manual, and yes this is the whole thing, we're not skipping a single flag π
π NAME
mlpack_logistic_regression β l2-regularized logistic regression and prediction π
β¨ SYNOPSIS
mlpack_logistic_regression [-b int] [-d double] [-m unknown] [-l unknown] [-L double] [-n int] [-O string] [-a bool] [-s double] [-T unknown] [-e double] [-t unknown] [-V bool] [-M unknown] [-P unknown] [-p unknown] [-h -v]
π DESCRIPTION
okay so. this is an implementation of L2-regularized logistic regression that runs on either the L-BFGS optimizer or SGD (stochastic gradient descent, iykyk). it solves the regression problem
y = (1 / 1 + e^-(X * b)).
in this setting, y is literally the class labels and X is the data. that's it, that's the vibe π
this program lets you load a logistic regression model (via --input_model_file (-m)), or train one from training data (specified with --training_file (-t)), or β and hear me out β both of those things at once. on top of that you can do classification on a test dataset (specified with --test_file (-T)) and the classification results can be saved with the --predictions_file (-P) output parameter. the trained model itself gets saved with --output_model_file (-M). main character energy fr fr π
the training data, if you give it, may have class labels as its last dimension. or alternately, you can use the --labels_file (-l) parameter to specify a separate matrix of labels. your call bestie.
when a model is being trained there are, and I cannot stress this enough, so many options. L2 regularization (which is the anti-overfitting thing) can be specified with the --lambda (-L) option, and the optimizer used to train the model can be set with the --optimizer (-O) parameter. the available ones are sgd (stochastic gradient descent) and lbfgs (the L-BFGS optimizer). there are also various params for the optimizer itself; --max_iterations (-n) specifies the maximum number of allowed iterations, and --tolerance (-e) specifies the tolerance for convergence. for the SGD optimizer specifically, --step_size (-s) controls the step size taken at each iteration. the batch size for SGD is controlled with --batch_size (-b). and heads up β if the objective function for your data is oscillating between Inf and 0, your step size is probably too large π there are more parameters for the optimizers but ngl you'd have to use the C++ interface to access those.
for SGD, an iteration refers to a single point. so to take a single pass over the dataset with SGD, --max_iterations (-n) should be set to the number of points in the dataset. periodt π―
optionally, the model can be used to predict responses for another matrix of data points, if --test_file (-T) is specified. and good news: --test_file (-T) can be specified without the --training_file (-t) parameter, as long as you give an existing logistic regression model with the --input_model_file (-m) parameter. the output predictions from the model can be saved with the --predictions_file (-P) parameter. slay.
π¨ real talk: this implementation of logistic regression does not support the general multi-class case β only the two-class case. any labels must be either0or1. for more classes, go look at the softmax regression implementation instead.
as an example, to train a logistic regression model on the data data.csv with labels labels.csv with L2 regularization of 0.1, saving the model to lr_model.bin, the following command may be used:
$ mlpack_logistic_regression --training_file data.csv --labels_file labels.csv --lambda 0.1 --output_model_file lr_model.bin --print_training_accuracy
then, to use that model to predict classes for the dataset test.csv, storing the output predictions in predictions.csv, the following command may be used:
$ mlpack_logistic_regression --input_model_file lr_model.bin --test_file test.csv --predictions_file predictions.csv
π OPTIONAL INPUT OPTIONS
--batch_size (-b)[int]β batch size for SGD. default value64. π--decision_boundary (-d)[double]β the decision boundary for prediction; if the logistic function for a point comes out less than the boundary, the class is taken to be0; otherwise, the class is1. default value0.5. π--help (-h)[bool]β default help info. π--info[string]β print help on a specific option. default value''. hot tip: name the option and it'll spill the tea on just that one β--input_model_file (-m)[unknown]β existing model (parameters). load it up bestie π--labels_file (-l)[unknown]β a matrix containing labels (0or1) for the points in the training set (y). π·οΈ--lambda (-L)[double]β L2-regularization parameter for training. default value0. β¨--max_iterations (-n)[int]β maximum iterations for optimizer (0indicates no limit). default value10000. π₯--optimizer (-O)[string]β optimizer to use for training ('lbfgs'or'sgd'). default value'lbfgs'. π--print_training_accuracy (-a)[bool]β if set, then the accuracy of the model on the training set will be printed (verbose must also be specified). mind the fine print π«Ά--step_size (-s)[double]β step size for the SGD optimizer. default value0.01. πΈ--test_file (-T)[unknown]β matrix containing the test dataset. π§--tolerance (-e)[double]β convergence tolerance for the optimizer. default value1e-10. π--training_file (-t)[unknown]β a matrix containing the training set (the matrix of predictors,X). π--verbose (-v)[bool]β display informational messages and the full list of parameters and timers at the end of execution. iconic π©·--version (-V)[bool]β display the version ofmlpack. π
π OPTIONAL OUTPUT OPTIONS
--output_model_file (-M)[unknown]β output for the trained logistic regression model. save that baby πΎ--predictions_file (-P)[unknown]β if test data is specified, this matrix is where the predictions for the test set will be saved. π―--probabilities_file (-p)[unknown]β if test data is specified, this matrix is where the class probabilities for the test set will be saved. not the classes themselves, the probabilities, okay? π
π ADDITIONAL INFORMATION
for further information β including the relevant papers, citations, and theory, which is honestly kind of a whole vibe β go consult the documentation found at http://www.mlpack.org or the docs included with your distribution of mlpack. π¦
π and that's the whole page, bestie. no cap, you now know everything this manpage knows.
<nice>okay bye ily β this was mlpack_logistic_regression(1) from mlpack-4.8.0, dated 22 June 2026. go train something cute πβ¨π</nice>
π¦ where this page comes from
- ubuntu stonking: mlpack-bin 4.8.0-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms