How to use qminer - 10 common examples

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 / ftrSpace.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.
 */

console.log(__filename)
var assert = require('../../src/nodejs/scripts/assert.js'); //adds assert.run function
var qm = require('qminer');
var fs = qm.fs;

describe('Feature Space Tests, old', function() {
	var base = undefined;
	beforeEach(function() {
		qm.delLock();
		var backward = require('../../src/nodejs/scripts/backward.js');
		backward.addToProcess(process); // adds process.isArg function
		base = new qm.Base({ mode: "createClean" });
	});
	afterEach(function() {
		base.close();
	});

	it('should survive', function() {

		// only report failours
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 / exampleladoc.js View on Github external
it("should make test number 24", function () {

	 // import la module
	 var la = require('qminer').la;
	 // create a matrix
	 var mat = new la.Matrix([[1, -3, 2], [9, 2, -4],  [-2, 3, 3]]);
	 // create a vector
	 var vec = new la.Vector([-3, 2, 2]);
	 // set the first column of the matrix with the vector
	 // the changed matrix is now
	 // -3   -3    2
	 //  2    2   -4
	 //  2    3    3
	 mat.setCol(0, vec);
	
});
});
github qminer / qminer / test / nodejs / exampleladoc_structures.js View on Github external
it("should make test number 24", function () {

	 // import la module
	 var la = require('qminer').la;
	 // create a matrix
	 var mat = new la.Matrix([[1, -3, 2], [9, 2, -4],  [-2, 3, 3]]);
	 // create a vector
	 var vec = new la.Vector([-3, 2, 2]);
	 // set the first column of the matrix with the vector
	 // the changed matrix is now
	 // -3   -3    2
	 //  2    2   -4
	 //  2    3    3
	 mat.setCol(0, vec);
	
});
});
github qminer / qminer / test / nodejs / exampleladoc_structures.js View on Github external
it("should make test number 10", function () {

	 // import la module
	 var la = require('qminer').la;
	 // create two matrices
	 var mat = new la.Matrix([[1, 2], [-1, 5]]);
	 var mat2 = new la.Matrix([[1, -1], [3, 2]]);
	 // substract the matrices
	 // the return matrix is
	 //  0   3
	 // -4   3
	 var diff = mat.minus(mat2);
	
});
});