Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "ml/incr/sgd-regression/docs/types/index.d"

Index

Interfaces

Functions

Functions

Export assignment incrSGDRegression

  • Online learning for regression using stochastic gradient descent (SGD).

    Method

    The sub-gradient of the loss function is estimated for each datum and the regression model is updated incrementally, with a decreasing learning rate and regularization of the feature weights based on L2 regularization.

    References

    • Shalev-Shwartz, S., Singer, Y., Srebro, N., & Cotter, A. (2011). Pegasos: Primal estimated sub-gradient solver for SVM. Mathematical Programming, 127(1), 3–30. doi:10.1007/s10107-010-0420-4
    throws

    must provide valid options

    Parameters

    • Optional options: Options

      options object

    Returns Model

    regression model

    Example

    var incrSGDRegression = require( `@stdlib/streams/ml/incr/sgd-regression` );
    
    var accumulator = incrSGDRegression({
        'intercept': true
        'lambda': 1e-5
    });
    
    // Update model as observations come in:
    var y = 3.5;
    var x = [ 2.3, 1.0, 5.0 ];
    accumulator( x, y );
    
    // Predict new observation:
    var yHat = accumulator.predict( x );
    
    // Retrieve coefficients:
    var coefs = accumulator.coefs;