number of features
options object
accumulator function
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>
Returns an accumulator function which incrementally performs binary classification using stochastic gradient descent (SGD).
Method
[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.References
first argument must be a positive integer
must provide valid options