How to use the qminer.analytics.OneVsAll 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 83", function () {

         // import analytics module
         var analytics = require('qminer').analytics;
         // create a new OneVsAll object with the model analytics.SVC
         var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: { c: 10, maxTime: 12000 }, cats: 2 });
         // set the parameters
         var params = onevsall.setParams({ model: analytics.SVR, modelParam: { c: 12, maxTime: 10000}, cats: 3, verbose: true });
        
});
});
github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
it("should make test number 84", function () {

          // import modules
          var analytics = require('qminer').analytics;
          var la = require('qminer').la;
          // create a new OneVsAll object with the model analytics.SVC
          var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: { c: 10, maxTime: 12000 }, cats: 2 });
          // create the data (matrix and vector) used to fit the model
          var matrix = new la.Matrix([[1, 2, 1, 1], [2, 1, -3, -4]]);
          var vector = new la.Vector([0, 0, 1, 1]);
          // fit the model
          onevsall.fit(matrix, vector);
          // create the vector for the decisionFunction
          var test = new la.Vector([1, 2]);
          // give the vector to the decision function
          var prediction = onevsall.predict(test); // returns the vector of scores
         
});
});
github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
it("should make test number 86", function () {

          // import modules
          var analytics = require('qminer').analytics;
          var la = require('qminer').la;
          // create a new OneVsAll object with the model analytics.SVC
          var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: { c: 10, maxTime: 12000 }, cats: 2 });
          // create the data (matrix and vector) used to fit the model
          var matrix = new la.Matrix([[1, 2, 1, 1], [2, 1, -3, -4]]);
          var vector = new la.Vector([0, 0, 1, 1]);
          // fit the model
          onevsall.fit(matrix, vector);
         
});
});
github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
it("should make test number 82", function () {

         // import analytics module
         var analytics = require('qminer').analytics;
         // create a new OneVsAll object with the model analytics.SVC
         var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: { c: 10, maxTime: 12000 }, cats: 2 });
         // get the parameters
         // returns the JSon object
         // { model: analytics.SVC, modelParam: { c: 10, maxTime: 12000 }, cats: 2, models: [] }
         var params = onevsall.getParams();
        
});
});
github qminer / qminer / test / nodejs / onevsall.js View on Github external
it('should not throw an exception, dense vector', function () {
            this.timeout(10000);
            var json = { c: 10, maxTime: 12000 };
            var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: json, cats: 2 });
            var matrix = new la.Matrix([[1, 2, 1, 1, -3, -4], [2, 1, -3, -4, 2, 2]]);
            var vector = new la.Vector([0, 0, 1, 1, 1, 1]);
            onevsall.fit(matrix, vector);

            var test = new la.Vector([1, 2]);
            assert.doesNotThrow(function () {
                var prediction = onevsall.predict(test);
            });
        })
        it('should return the index of the cluster, where it the most fit, dense vector', function () {
github qminer / qminer / test / nodejs / onevsall.js View on Github external
it('should throw an exception if no parameters are given', function () {
            var json = { c: 10, maxTime: 12000 };
            var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: json, cats: 10 });
            assert.throws(function () {
                onevsall.setParams();
            });
        })
    });
github qminer / qminer / test / nodejs / onevsall.js View on Github external
it('should set the parameters and override the old ones', function () {
            var json = { c: 10, maxTime: 12000 };
            var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: json, cats: 10 });
            var params = onevsall.getParams();
            assert.equal(params.cats, 10);
            assert.equal(params.modelParam.c, 10);
            assert.equal(params.modelParam.maxTime, 12000);
            assert.equal(params.models.length, 0);
            assert.equal((new params.model(params.modelParam)).getParams().c, 10);

            onevsall.setParams({ model: analytics.SVR, cats: 5 });
            var params = onevsall.getParams();
            assert.equal(params.cats, 5);
            assert.equal(params.modelParam.c, 10);
            assert.equal(params.modelParam.maxTime, 12000);
            assert.equal(params.models.length, 0);
            assert.equal((new params.model(params.modelParam)).getParams().c, 10);
        })
        it('should throw an exception if no parameters are given', function () {
github qminer / qminer / test / nodejs / onevsall.js View on Github external
it('should throw an exception if only the matrix is given', function () {
            this.timeout(10000);
            var json = { c: 10, maxTime: 12000 };
            var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: json, cats: 2 });
            var matrix = new la.Matrix([[1, 2, 1, 1, -3, -4], [2, 1, -3, -4, 2, 2]]);

            assert.throws(function () {
                onevsall.fit(matrix);
            });
        })
    });
github qminer / qminer / test / nodejs / onevsall.js View on Github external
it('should throw an exception if the number of rows are greater than the models', function () {
            this.timeout(10000);
            var json = { c: 10, maxTime: 12000 };
            var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: json, cats: 2 });
            var matrix = new la.Matrix([[1, 2, 1, 1], [2, 1, -3, -4]]);
            var vector = new la.Vector([0, 0, 1, 1]);
            onevsall.fit(matrix, vector);

            var test = new la.Matrix([[1, 1], [2, -3], [2, 3]]);
            assert.throws(function () {
                var decision = onevsall.decisionFunction(test);
            });
        })
        it('should throw an exception if the number of rows are lesser than the models', function () {
github qminer / qminer / test / nodejs / onevsall.js View on Github external
it('should set the models, dense matrix', function () {
            this.timeout(10000);
            var json = { c: 10, maxTime: 12000 };
            var onevsall = new analytics.OneVsAll({ model: analytics.SVC, modelParam: json, cats: 2 });

            var matrix = new la.Matrix([[1, 2, 1, 1, -3, -4], [2, 1, -3, -4, 2, 2]]);
            var vector = new la.Vector([0, 0, 1, 1, 1, 1]);
            onevsall.fit(matrix, vector);

            var param = onevsall.getParams();
            assert.equal(param.models.length, 2);
        })
        it('should set the models, sparse matrix', function () {