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

	 // import qm module
	 var qm = require('qminer');
	 // create a new base with one store
	 var base = new qm.Base({
	    mode: "createClean",
	    schema: [
	    {
	        name: "Superheroes",
	        fields: [
	            { name: "Name", type: "string" },
	            { name: "Superpowers", type: "string_v" },
	            { name: "YearsActive", type: "int" }
	        ]
	    }]
	 });
	 // create a new store called "Supervillains" in the base
	 base.createStore({
	    name: "Supervillians",
	    fields: [
	        { name: "Name", type: "string" },
github qminer / qminer / test / nodejs / streamaggr2.js View on Github external
it("slotted histogram", function () {
        var qm = require('qminer');

        // create a base with a simple store
        // the store records results of clustering
        var base = new qm.Base({
            mode: "createClean",
            schema: [
            {
                name: "Store",
                fields: [
                    { name: "ClusterId", type: "float" },
                    { name: "Time", type: "datetime" }
                ]
            }]
        });
        try {
            var store = base.store('Store');

            // create a new time series stream aggregator for the 'Store' store that takes the recorded cluster id
            // and the timestamp from the 'Time' field. The size of the window is 4 weeks.
            var timeser = {
github qminer / qminer / test / nodejs / streamaggr2.js View on Github external
var tmp3 = diff.saveJson();
			//console.log(JSON.stringify(tmp3));
			assert.equal(tmp3.diff[0], 2);
			assert.equal(tmp3.diff[1], 1);
			assert.equal(tmp3.diff[2], 1);
			assert.equal(tmp3.diff[3], 0);
			assert.equal(tmp3.diff[4], 0);
			
			// show distribution for expected values
			//console.log(diff);
			
		} finally {
			base.close();
		}
		
		var base2 = new qm.Base({
			mode: "open"
		});		
		try {
			var store2 = base2.store('Rpm');
        
			// get diff aggregator that subtracts Histogram1 with 2h window from Histogram2 with 6h window
			var diff = store2.getStreamAggr("DiffAggr");
						
			// difference
			var tmp3 = diff.saveJson();
			console.log(JSON.stringify(tmp3));
			assert.equal(tmp3.diff[0], 2);
			assert.equal(tmp3.diff[1], 1);
			assert.equal(tmp3.diff[2], 1);
			assert.equal(tmp3.diff[3], 0);
			assert.equal(tmp3.diff[4], 0);
github qminer / qminer / test / nodejs / exampledatasetsdoc.js View on Github external
it("should make test number 1", function () {

     var qm = require('qminer');
     var datasets = qm.datasets;
    
     // Create clean base
     var base = new qm.Base({ mode: 'createClean' });
    
     // Load Iris dataset in async way
     datasets.loadIris(base, function (err, store) {
         if (err) throw err;
         // Sucessfully loaded database
         base.close();
     });
    
    
});
});
github qminer / qminer / test / nodejs / primaryField.js View on Github external
// only report failours
        assert.silent = !process.isArg("-verbose");
        // name of the debug process
        assert.consoleTitle = "PrimaryField";

        // data for randomly generating records
        var strVals = ["Ljubljana", "Maribor", "Koper", "Kranj", "Celje", "Novo Mesto"];
        var intVals = [123, -234, 345, -456, 567, -678, 789, -890, 901];
        var uint64Vals = [12, 23, 34, 45, 56, 67, 78, 89, 90, 98, 87, 76, 65, 54, 43, 32, 21];
        var fltVals = [1.23, 2.34, 3.45, 4.56, 5.67, 6.78, 7.89];
        var tmVals = ["2013-01-02T12:23:34", "2013-01-04T12:23:34", "2013-01-09T12:23:34",
                      "2013-03-02T12:23:34", "2013-03-03T12:23:34", "2013-03-09T12:23:34",
                      "2013-05-02T12:23:34", "2013-05-06T12:23:34", "2013-05-07T12:23:34"];

        var base = new qm.Base({ mode: 'createClean' });

        // create stores
        base.createStore([
            {
                name: "primary_string",
                fields: [
                    { name: "Str", type: "string", primary: true },
                    { name: "Int", type: "int" },
                    { name: "UInt64", type: "uint64" },
                    { name: "Flt", type: "float" },
                    { name: "Tm", type: "datetime" }
                ]
            },
            {
                name: "primary_int",
                fields: [
github qminer / qminer / test / nodejs / circular_record_buffer.js View on Github external
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"});
		// prepare test set
        base.createStore({
            "name": "CircularRecordBufferTest",
            "fields": [
              { "name": "Value", "type": "float" },
            ],
            "joins": [],
            "keys": []
        });
        store = base.store("CircularRecordBufferTest");
        for (var val = 0; val < 100; val++) {
            store.push({ Value: val });
        }
    });
    afterEach(function () {
github qminer / qminer / src / third_party / geospatial / example / staypoint.js View on Github external
var qm = require('qminer');

var base = new qm.Base({
    mode: "createClean",
    schema: [
	    {
	        "name": "GPS",
	        "fields": [
              { "name": "Time", "type": "datetime" },
              { "name": "Location", type: "float_pair" },
              { "name": "Accuracy", type: "byte", "null": true }
	        ],
	        "joins": [],
	        "keys": []
	    }
    ]
});

// used only for schema
github qminer / qminer / test / nodejs / search.js View on Github external
it('returns all elements >= 5', function () {
            base.close();
            base = new qm.Base({ mode: 'open'});
            var result = base.search({ $from: 'BTreeSearchTest', Value: { $gt: 5}});
            assert.equal(result.length, 50);
            result.each(function (rec) { assert.equal(rec.Value >= 5, true); });
        })
        it('returns all elements <= 6', function () {
github qminer / qminer / test / nodejs / base.js View on Github external
it('Should throw an exception', function (done) {
            try {
                base.close();
                var base1 = new qm.Base({
                    mode: 'open',
                    dbPath: DB_PATH
                });


                var store = base1.createStore({
                    "name": "People1",
                    "fields": [
                        { "name": ILLEGAL_NAME, "type": "string", "primary": true },
                        { "name": "Gender", "type": "string", "shortstring": true }
                    ]
                });
                base1.close();
                done(new Error('Was able to create a store with an illegal name!'));
            } catch (e) {
                base1.close();
github qminer / qminer / test / nodejs / twobases.js View on Github external
beforeEach(function () {
        base1 = new qm.Base({
            mode: 'createClean',
            schema: [
              {
                  name: 'People',
                  fields: [{ name: 'name', type: 'string', primary: true }],
              }
            ],
            dbPath: './db1'
        });

        base2 = new qm.Base({
            mode: 'createClean',
            schema: [
              {
                  name: 'Movies',
                  fields: [{ name: 'title', type: 'string', primary: true }],