How to use the qminer.la 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 / exampleladoc.js View on Github external
it("should make test number 2", function () {

	 // import the modules
	 var la = require('qminer').la;
	 // create a random matrix
	 var A = new la.Matrix({ rows: 10, cols: 5, random: true });
	 // set the parameters for the calculation
	 var k = 2; // number of singular vectors 
	 var param = { iter: 1000, tol: 1e-4 };
	 // calculate the svd
	 la.svd(A, k, param, function (err, result) {
	    if (err) { console.log(err); }
	    // successful calculation
	    var U = result.U;
	    var V = result.V;
	    var s = result.s;
	 });
	
});
});
github qminer / qminer / test / nodejs / exampleladoc.js View on Github external
require('qminer').la.Vector.prototype.print = function () { };require('qminer').la.SparseVector.prototype.print = function () { };require('qminer').la.SparseMatrix.prototype.print = function () { };require('qminer').la.Matrix.prototype.print = function () { };describe('example tests for the ladoc.js file', function () {
describe("Linear algebra module, number 1", function () {
it("should make test number 1", function () {

 // import module, create a random matrix and a vector, multiply. find svd of the matrix

});
});
describe("Computes the truncated SVD decomposition, number 2", function () {
it("should make test number 2", function () {

	 // import the modules
	 var la = require('qminer').la;
	 // create a random matrix
	 var A = new la.Matrix({ rows: 10, cols: 5, random: true });
	 // set the parameters for the calculation
	 var k = 2; // number of singular vectors 
github qminer / qminer / test / nodejs / exampleladoc_structures.js View on Github external
it("should make test number 49", function () {

	 // import la module
	 var la = require('qminer').la;
	 // create a new sparse matrix
	 var mat = new la.SparseMatrix([[[0, 1], [1, 3]], [[0, 2], [1, 4]]]);
	 // get the frobenious norm of sparse matrix
	 var norm = mat.frob(); // returns sqrt(30)
	
});
});
github qminer / qminer / test / nodejs / examplestatdoc.js View on Github external
require('qminer').la.Vector.prototype.print = function () { };require('qminer').la.SparseVector.prototype.print = function () { };require('qminer').la.SparseMatrix.prototype.print = function () { };require('qminer').la.Matrix.prototype.print = function () { };describe('example tests for the statdoc.js file', function () {
describe("Statistics module, number 1", function () {
it("should make test number 1", function () {

 // TODO

});
});

});
github qminer / qminer / test / nodejs / exampleladoc.js View on Github external
it("should make test number 103", function () {

	 // import fs module
	 var fs = require('qminer').fs;
	 var la = require('qminer').la;
	 // create a new vector
	 var vec = new la.BoolVector([true, true, false]);
	 // open write stream
	 var fout = fs.openWrite('vec.dat');
	 // save vector and close write stream
	 vec.save(fout).close();
	
});
});
github qminer / qminer / test / nodejs / exampleanalyticsdoc.js View on Github external
it("should make test number 17", function () {

  // import modules
  la = require('qminer').la;
  analytics = require('qminer').analytics;
  // create a new model with gamma = 1.0
  var regmod = new analytics.RidgeReg({ gamma: 1.0 });
  // generate a random feature matrix
  var A = la.randn(10,100);
  // generate a random model
  var w = la.randn(10);
  // generate noise
  var n = la.randn(100).multiply(0.01);
  // generate responses (model'*data + noise)
  var b = A.transpose().multiply(w).plus(n);
  // fit model
  regmod.fit(A, b);
  // compare
  // true model
  w.print();
github qminer / qminer / test / nodejs / reclinearregression.js View on Github external
/**
 * Copyright (c) 2015, Jozef Stefan Institute, Quintelligence d.o.o. and contributors
 * All rights reserved.
 * 
 * This source code is licensed under the FreeBSD license found in the
 * LICENSE file in the root directory of this source tree.
 */


var assert = require('../../src/nodejs/scripts/assert.js');
var analytics = require('qminer').analytics;
var la = require('qminer').la;

describe('RecursiveLinearRegression Tests', function () {

    describe('Constructor Tests', function () {
        it('should not throw an exception', function () {
            assert.doesNotThrow(function () {
                var linreg = new analytics.RecLinReg({ dim: 10, regFact: 1.0, forgetFact: 1.0 });
            });
        })
        it('should create an object with mostly default params', function () {
            var linreg = new analytics.RecLinReg({ dim: 10 });
            var param = linreg.getParams();
            assert.equal(param.dim, 10);
            assert.equal(param.regFact, 1.0);
            assert.equal(param.forgetFact, 1.0);
        })
github qminer / qminer / nodedoc / ladoc_structures.js View on Github external
 exports.Matrix.prototype.getRow = function (rowIdx) { return Object.create(require('qminer').la.Vector.prototype); }
/**
github qminer / qminer / nodedoc / statdoc.js View on Github external
 exports.mean = function (input) { return input instanceof Object.create(require('qminer').la.Vector) ? 0.0 : Object.create(require('qminer').la.Vector.prototype); }
/**
github qminer / qminer / nodedoc / ladoc.js View on Github external
 exports.SparseVector = function(arg, dim) { return Object.create(require('qminer').la.SparseVector.prototype); }	
/**