'use strict';

var OnlineSVM = require( './../lib' );
var x1;
var x2;
var y;
var i;

// Create model:
var model = new OnlineSVM({
	'lambda': 1e-4,
	'loss': 'leastSquares',
	'intercept': true
});

// Data comes in...
for ( i = 0; i < 100000; i++ ) {
	x1 = Math.random();
	x2 = Math.random();
	y = 3.0 * x1 + -3.0 * x2 + 2.0;
	model.update( y, [ x1, x2 ] );
}

// Extract model coefficients:
console.log( model.coefs );

// Predict new observations:
console.log( 'y_hat = %d; x1 = %d; x2 = %d', model.predict( [0.9,0.1] ), 0.9, 0.1 );
console.log( 'y_hat = %d; x1 = %d; x2 = %d', model.predict( [0.1,0.9] ), 0.1, 0.9 );
console.log( 'y_hat = %d; x1 = %d; x2 = %d', model.predict( [0.9,0.9] ), 0.9, 0.9 );

'use strict';

var OnlineSGDRegression = require( './../lib' );
var x1;
var x2;
var y;
var i;

// Create model:
var model = new OnlineSGDRegression({
	'lambda': 1e-4,
	'loss': 'leastSquares',
	'intercept': true
});

// Data comes in...
for ( i = 0; i < 100000; i++ ) {
	x1 = Math.random();
	x2 = Math.random();
	y = 3.0 * x1 + -3.0 * x2 + 2.0;
	model.update( y, [ x1, x2 ] );
}

// Extract model coefficients:
console.log( model.coefs );

// Predict new observations:
console.log( 'y_hat = %d; x1 = %d; x2 = %d', model.predict( [0.9,0.1] ), 0.9, 0.1 );
console.log( 'y_hat = %d; x1 = %d; x2 = %d', model.predict( [0.1,0.9] ), 0.1, 0.9 );
console.log( 'y_hat = %d; x1 = %d; x2 = %d', model.predict( [0.9,0.9] ), 0.9, 0.9 );

Update module name in example code
Update module name in example code
