"LogisticRegression" (Machine Learning Method)
- Method for Classify .
- Models class probabilities with logistic functions of linear combinations of features.
Details & Suboptions
- "LogisticRegression" models the log probabilities of each class with a linear combination of numerical features , , where corresponds to the parameters for class k. The estimation of the parameter matrix is done by minimizing the loss function sum_(i=1)^m-log(P_(theta)(class=y_i|x_i))+lambda_1 sum_(i=1)^nTemplateBox[{{theta, _, i}}, Abs]+(lambda_2)/2 sum_(i=1)^ntheta_i^2.
- The following options can be given:
-
- Possible settings for "OptimizationMethod" include:
-
"LBFGS" limited memory Broyden–Fletcher–Goldfarb–Shanno algorithm"StochasticGradientDescent" stochastic gradient method"Newton" Newton method
Examples
open all close allBasic Examples (2)
Train a classifier function on labeled examples:
Obtain information about the classifier:
Classify a new example:
Generate some normally distributed data:
Visualize it:
Train a classifier on this dataset:
Plot the training set and the probability distribution of each class as a function of the features:
Options (6)
"L1Regularization" (2)
Train a classifier using the "L1Regularization" option:
Generate some data and visualize it:
Train several classifiers using different values for "L1Regularization" and compare the results:
"L2Regularization" (2)
Train a classifier using the "L2Regularization" option:
Generate some data and visualize it:
Train several classifiers using different values for "L2Regularization" and compare the results:
"OptimizationMethod" (2)
Train a classifier using a specific "OptimizationMethod":
Train a classifier using the "Newton" method:
Train a classifier using the "StochasticGradientDescent" method:
Compare the corresponding training times: