WOLFRAM

  • Method for Predict.
  • Predict values using a linear combination of features.

Details & Suboptions

  • The linear regression predicts the numerical output y using a linear combination of numerical features . The conditional probability is modeled according to , with .
  • The estimation of the parameter vector θ is done by minimizing the loss function 1/2sum_(i=1)^m(y_i-f(theta,x_i))^2+lambda_1sum_(i=1)^nTemplateBox[{{theta, _, i}}, Abs]+(lambda_2)/2 sum_(i=1)^ntheta_i^2, where m is the number of examples and n is the number of numerical features.
  • The following suboptions can be given:
  • "L1Regularization" 0value of in the loss function
    "L2Regularization" Automaticvalue of iin the loss function
    "OptimizationMethod" Automaticwhat optimization method to use
  • Possible settings for the "OptimizationMethod" option include:
  • "NormalEquation"linear algebra method
    "StochasticGradientDescent"stochastic gradient method
    "OrthantWiseQuasiNewton"orthant-wise quasi-Newton method
  • For this method, Information[PredictorFunction[],"Function"] gives a simple expression to compute the predicted value from the features.

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Train a predictor on labeled examples:

Out[1]=1

Look at the Information:

Out[2]=2

Predict a new example:

Out[3]=3

Generate two-dimensional data:

Out[1]=1

Train a predictor function on it:

Out[2]=2

Compare the data with the predicted values and look at the standard deviation:

Out[3]=3

Options  (5)Common values & functionality for each option

"L1Regularization"  (2)

Use the "L1Regularization" option to train a predictor:

Out[1]=1

Generate a training set and visualize it:

Out[1]=1

Train two predictors by using different values of the "L1Regularization" option:

Out[2]=2
Out[3]=3

Look at the predictor function to see how the larger L1 regularization has forced one parameter to be zero:

Out[4]=4
Out[5]=5

"L2Regularization"  (2)

Use the "L2Regularization" option to train a predictor:

Out[1]=1

Generate a training set and visualize it:

Out[1]=1

Train two predictors by using different values of the "L2Regularization" option:

Out[2]=2
Out[3]=3

Look at the predictor functions to see how the L2 regularization has reduced the norm of the parameter vector:

Out[4]=4
Out[5]=5

"OptimizationMethod"  (1)

Generate a large training set:

Train predictors with different optimization methods and compare their training times:

Out[4]=4
Out[5]=5