How to use the qminer.analytics.Sigmoid function in qminer

To help you get started, we’ve selected a few qminer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
it("should make test number 26", function () {

	 // import analytics module
	 var analytics = require('qminer').analytics;
	 // create the Sigmoid model
	 var s = new analytics.Sigmoid();
	 // set the parameters 
	 // doesn't change the model
	 s.setParams({});
	
});
});
github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
it("should make test number 28", function () {

	  // import modules
	  var analytics = require('qminer').analytics;
	  var la = require('qminer').la;
	  // create the Sigmoid model
	  var s = new analytics.Sigmoid();
	  // create the predicted values and the binary labels
	  var X = new la.Vector([-3, -2, -1, 1, 2, 3]);
	  var y = new la.Vector([-1, -1, -1, 1, 1, 1]);
	  // fit the model
	  // changes the internal A and B values of the model 
	  // (these values can be obtained with the getModel method)
	  s.fit(X, y);
     
});
});
github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
it("should make test number 31", function () {

	  // import modules
	  var analytics = require('qminer').analytics;
	  var la = require('qminer').la;
	  var fs = require('qminer').fs;
	  // create the Sigmoid model
	  var s = new analytics.Sigmoid();
	  // create the predicted values and the binary labels
	  var X = new la.Vector([-3, -2, -1, 1, 2, 3]);
	  var y = new la.Vector([-1, -1, -1, 1, 1, 1]);
	  // fit the model
	  s.fit(X, y);
	  // create an output stream object and save the model
	  var fout = fs.openWrite('sigmoid_example.bin');
	  s.save(fout);
	  fout.close();
	  // create a new Sigmoid model by loading the model
	  var fin = fs.openRead('sigmoid_example.bin');
	  var s2 = new analytics.Sigmoid(fin);
     
});
});
github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
it("should make test number 29", function () {

	  // import modules
	  var analytics = require('qminer').analytics;
	  var la = require('qminer').la;
	  // create the Sigmoid model
	  var s = new analytics.Sigmoid();
	  // create the predicted values and the binary labels
	  var X = new la.Vector([-3, -2, -1, 1, 2, 3]);
	  var y = new la.Vector([-1, -1, -1, 1, 1, 1]);
	  // fit the model
	  s.fit(X, y);
	  // predict the probability of the value 0 on this model
	  // returns 0.5
	  var prediction = s.decisionFunction(0.5);
     
});
});
github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
it("should make test number 30", function () {

	  // import modules
	  var analytics = require('qminer').analytics;
	  var la = require('qminer').la;
	  // create the Sigmoid model
	  var s = new analytics.Sigmoid();
	  // create the predicted values and the binary labels
	  var X = new la.Vector([-3, -2, -1, 1, 2, 3]);
	  var y = new la.Vector([-1, -1, -1, 1, 1, 1]);
	  // fit the model
	  s.fit(X, y);
	  // predict the probability of the value 0 on this model
	  // returns 0.5
	  var prediction = s.predict(0.5);
     
});
});
github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
var la = require('qminer').la;
	  var fs = require('qminer').fs;
	  // create the Sigmoid model
	  var s = new analytics.Sigmoid();
	  // create the predicted values and the binary labels
	  var X = new la.Vector([-3, -2, -1, 1, 2, 3]);
	  var y = new la.Vector([-1, -1, -1, 1, 1, 1]);
	  // fit the model
	  s.fit(X, y);
	  // create an output stream object and save the model
	  var fout = fs.openWrite('sigmoid_example.bin');
	  s.save(fout);
	  fout.close();
	  // create a new Sigmoid model by loading the model
	  var fin = fs.openRead('sigmoid_example.bin');
	  var s2 = new analytics.Sigmoid(fin);
     
});
});
github qminer / qminer / test / nodejs / sigmoid.js View on Github external
it('should return the prediction of the vector of values', function () {
            var s = new analytics.Sigmoid();
            var X = new la.Vector([-3, -2, -1, 1, 2, 3]);
            var y = new la.Vector([-1, -1, -1, 1, 1, 1]);
            s.fit(X, y);
            var test = new la.Vector([-3, 0, 3]);
            var prediction = s.decisionFunction(test);
            assert(prediction[0] < 0.10);
            assert.eqtol(prediction[1], 0.5);
            assert(prediction[2] > 0.90);
        })
    });
github qminer / qminer / test / nodejs / sigmoid.js View on Github external
it('should return an empty json object', function () {
            var s = new analytics.Sigmoid();
            var params = s.getParams();
            assert.deepEqual(params, {});
        })
    })
github qminer / qminer / test / nodejs / sigmoid.js View on Github external
it('should return the prediction of the vector of values', function () {
            var s = new analytics.Sigmoid();
            var X = new la.Vector([-3, -2, -1, 1, 2, 3]);
            var y = new la.Vector([-1, -1, -1, 1, 1, 1]);
            s.fit(X, y);
            var test = new la.Vector([-3, 0, 3]);
            var prediction = s.predict(test);
            assert(prediction[0] < 0.10);
            assert.eqtol(prediction[1], 0.5);
            assert(prediction[2] > 0.90);
        })
    });
github qminer / qminer / test / nodejs / sigmoid.js View on Github external
it('should fit the model with the values, symmetric', function () {
            var s = new analytics.Sigmoid();
            var X = new la.Vector([-3, -2, -1, 1, 2, 3]);
            var y = new la.Vector([-1, -1, -1, 1, 1, 1]);
            s.fit(X, y);
            var model = s.getModel();
            assert(model.A > 0);
            assert.equal(model.B, 0);
        })
        it('should fit the model with the values, not symmetric', function () {