Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "ml/incr/binary-classification/docs/types/index.d"

Index

Functions

Export assignment incrBinaryClassification

  • Returns an accumulator function which incrementally performs binary classification using stochastic gradient descent (SGD).

    Method

    • The sub-gradient of the loss function is estimated for each datum and the classification model is updated incrementally, with a decreasing learning rate and regularization of model feature weights using L2 regularization.
    • Stochastic gradient descent is sensitive to the scaling of the features. One is advised to either scale each feature to [0,1] or [-1,1] or to transform each feature into z-scores with zero mean and unit variance. One should keep in mind that the same scaling has to be applied to training data in order to obtain accurate predictions.
    • In general, the more data provided to an accumulator, the more reliable the model predictions.

    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

    first argument must be a positive integer

    throws

    must provide valid options

    Parameters

    • N: number

      number of features

    • Optional options: Options

      options object

    Returns Accumulator

    accumulator function

    Example

    var Float64Array = require( `@stdlib/array/float64` );
    var array = require( `@stdlib/ndarray/array` );
    
    // Create an accumulator:
    var accumulator = incrBinaryClassification( 3, {
        'intercept': true,
        'lambda': 1.0e-5
    });
    
    // ...
    
    // Update the model:
    var x = array( new Float64Array( [ 2.3, 1.0, 5.0 ] ) );
    var coefs = accumulator( x, 1 );
    // returns <ndarray>
    
    // ...
    
    // Create a new observation vector:
    x = array( new Float64Array( [ 2.3, 5.3, 8.6 ] ) );
    
    // Predict the response value:
    var yhat = accumulator.predict( x );
    // returns <ndarray>