How to use the qminer.fs 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 / 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 / store_intish_types.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;

//////////////////////////////////////////////////////////////////////////////////////
// Store creation

var store_name = "test_store";
function GetStoreTemplate(field_type) {
    var res = {
        "name": store_name,
        "fields": [
            { "name": "name", "type": "string", "primary": true },
            { "name": "val", "type": "XXXXXXX" }
        ],
        "keys": [
            { "field": "val", "type": "linear" }
        ]
    };
github qminer / qminer / test / nodejs / examplefsdoc.js View on Github external
it("should make test number 1", function () {

 // import module
 var fs = require('qminer').fs;
 // open file in write mode
 var fout = fs.openWrite('file.txt');
 // write sync and close
 fout.writeLine('example text');
 fout.close();
 // open file in read mode
 var fin = fs.openRead('file.txt');
 // read a line
 var str = fin.readLine();

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

	 // import the modules
	 var fs = require('qminer').fs;
	 var la = require('qminer').la;
	 // create new matrix
	 var mat = new la.Matrix([[1, 2], [3, 4]]);
	 // open write stream
	 var fout = fs.openWrite('mat.dat');
	 // save matrix and close write stream
	 mat.save(fout).close();
	
});
});
github qminer / qminer / test / nodejs / regression.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 qm = require('qminer');
var fs = qm.fs;
var assert = require('assert');
var analytics = qm.analytics;
var la = qm.la;

console.log("Regression", "Starting test based on a random sample");

var dims = 10; // dimensions
var examples = 500; // examples

var X = la.randn(dims, examples);
var w = la.randn(dims);
var y = X.multiplyT(w);

// gaussian noise
var noiseSigma = 0.1;
var Ng = la.randn(dims, examples).multiply(noiseSigma);
github qminer / qminer / examples / spamfilter / spam.js View on Github external
// import modules
var qm = require('qminer');
var analytics = qm.analytics;
var fs = qm.fs;
var la = qm.la;
// create a new base containing the store
var base = new qm.Base({
    mode: 'createClean',
    schema: [{
        name: 'Messages',
        fields: [
            { name: 'Text', type: 'string' },
            { name: 'Value', type: 'float', nullable: true }
        ]
    }]
});
// create two feature spaces, one for each field
var ftrText = new qm.FeatureSpace(base, {
    type: 'text', source: 'Messages', field: 'Text', normalize: true,
    weight: 'tfidf', tokenizer: { type: 'simple', stopwords: 'en' }
github qminer / qminer / examples / timeseries / timeseries.js View on Github external
// Import main modules
var qm = require('qminer');
var loader = require('qminer-data-loader');
var fs = qm.fs;
var analytics = qm.analytics;

var base = new qm.Base({
	mode: "createClean",
	schema: [
		{
			"name": "Raw",
			"fields": [
				{ "name": "Time", "type": "datetime" },
				{ "name": "Value", "type": "float" }
			],
			"joins": [ ],
			"keys": [ ]
		},
		{
			"name": "Resampled",
github qminer / qminer / test / nodejs / svm.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('assert');
var analytics = require('qminer').analytics;
var la = require('qminer').la;
var fs = require('qminer').fs;

var vec = new la.Vector({vals:4});
var mat = new la.Matrix({rows:2, cols:4});

var vec = new la.Vector({vals:4});
var mat = new la.Matrix({rows:2, cols:4});
var x = new la.Vector({vals:2});

var SVC = new analytics.SVC({verbose:false});
SVC.fit(mat,vec);
SVC.save(fs.openWrite('svc.bin')).close();

var y1 = SVC.predict(x);

var SVR = new analytics.SVR({verbose:false});
SVR.fit(mat,vec);
github qminer / qminer / src / nodejs / intellisense / ht_intellisense.js View on Github external
 exports.StrStrMap.prototype.save = function(fout) { return Object.create(require('qminer').fs.FOut.prototype); }
/**
github qminer / qminer / src / nodejs / intellisense / la_intellisense.js View on Github external
 exports.StrVector.prototype.saveascii = function (fout) {  return Object.create(require('qminer').fs.FOut.prototype); }
/**