Module liba.regress_linear

linear regression

Functions

die (ctx) destructor for linear regression
new (coef, bias) constructor for linear regression
init (ctx, coef, bias) initialize for linear regression
eval (ctx, val) calculate predicted value for linear regression
err (ctx, x, y) calculate residuals for linear regression
gd (ctx, input, error, alpha) gradient descent for linear regression
sgd (ctx, x, y, alpha) stochastic gradient descent for linear regression
bgd (ctx, x, y, alpha) batch gradient descent for linear regression
mgd (ctx, x, y, delta, lrmax, lrmin[, lrtim[, epoch[, batch]]]) mini-batch gradient descent for linear regression
zero (ctx) zeroing for linear regression


Functions

die (ctx)
destructor for linear regression

Parameters:

  • ctx a.regress_linear linear regression userdata
new (coef, bias)
constructor for linear regression

Parameters:

  • coef table regression coefficient
  • bias number intercept

Returns:

    a.regress_linear linear regression userdata
init (ctx, coef, bias)
initialize for linear regression

Parameters:

  • ctx a.regress_linear linear regression userdata
  • coef number regression coefficient
  • bias number intercept

Returns:

    a.regress_linear linear regression userdata
eval (ctx, val)
calculate predicted value for linear regression

Parameters:

  • ctx a.regress_linear linear regression userdata
  • val number independent variable

Returns:

    number predicted value
err (ctx, x, y)
calculate residuals for linear regression

Parameters:

  • ctx a.regress_linear linear regression userdata
  • x table predictor data, specified as a numeric matrix
  • y table response data, specified as a numeric vector

Returns:

    table residuals, specified as a numeric vector
gd (ctx, input, error, alpha)
gradient descent for linear regression

Parameters:

  • ctx a.regress_linear linear regression userdata
  • input table predictor data, specified as a numeric vector
  • error number residual, specified as a numeric scalar
  • alpha number learning rate for gradient descent

Returns:

    a.regress_linear linear regression userdata
sgd (ctx, x, y, alpha)
stochastic gradient descent for linear regression

Parameters:

  • ctx a.regress_linear linear regression userdata
  • x table predictor data, specified as a numeric matrix
  • y table response data, specified as a numeric vector
  • alpha number learning rate for gradient descent

Returns:

    a.regress_linear linear regression userdata
bgd (ctx, x, y, alpha)
batch gradient descent for linear regression

Parameters:

  • ctx a.regress_linear linear regression userdata
  • x table predictor data, specified as a numeric matrix
  • y table response data, specified as a numeric vector
  • alpha number learning rate for gradient descent

Returns:

    a.regress_linear linear regression userdata
mgd (ctx, x, y, delta, lrmax, lrmin[, lrtim[, epoch[, batch]]])
mini-batch gradient descent for linear regression

Parameters:

  • ctx a.regress_linear linear regression userdata
  • x table predictor data, specified as a numeric matrix
  • y table response data, specified as a numeric vector
  • delta number threshold for gradient descent value
  • lrmax number maximum learning rate of iterations
  • lrmin number minimum learning rate of iterations
  • lrtim integer total number of learning rate steps (optional)
  • epoch integer maximum number of epochs (optional)
  • batch integer batch size of data (optional)

Returns:

    number change in loss function
zero (ctx)
zeroing for linear regression

Parameters:

  • ctx a.regress_linear linear regression userdata

Returns:

    a.regress_linear linear regression userdata
generated by LDoc 1.5.0 Last updated 2025-01-23 16:51:58