moduleqm
Source: qminerdoc.
Qminer module.
Example
// import module
var qm = require('qminer');
Child classes
Properties
Method
Abstract types
- BaseConstructorParam
- BaseLoadCSVParam
- FeatureExtractorCategorical
- FeatureExtractorConstant
- FeatureExtractorDateWindow
- FeatureExtractorJoin
- FeatureExtractorJsfunc
- FeatureExtractorMultinomial
- FeatureExtractorNumeric
- FeatureExtractorPair
- FeatureExtractorRandom
- FeatureExtractors
- FeatureExtractorSparseVector
- FeatureExtractorText
- FeatureSource
- FeatureTokenizer
- SchemaDefinition
- SchemaFieldDefinition
- SchemaJoinDefinition
- SchemaKeyDefinition
- SchemaTimeWindowDefinition
- StreamAggregateEMA
- StreamAggregateEMASpVec
- StreamAggregateHistogram
- StreamAggregateMax
- StreamAggregateMerger
- StreamAggregateMin
- StreamAggregateMovingAverage
- StreamAggregateMovingCorrelation
- StreamAggregateMovingCovariance
- StreamAggregateMovingVariance
- StreamAggregateRecordBuffer
- StreamAggregateResampler
- StreamAggregateSimpleLinearRegression
- StreamAggregateSimpleLinearRegressionResult
- StreamAggregateSlottedHistogram
- StreamAggregateSparseVecSum
- StreamAggregateSum
- StreamAggregateThreshold
- StreamAggregateTimeSeriesTick
- StreamAggregateTimeSeriesWindow
- StreamAggregateTimeSeriesWindowVector
- StreamAggregateVecDiff
- StreamAggregators
Classes
Base
CircularRecordBuffer
FeatureSpace
Iterator
Record
RecordSet
Store
StreamAggr
Properties
staticflags
Property
| Name | Type | Optional | Description |
|---|---|---|---|
|
flags |
Object |
|
Returns an object with all compile flags |
inner read-onlyBaseModes
string
Base access modes.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
create |
|
|
sets up the db folder |
|
createClean |
|
|
cleans the db folder and calls create |
|
open |
|
|
opens with write permissions |
|
openReadOnly |
|
|
opens in read-only mode |
inner read-onlyFeatureMode
string
How are multi-record cases combined into a single vector. //TODO not implemented for join record cases (works only if the start store and the feature store are the same)
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
concatenate |
|
|
Multi-record cases are merged into one document. |
|
centroid |
|
|
Treat each case as a separate document. |
|
tokenized |
|
|
Use the tokenizer option |
inner read-onlyFeatureStream
string
Details on forgetting old IDFs when running on stream.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
field |
|
|
(optional) Field name which is providing timestamp, if missing system time is used. |
|
factor |
|
|
Forgetting factor, by which the old IDFs are multiplied after each iteration. |
|
interval |
|
|
The time between iterations when the factor is applied, standard JSon time format is used to specify the interval duration. |
inner read-onlyFeatureTokenizerStemmer
Object
The steemer used for extraction.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
boolean |
|
|
For using the porter stemmer. |
|
porter |
|
|
For using the porter stemmer. |
|
none |
|
|
For using no stemmer. |
inner read-onlyFeatureTokenizerStopwords
Object
THe stopwords used for extraction.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
none |
|
|
The pre-defined stopword list (none). |
|
en |
|
|
The pre-defined stopword list (english). |
|
si |
|
|
The pre-defined stopword list (slovene). |
|
es |
|
|
The pre-defined stopword list (spanish). |
|
de |
|
|
The pre-defined stopword list (german). |
|
array |
|
|
An array of stopwords. The array must be given as a parameter instead of 'array'! |
inner read-onlyFeatureTokenizerType
string
The type of the encoding text.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
simple |
|
|
The simple encoding. |
|
html |
|
|
The html encoding. |
|
unicode |
|
|
The unicode encoding. |
inner read-onlyFeatureWeight
string
Type of weighting used for scoring terms.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
none |
|
|
Sets 1 if term occurs, 0 otherwise. |
|
tf |
|
|
Sets the term frequency in the document. |
|
idf |
|
|
Sets the inverse document frequency in the document. |
|
tfidf |
|
|
Sets the product of the tf and idf frequency. |
inner read-onlyFieldTypes
string
Field types.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
int |
|
|
signed 32-bit integer |
|
int_v |
|
|
vector of signed 32-bit integers |
|
string |
|
|
string |
|
string_v |
|
|
vector of strings |
|
bool |
|
|
boolean |
|
float |
|
|
double precision floating point number |
|
float_pair |
|
|
a pair of floats, useful for storing geo coordinates |
|
float_v |
|
|
vector of floats |
|
datetime |
|
|
date and time format, stored in a form of milliseconds since 1600 |
|
num_sp_v |
|
|
sparse vector(same format as used by QMiner JavaScript linear algebra library) |
Method
staticverbosity([level])
Set verbosity of QMiner internals.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
level |
number |
Yes |
verbosity level: 0 = no output, 1 = log output, 2 = log and debug output. Defaults to |
Abstract types
innerBaseConstructorParam
Object
Base constructor parameter object
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
BaseConstructorParam.mode |
Yes |
Base access mode:
Defaults to |
|
|
BaseConstructorParam.indexCache |
number |
Yes |
The ammount of memory reserved for indexing (in MB). Defaults to |
|
BaseConstructorParam.storeCache |
number |
Yes |
The ammount of memory reserved for store cache (in MB). Defaults to |
|
BaseConstructorParam.schemaPath |
string |
Yes |
The path to schema definition file. Defaults to |
|
BaseConstructorParam.schema |
Array of module:qm~SchemaDefinition |
Yes |
Schema definition object array. Defaults to |
|
BaseConstructorParam.dbPath |
string |
Yes |
The path to db directory. Defaults to |
innerBaseLoadCSVParam
object
The parameter given to module:qm.Base#loadCSV.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
BaseLoadCSVParam.file |
string |
|
The name of the input file. |
|
BaseLoadCSVParam.store |
string |
|
Name of the store which will be created. |
|
BaseLoadCSVParam.base |
|
QMiner base object that creates the store. |
|
|
BaseLoadCSVParam.delimiter |
string |
Yes |
Optional delimiter. Defaults to |
|
BaseLoadCSVParam.quote |
string |
Yes |
Optional character to escape values that contain a delimiter. Defaults to |
innerFeatureExtractorCategorical
Object
The feature extractor of type 'categorical'.
Example
var qm = require('qminer');
// create a simple base, where each record contains the student name and it's study group
// here we know the student is part of only one study group
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: "Class",
fields: [
{ name: "Name", type: "string" },
{ name: "StudyGroup", type: "string" }
]
}]
});
// create a feature space containing the categorical extractor, where the it's values
// are taken from the field "StudyGroup": "A", "B", "C" and "D"
var ftr = new qm.FeatureSpace(base, { type: "categorical", source: "Class", field: "StudyGroup" });
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorCategorical.type |
string |
|
The type of the extractor. It must be equal 'categorical'. |
|
FeatureExtractorCategorical.values |
Array of Object |
Yes |
A fixed set of values, which form a fixed feature set. No dimensionality changes if new values are seen in the upgrades. |
|
FeatureExtractorCategorical.hashDimension |
number |
Yes |
A hashing code to set the fixed dimensionality. All values are hashed and divided modulo hasDimension to get the corresponding dimension. |
|
FeatureExtractorCategorical.field |
string |
|
The name of the field form which to take the values. |
|
FeatureExtractorCategorical.source |
|
The source of the extractor. |
innerFeatureExtractorConstant
Object
The feature extractor of type 'contant'.
Example
var qm = require('qminer');
// create a simple base, where each record contains only a persons name
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: "Person",
fields: [{ name: "Name", type: "string" }]
}]
});
// create a feature space containing the constant extractor, where the constant is equal 5
var ftr = new qm.FeatureSpace(base, { type: "constant", source: "Person", const: 5 });
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorConstant.type |
string |
|
The type of the extractor. It must be equal 'constant'. |
|
FeatureExtractorConstant.const |
number |
Yes |
A constant number. Defaults to |
|
FeatureExtractorConstant.source |
|
The source of the extractor. |
innerFeatureExtractorDateWindow
Object
The feature extractor of type 'dateWindow'.
Example
// import qm module
var qm = require('qminer');
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorDateWindow.type |
string |
|
The type of the extractor. It must be equal 'dateWindow'. |
|
FeatureExtractorDateWindow.unit |
string |
Yes |
How granular is the time window. The options are: 'day', 'week', 'month', 'year', '12hours', '6hours', '4hours', '2hours', 'hour', '30minutes', '15minutes', '10minutes', 'minute', 'second'. Defaults to |
|
FeatureExtractorDateWindow.window |
number |
Yes |
The size of the window. Defaults to |
|
FeatureExtractorDateWindow.normalize |
boolean |
Yes |
Normalize the resulting vector of the extractor to have L2 norm 1.0. //TODO Defaults to |
|
FeatureExtractorDateWindow.start |
number |
|
//TODO |
|
FeatureExtractorDateWindow.end |
number |
|
//TODO |
|
FeatureExtractorDateWindow.source |
|
The source of the extractor. |
innerFeatureExtractorJoin
Object
The feature extractor of type 'join'.
Example
// import qm module
var qm = require('qminer');
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorJoin.type |
string |
|
The type of the extractor. It must be equal 'join'. |
|
FeatureExtractorJoin.bucketSize |
number |
Yes |
The size of the bucket in which we group consecutive records. Defaults to |
|
FeatureExtractorJoin.source |
|
The source of the extractor. |
innerFeatureExtractorJsfunc
Object
The feature extractor of type 'jsfunc'.
Example
var qm = require('qminer');
// create a simple base, where each record contains the name of the student and his study groups
// each student is part of multiple study groups
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: "Class",
fields: [
{ name: "Name", type: "string" },
{ name: "StudyGroups", type: "string_v" }
]
}]
});
// create a feature space containing the jsfunc extractor, where the function counts the number
// of study groups each student is part of. The functions name is "NumberOFGroups", it's dimension
// is 1 (returns only one value, not an array)
var ftr = new qm.FeatureSpace(base, {
type: "jsfunc", source: "Class", name: "NumberOfGroups", dim: 1,
fun: function (rec) { return rec.StudyGroups.length; }
});
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorJsfunc.type |
string |
|
The type of the extractor. It must be equal 'jsfunc'. |
|
FeatureExtractorJsfunc.name |
string |
|
The feature's name. |
|
FeatureExtractorJsfunc.fun |
function() |
|
The javascript function callback. It should take a record as input and return a number or a dense vector. |
|
FeatureExtractorJsfunc.dim |
number |
Yes |
The dimension of the feature extractor. Defaults to |
|
FeatureExtractorJsfunc.source |
|
The source of the extractor. |
innerFeatureExtractorMultinomial
Object
The feature extractor of type 'multinomial'.
Example
var qm = require('qminer');
// create a simple base, where each record contains the student name and an array of study groups
// here we know a student can be part of multiple study groups
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: "Class",
fields: [
{ name: "Name", type: "string" },
{ name: "StudyGroups", type: "string_v" }
]
}]
});
// create a feature space containing the multinomial extractor, where the values are normalized,
// and taken from the field "StudyGroup": "A", "B", "C", "D", "E", "F"
var ftr = new qm.FeatureSpace(base, {
type: "multinomial", source: "Class", field: "StudyGroups", normalize: true, values: ["A", "B", "C", "D", "E", "F"]
});
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorMultinomial.type |
string |
|
The type of the extractor. It must be equal 'multinomial'. |
|
FeatureExtractorMultinomial.normalize |
boolean |
Yes |
Normalize the resulting vector of the extractor to have L2 norm 1.0. Defaults to |
|
FeatureExtractorMultinomial.values |
Array of Object |
Yes |
A fixed set of values, which form a fixed feature set, no dimensionality changes if new values are seen in the updates. Cannot be used the same time as datetime. |
|
FeatureExtractorMultinomial.hashDimension |
number |
Yes |
A hashing code to set the fixed dimensionality. All values are hashed and divided modulo hashDimension to get the corresponding dimension. |
|
FeatureExtractorMultinomial.datetime |
Object |
Yes |
Same as 'values', only with predefined values which are extracted from date and time (month, day of month, day of week, time of day, hour).
Defaults to |
|
FeatureExtractorMultinomial.field |
(string or Array of String) |
|
The name of the field from which to take the key value. |
|
FeatureExtractorMultinomial.valueField |
(string or Array of String) |
Yes |
The name of the field from which to take the numeric value. When not provided, 1.0 is used as default numeric values for non-zero elements in the vector. |
|
FeatureExtractorMultinomial.source |
|
The source of the extractor. |
innerFeatureExtractorNumeric
Object
The feature extractor of type 'numeric'.
Example
var qm = require('qminer');
// create a simple base, where each record contains the student name and it's grade
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: "Class",
fields: [
{ name: "Name", type: "string" },
{ name: "Grade", type: "int" }
]
}]
});
// create a feature space containing the numeric extractor, where the values are
// normalized, the values are taken from the field "Grade"
var ftr = new qm.FeatureSpace(base, { type: "numeric", source: "Class", normalize: true, field: "Grade" });
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorNumeric.type |
string |
|
The type of the extractor. It must be equal 'numeric'. |
|
FeatureExtractorNumeric.normalize |
boolean |
Yes |
Normalize values between 0.0 and 1.0. Defaults to |
|
FeatureExtractorNumeric.min |
number |
Yes |
The minimal value used to form the normalization. |
|
FeatureExtractorNumeric.max |
number |
Yes |
The maximal value used to form the normalization. |
|
FeatureExtractorNumeric.field |
string |
|
The name of the field from which to take the value. |
|
FeatureExtractorNumeric.source |
|
The source of the extractor. |
innerFeatureExtractorPair
Object
The feature extractor of type 'pair'.
Example
var qm = require('qminer');
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorPair.type |
string |
|
The type of the extractor. It must be equal 'pair'. |
|
FeatureExtractorPair.first |
|
The first feature extractor. |
|
|
FeatureExtractorPair.second |
|
The second feature extractor. |
|
|
FeatureExtractorPair.source |
|
The source of the extractor. |
innerFeatureExtractorRandom
Object
The feature extractor of type 'random'.
Example
var qm = require('qminer');
// create a simple base, where each record contains only a persons name
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: "Person",
fields: [{ name: "Name", type: "string" }]
}]
});
// create a feature space containing the random extractor
var ftr = new qm.FeatureSpace(base, { type: "random", source: "Person" });
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorRandom.type |
string |
|
The type of the extractor. It must be equal 'random'. |
|
FeatureExtractorRandom.seed |
number |
Yes |
The seed number used to construct the random number. Defaults to |
|
FeatureExtractorRandom.source |
|
The source of the extractor. |
innerFeatureExtractors
Object
Feature extractor types.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
constant |
|
The constant type. |
|
|
random |
|
The random type. |
|
|
numeric |
|
The numeric type. |
|
|
categorical |
|
The categorical type. |
|
|
multinomial |
|
The multinomial type. |
|
|
text |
|
The text type. |
|
|
join |
|
The join type. |
|
|
pair |
|
The pair type. |
|
|
jsfunc |
|
The jsfunc type. |
|
|
dateWindow |
|
The date window type. |
|
|
sparseVector |
|
The sparse vector type. |
innerFeatureExtractorSparseVector
Object
The feature extractor of type 'num_sp_v'.
Example
var qm = require('qminer');
// create a simple base, where each record contains the student name and it's grade
var base = new qm.Base({
mode: 'createClean',
schema: [{
"name": "Class",
"fields": [
{ "name": "Name", "type": "string" },
{ "name": "Features", "type": "num_sp_v" }
]
}]
});
// create a feature space containing the numeric extractor, where the values are
// normalized, the values are taken from the field "Grade"
var ftr = new qm.FeatureSpace(base, { type: "num_sp_v", source: "Class", normalize: false, field: "Features" });
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorSparseVector.type |
string |
|
The type of the extractor. It must be equal 'num_sp_v'. |
|
FeatureExtractorSparseVector.dimension |
number |
Yes |
Dimensionality of sparse vectors. Defaults to |
|
FeatureExtractorSparseVector.normalize |
boolean |
Yes |
Normalize vectors to L2 norm of 1.0. Defaults to |
|
FeatureExtractorSparseVector.field |
string |
|
The name of the field from which to take the value. |
|
FeatureExtractorSparseVector.source |
|
The source of the extractor. |
innerFeatureExtractorText
Object
The feature extractor of type 'text'.
Example
var qm = require('qminer');
// create a simple base, where each record contains the title of the article and it's content
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: "Articles",
fields: [
{ name: "Title", type: "string" },
{ name: "Text", type: "string" }
]
}]
});
// create a feature spave containing the text (bag of words) extractor, where the values are normalized,
// weighted with 'tfidf' and the tokenizer is of 'simple' type, it uses english stopwords.
var ftr = new qm.FeatureSpace(base, {
type: "text", source: "Articles", field: "Text", normalize: true, weight: "tfidf",
tokenizer: { type: "simple", stopwords: "en"}
});
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureExtractorText.type |
string |
|
The type of the extractor. It must be equal 'text'. |
|
FeatureExtractorText.normalize |
boolean |
Yes |
Normalize the resulting vector of the extractor to have L2 norm 1.0. Defaults to |
|
FeatureExtractorText.weight |
Yes |
Type of weighting used for scoring terms. Defaults to |
|
|
FeatureExtractorText.hashDimension |
number |
Yes |
A hashing code to set the fixed dimensionality. All values are hashed and divided modulo hashDimension to get the corresponding dimension. |
|
FeatureExtractorText.field |
string |
|
The name of the field from which to take the value. |
|
FeatureExtractorText.tokenizer |
|
The settings for extraction of text. |
|
|
FeatureExtractorText.mode |
|
How are multi-record cases combined into single vector. |
|
|
FeatureExtractorText.stream |
|
Details on forgetting old IDFs when running on stream. |
|
|
FeatureExtractorText.source |
|
The source of the extractor. |
innerFeatureSource
Object
From where are the input records taken.
Property
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureSource.store |
string |
|
The store name. |
innerFeatureTokenizer
Object
The settings for extraction of text.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
FeatureTokenizer.type |
Yes |
The type of the encoding text. Defaults to |
|
|
FeatureTokenizer.stopwords |
Yes |
The stopwords used for extraction. Defaults to |
|
|
FeatureTokenizer.stemmer |
Yes |
The stemmer used for extraction. Defaults to |
|
|
FeatureTokenizer.uppercase |
boolean |
Yes |
Changing all words to uppercase. Defaults to |
innerSchemaDefinition
Object
Store schema definition object
Example
var qm = require('qminer');
// create a simple movies store, where each record contains only the movie title.
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: "Movies",
fields: [{ name: "title", type: "string" }]
}]
});
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
SchemaDefinition.name |
string |
|
The name of the store. Store name can be composed by from English letters, numbers, _ or $ characters. It can only begin with a character. |
|
SchemaDefinition.fields |
Array of module:qm~SchemaFieldDefinition |
|
The array of field descriptors. |
|
SchemaDefinition.joins |
Array of module:qm~SchemaJoinDefinition |
Yes |
The array of join descriptors, used for linking records from different stores. Defaults to |
|
SchemaDefinition.keys |
Array of module:qm~SchemaKeyDefinition |
Yes |
The array of key descriptors. Keys define how records are indexed, which is needed for search using the query language. Defaults to |
|
SchemaDefinition.timeWindow |
Yes |
Time window description. Stores can have a window, which is used by garbage collector to delete records once they fall out of the time window. Window can be defined by number of records or by time. |
innerSchemaFieldDefinition
Object
Store schema field definition object
Example
var qm = require('qminer');
var base = new qm.Base({
mode: 'createClean',
schema: [
{ name: 'NewsArticles',
fields: [
{ name: "ID", primary: true, type: "string", shortstring: true },
{ name: "Source", type: "string", codebook: true },
{ name: "DateTime", type: "datetime" },
{ name: "Title", type: "string", store: "cache" },
{ name: "Tokens", type: "string_v", store: "cache", null: true },
{ name: "Vector", type: "num_sp_v", store: "cache", null: true }]
}
]
});
// add a record:
// - we set the date using the ISO string representation
// - we set the string vector Tokens with an array of strings
// - we set the numeric sparse vector Vector with an array of two element arrays
// (index, value), see the sparse vector constructor {@link module:la.SparseVector}
base.store('NewsArticles').push({
ID: 't12344',
Source: 's1234',
DateTime: '2015-01-01T00:05:00',
Title: 'the title',
Tokens: ['token1', 'token2'],
Vector: [[0,1], [1,1]]});
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
SchemaFieldDefinition.name |
string |
|
The name of the field. |
|
SchemaFieldDefinition.type |
|
The type of the field. |
|
|
SchemaFieldDefinition.primary |
boolean |
Yes |
Field which can be used to identify record. There can be only one primary field in a store. There can be at most one record for each value of the primary field. Currently following fields can be marked as primary: int, uin64, string, float, datetime. Primary fields of type string are also used for record names. Defaults to |
|
SchemaFieldDefinition.null |
boolean |
Yes |
When set to true, null is a possible value for a field (allow missing values). Defaults to |
|
SchemaFieldDefinition.store |
string |
Yes |
Defines where to store the field, options are: 'cache' or 'memory'. The default option is 'memory', which stores the values in RAM. Option 'cache' stores the values on disk, with a layer of FIFO cache in RAM, storing the most recently used values. Defaults to |
|
SchemaFieldDefinition.default |
Object |
Yes |
Default value for field when not given for a new record. |
|
SchemaFieldDefinition.codebook |
boolean |
Yes |
Useful when many records have only few different values of this field. If set to true, then a separate table of all values is kept, and records only point to this table (replacing variable string field in record serialisation with fixed-length integer). Useful to decrease memory footprint, and faster to update. (STRING FIELD TYPE SPECIFIC). Defaults to |
|
SchemaFieldDefinition.shortstring |
boolean |
Yes |
Useful for string shorter then 127 characters (STRING FIELD TYPE SPECIFIC). Defaults to |
innerSchemaJoinDefinition
Object
Store schema join definition object
Example
var qm = require('qminer');
// Create two stores: People which stores only names of persons and Movies, which stores only titles.
// Each person can direct zero or more movies, so we use an index join named 'directed' and
// each movie has a single director, so we use a field join 'director'. The joins are
// inverses of each other. The inverse join simplifies the linking, since only one join needs
// to be specified, and the other direction can be linked automatically (in the example
// below we specify only the 'director' link and the 'directed' join is updated automatically).
//
var base = new qm.Base({
mode: 'createClean',
schema: [
{ name: 'People',
fields: [{ name: 'name', type: 'string', primary: true }],
joins: [{ name: 'directed', 'type': 'index', 'store': 'Movies', 'inverse': 'director' }] },
{ name: 'Movies',
fields: [{ name: 'title', type: 'string', primary: true }],
joins: [{ name: 'director', 'type': 'field', 'store': 'People', 'inverse': 'directed' }] }
]
});
// Adds a movie, automatically adds 'Jim Jarmusch' to People, sets the 'director' join (field join)
// and automatically updates the index join 'directed', since it's an inverse join of 'director'
base.store('Movies').push({ title: 'Broken Flowers', director: { name: 'Jim Jarmusch' } });
// Adds a movie, sets the 'director' join, updates the index join of 'Jim Jarmusch'
base.store('Movies').push({ title: 'Coffee and Cigarettes', director: { name: 'Jim Jarmusch' } });
// Adds movie, automatically adds 'Lars von Trier' to People, sets the 'director' join
// and 'directed' inverse join (automatically)
base.store('Movies').push({ title: 'Dogville', director: { name: 'Lars von Trier' } });
var movie = base.store('Movies')[0]; // get the first movie (Broken Flowers)
// Each movie has a property corresponding to the join name: 'director'.
// Accessing the property returns a {@link module:qm.Record} from the store People.
var person = movie.director; // get the director
var personName = person.name; // get person's name ('Jim Jarmusch')
// Each person has a property corresponding to the join name: 'directed'.
// Accessing the property returns a {@link module:qm.RecSet} from the store People.
var movies = person.directed; // get all the movies the person directed.
movies.each(function (movie) { var title = movie.title; });
// Gets the following titles:
// 'Broken Flowers'
// 'Coffee and Cigarettes'
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
SchemaJoinDefinition.name |
string |
|
The name of the join. |
|
SchemaJoinDefinition.type |
string |
|
The supported types are: 'field' and 'index'.
|
|
SchemaJoinDefinition.store |
string |
|
The store name from which the linked records are. |
innerSchemaKeyDefinition
Object
Store schema key definition object
Example
var qm = require('qminer');
// Create a store People which stores only names of persons.
var base = new qm.Base({
mode: 'createClean',
schema: [
{ name: 'People',
fields: [{ name: 'name', type: 'string', primary: true }],
keys: [
{ field: 'name', type: 'value'},
{ field: 'name', name: 'nameText', type: 'text'}
]
}
]
});
base.store('People').push({name : 'John Smith'});
base.store('People').push({name : 'Mary Smith'});
// search based on indexed values
base.search({$from : 'People', name: 'John Smith'}); // Return the record set containing 'John Smith'
// search based on indexed values
base.search({$from : 'People', name: 'Smith'}); // Returns the empty record set.
// search based on text indexing
base.search({$from : 'People', nameText: 'Smith'}); // Returns both records.
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
SchemaKeyDefinition.field |
string |
|
The name of the field that will be indexed. |
|
SchemaKeyDefinition.type |
string |
|
The supported types are: 'value', 'text' and 'location'.
|
|
SchemaKeyDefinition.name |
string |
Yes |
Allows using a different name for the key in search queries. This allows for multiple keys to be put against the same field. Default value is the name of the field. |
|
SchemaKeyDefinition.vocabulary |
string |
Yes |
defines the name of the vocabulary used to store the tokens or values. This can be used indicate to several keys to use the same vocabulary, to save on memory. Supported by 'value' and 'text' keys. |
|
SchemaKeyDefinition.tokenize |
string |
Yes |
defines the tokenizer that is used for tokenizing the values stored in indexed fields. Tokenizer uses same parameters as in bag-of-words feature extractor. Default is english stopword list and no stemmer. Supported by 'text' keys. |
innerSchemaTimeWindowDefinition
Object
Stores can have a window, which is used by garbage collector to delete records once they
fall out of the time window. Window can be defined by number of records or by time.
Window defined by parameter window, its value being the number of records to be kept.
Important: module:qm.Base#garbageCollect must be called manually to remove records outside time window.
Examples
Define window by number of records
var qm = require('qminer');
// create base
var base = new qm.Base({ mode: 'createClean' });
// create store with window
base.createStore({
"name": "TestStore",
"fields": [
{ "name": "DateTime", "type": "datetime" },
{ "name": "Measurement", "type": "float" }
],
window: 3,
});
// push 5 records into created store
for (var i = 0; i < 5; i++) {
var rec = {
"DateTime": new Date().toISOString(),
"Measurement": i
};
base.store("TestStore").push(rec);
}
// check number of records in store
console.log(base.store("TestStore").allRecords.length); // 5
// clean base with garbage collector
base.garbageCollect();
// check number of records in store
console.log(base.store("TestStore").allRecords.length); // 3
base.close();
Define window by time
var qm = require('qminer');
// create base
var base = new qm.Base({ mode: 'createClean' });
// create store with window
base.createStore({
"name": "TestStore",
"fields": [
{ "name": "DateTime", "type": "datetime" },
{ "name": "Measurement", "type": "float" }
],
timeWindow: {
duration: 2,
unit: "hour",
field: "DateTime"
}
});
// push 5 records into created store
for (var i = 0; i < 5; i++) {
var rec = {
"DateTime": new Date(new Date().getTime() + i * 60 * 60 * 1001).toISOString(),
"Measurement": i
};
base.store("TestStore").push(rec);
}
// check number of records in store
console.log(base.store("TestStore").allRecords.length); // 5
// clean base with garbage collector
base.garbageCollect();
// check number of records in store
console.log(base.store("TestStore").allRecords.length); // 2
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
SchemaTimeWindowDefinition.duration |
number |
|
the size of the time window (in number of units). |
|
SchemaTimeWindowDefinition.unit |
string |
|
defines in which units the window size is specified. Possible values are second, minute, hour, day, week or month. |
|
SchemaTimeWindowDefinition.field |
string |
Yes |
name of the datetime filed, which defines the time of the record. In case it is not given, the insert time is used in its place. |
innerStreamAggregateEMA
module:qmStreamAggr
This stream aggregator represents the exponential moving average window buffer. It calculates the weighted moving average
of the values in the connected stream aggregator, where the weights are exponentially decreasing. It implements the following methods:
module:qm.StreamAggr#getFloat returns the exponentional average of the values in it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series tick stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window should be 1 hour.
var timeser = {
name: 'TimeSeriesAggr',
type: 'timeSeriesTick',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius'
};
var timeSeries = base.store("Heat").addStreamAggr(timeser);
// add an exponentional moving average aggregator, that is connected with the 'TimeSeriesAggr' aggregator.
// It should interpolate with the previous value, the decay should be 3 seconds and the initWindow should be 2 seconds.
var ema = {
name: 'emaAggr',
type: 'ema',
store: 'Heat',
inAggr: 'TimeSeriesAggr',
emaType: 'previous',
interval: 3000,
initWindow: 2000
};
var expoMovingAverage = base.store("Heat").addStreamAggr(ema);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateEMA.name |
string |
|
The given name for the stream aggregator. |
|
StreamAggregateEMA.type |
string |
|
The type of the stream aggregator. It must be equal to 'ema'. |
|
StreamAggregateEMA.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateEMA.inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. It cannot connect to the module:qm~StreamAggr_TimeSeriesWindow. |
|
StreamAggregateEMA.emaType |
string |
|
The type of interpolation. The choices are 'previous', 'linear' and 'next'.
|
|
StreamAggregateEMA.interval |
number |
|
The time interval defining the decay. It must be greater than initWindow. |
|
StreamAggregateEMA.initWindow |
number |
|
The time window of required values for initialization. |
innerStreamAggregateEMASpVec
module:qmStreamAggr
This stream aggregator represents the exponential moving average window buffer for sparse vectors. It calculates the weighted moving average
of the values in the connected stream aggregator, where the weights are exponentially decreasing. It implements the following methods:
module:qm.StreamAggr#getValueVector returns the exponentional average of the sparse-vector values in it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Data",
fields: [
{ name: "Text", type: "string" },
{ name: "Time", type: "datetime" }
]
}]
});
var store = base.store("Data");
// create a new time series that emits data as sparse vector, based on text.
var aggr = {
name: 'featureSpaceWindow',
type: 'timeSeriesWinBufFeatureSpace',
store: store.name,
timestamp: 'Time',
featureSpace: {
type: "categorical",
source: store.name,
field: "Text"
},
winsize: 1 // keep only most recent value in window
};
// attach sum
var sa = store.addStreamAggr(aggr);
var aggr2 = {
name: 'sparseVectorSum',
type: 'winBufSpVecSum',
store: store.name,
inAggr: aggr.name // this means that sum is equal to the most recent data
};
// ok, now attach EMA
var sa2 = store.addStreamAggr(aggr2);
var ema_def = {
name: 'sparseVectorEma',
type: 'emaSpVec',
store: store.name,
inAggr: aggr2.name,
emaType: "next",
interval: 2000,
initWindow: 0
};
var ema = store.addStreamAggr(ema_def);
// add some data
store.push({ Time: 1000, Text: 'a' });
store.push({ Time: 2000, Text: 'b' });
store.push({ Time: 3000, Text: 'c' });
// display EMA data
ema.getValueVector().print();
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateEMA.name |
string |
|
The given name for the stream aggregator. |
|
StreamAggregateEMA.type |
string |
|
The type of the stream aggregator. It must be equal to 'ema'. |
|
StreamAggregateEMA.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateEMA.inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. It cannot connect to the module:qm~StreamAggr_TimeSeriesWindow. |
|
StreamAggregateEMA.emaType |
string |
|
The type of interpolation. The choices are 'previous', 'linear' and 'next'.
|
|
StreamAggregateEMA.interval |
number |
|
The time interval defining the decay. It must be greater than initWindow. |
|
StreamAggregateEMA.initWindow |
number |
|
The time window of required values for initialization. Optional, default is 0. |
|
StreamAggregateEMA.cuttof |
number |
|
Minimal value for any dimension. If value of certain dimension falls bellow thsi value, the dimension is pruned from average. Optional, default is 0.001. |
innerStreamAggregateHistogram
module:qm.StreamAggr
This stream aggregator represents an online histogram. It can connect to a buffered aggregate (such as module:qm~StreamAggregateTimeSeriesWindow)
or a time series (such as module:qm~StreamAggregateEMA).
The aggregate defines an ordered set of points p(0), ..., p(n) that define n bins. Infinites at both ends are allowed.
A new measurement is tested for inclusion in the left-closed right-opened intervals [p(i), p(i+1)) and the corresponding
bin counter is increased for the appropriate bin (or decreased if the point is outgoing from the buffer).
It implements the following methods:
module:qm.StreamAggr#getFloatLength returns the number of bins.
module:qm.StreamAggr#getFloatAt returns the count for a bin index.
module:qm.StreamAggr#getFloatVector returns the vector of counts, the length is equal to the number of bins.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window is 1 day.
var timeser = {
name: 'TimeSeriesBuffer',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius',
winsize: 86400000 // one day in miliseconds
};
var timeSeries = base.store("Heat").addStreamAggr(timeser);
// add a histogram aggregator, that is connected with the 'TimeSeriesAggr' aggregator
var aggrJson = {
name: 'Histogram',
type: 'onlineHistogram',
store: 'Heat',
inAggr: 'TimeSeriesBuffer',
lowerBound: 0,
upperBound: 10,
bins: 5,
addNegInf: false,
addPosInf: false
};
var hist = base.store("Heat").addStreamAggr(aggrJson);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
name |
string |
|
The given name of the stream aggregator. |
|
type |
string |
|
The type for the stream aggregator. It must be equal to 'onlineHistogram'. |
|
store |
string |
|
The name of the store from which it takes the data. |
|
inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. |
|
lowerBound |
number |
|
The lowest non-infinite bin point. |
|
upperBound |
number |
|
The highest non-infinite bin point. |
|
bins |
number |
Yes |
The number of bins bounded by Defaults to |
|
addNegInf |
boolean |
Yes |
Include a bin [-Inf, lowerBound]. Defaults to |
|
addPosInf |
boolean |
Yes |
Include a bin [upperBound, Inf]. Defaults to |
innerStreamAggregateMax
module:qm.StreamAggr
This stream aggregator represents the maximum moving window buffer. It monitors the maximal value in the connected stream aggregator.
It implements the following methods:
module:qm.StreamAggr#getFloat returns the maximal value of the records in the it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window is 1 day.
var timeser = {
name: 'TimeSeriesAggr',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius',
winsize: 86400000 // one day in miliseconds
};
var timeSeries = base.store("Heat").addStreamAggr(timeser);
// add a max aggregator, that is connected with the 'TimeSeriesAggr' aggregator
var max = {
name: 'MaxAggr',
type: 'winBufMax',
store: 'Heat',
inAggr: 'TimeSeriesAggr'
};
var maximal = base.store("Heat").addStreamAggr(max);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateMax.name |
string |
|
The given name of the stream aggregator. |
|
StreamAggregateMax.type |
string |
|
The type for the stream aggregator. It must be equal to 'winBufMax'. |
|
StreamAggregateMax.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateMax.inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. |
innerStreamAggregateMerger
module:qm.StreamAggr
This stream aggregator represents the merger aggregator. It merges records from two or more stores into a new store depending on the timestamp. No methods are implemented for this aggregator.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Cars",
fields: [
{ name: "NumberOfCars", type: "float" },
{ name: "Time", type: "datetime" }
]
},
{
name: "Temperature",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
},
{
name: "Merged",
fields: [
{ name: "NumberOfCars", type: "float" },
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new merger stream aggregator that mergers the records of the 'Cars' and 'Temperature' stores.
// The records are interpolated linearly and stored in the 'Merged' store.
var mer = {
name: 'MergerAggr',
type: 'merger',
outStore: 'Merged',
createStore: false,
timestamp: 'Time',
fields: [
{ source: 'Cars', inField: 'NumberOfCars', outField: 'NumberOfCars', interpolation: 'linear', timestamp: 'Time' },
{ source: 'Temperature', inField: 'Celsius', outField: 'Celsius', interpolation: 'linear', timestamp: 'Time' }
]
};
var merger = new qm.StreamAggr(base, mer);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateMerger.name |
string |
|
The given name for the stream aggregator. |
|
StreamAggregateMerger.type |
string |
|
The type of the stream aggregator. It must be equal to 'merger'. |
|
StreamAggregateMerger.outStore |
string |
|
The name of the store where it saves the merged records. |
|
StreamAggregateMerger.createStore |
boolean |
|
If the outStore must be created. |
|
StreamAggregateMerger.timestamp |
string |
|
The store field of outStore, where the timestamp is saved. |
|
StreamAggregateMerger.fields |
Array of Object |
|
An array of json objects. The json objects contain:
|
innerStreamAggregateMin
module:qm.StreamAggr
This stream aggregator represents the minimum moving window buffer. It monitors the minimal value in the connected stream aggregator.
It implements the following methods:
module:qm.StreamAggr#getFloat returns the minimal value of the records in it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window is 1 day.
var timeser = {
name: 'TimeSeriesAggr',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius',
winsize: 86400000 // 1 day in miliseconds
};
var timeSeries = base.store("Heat").addStreamAggr(timeser);
// add a min aggregator, that is connected with the 'TimeSeriesAggr' aggregator
var min = {
name: 'MinAggr',
type: 'winBufMin',
store: 'Heat',
inAggr: 'TimeSeriesAggr'
};
var minimal = base.store("Heat").addStreamAggr(min);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateMin.name |
string |
|
The given name of the stream aggregator. |
|
StreamAggregateMin.type |
string |
|
The type of the stream aggregator. It must be equal to 'winBufMin'. |
|
StreamAggregateMin.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateMin.inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. |
innerStreamAggregateMovingAverage
module:qmStreamAggr
This stream aggregator represents the moving average window buffer. It calculates the moving average value of the connected stream aggregator values.
It implements the following methods:
module:qm.StreamAggr#getFloat returns the average of the values in it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window should be 1 day.
var timeser = {
name: 'TimeSeriesAggr',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius',
winsize: 86400000
};
var timeSeries = base.store("Heat").addStreamAggr(timeser);
// add a moving average aggregator, that is connected with the 'TimeSeriesAggr' aggregator
var ma = {
name: 'movingAverageAggr',
type: 'ma',
store: 'Heat',
inAggr: 'TimeSeriesAggr'
};
var movingAverage = base.store("Heat").addStreamAggr(ma);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateMovingAverage.name |
string |
|
The given name of the stream aggregator. |
|
StreamAggregateMovingAverage.type |
string |
|
The type of the stream aggregator. It must be equal to 'ma'. |
|
StreamAggregateMovingAverage.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateMovingAverage.inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. |
innerStreamAggregateMovingCorrelation
module:qm.StreamAggr
This stream aggregator represents the moving covariance window buffer. It calculates the moving correlation of the three stream aggregators,
that it's connected to. It implements the following methods:
module:qm.StreamAggr#getFloat returns the correlation of the values in it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "WaterConsumption", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window is 1 day.
var Celsius = {
name: 'CelsiusAggr',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius',
winsize: 86400000
}; base.store("Heat").addStreamAggr(Celsius);
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'WaterConsumption' field
// and the timestamp from the 'Time' field. The size of the window is 1 day.
var water = {
name: 'WaterAggr',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'WaterConsumption',
winsize: 86400000
}; base.store("Heat").addStreamAggr(water);
// add a covariance aggregator, that is connected with the 'CelsiusAggr' and 'WaterAggr' aggregators
var covariance = {
name: 'covarianceAggr',
type: 'covariance',
store: 'Heat',
inAggrX: 'CelsiusAggr',
inAggrY: 'WaterAggr'
}; base.store("Heat").addStreamAggr(covariance);
// add the two variance aggregators, that take from the 'Celsius' and 'WaterConsumption' fields, respectively.
var celVar = {
name: 'CelsiusVarAggr',
type: 'variance',
store: 'Heat',
inAggr: 'CelsiusAggr'
}; base.store("Heat").addStreamAggr(celVar);
var waterVar = {
name: 'waterVarAggr',
type: 'variance',
store: 'Heat',
inAggr: 'WaterAggr'
}; base.store("Heat").addStreamAggr(waterVar);
// add a correlation aggregator, that is connected to 'CovarianceAggr', 'CelsiusVarAggr' and 'WaterValAggr' aggregators
var corr = {
name: 'corrAggr',
type: 'correlation',
store: 'Heat',
inAggrCov: 'covarianceAggr',
inAggrVarX: 'CelsiusVarAggr',
inAggrVarY: 'waterVarAggr'
};
var correlation = base.store("Heat").addStreamAggr(corr);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateMovingCorrelation.name |
string |
|
The given name for the stream aggregator. |
|
StreamAggregateMovingCorrelation.type |
string |
|
The type of the stream aggregator. It must be equal to 'correlation'. |
|
StreamAggregateMovingCorrelation.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateMovingCorrelation.inAggrCov |
string |
|
The name of the covariance stream aggregator. |
|
StreamAggregateMovingCorrelation.inAggrVarX |
string |
|
The name of the first variance stream aggregator. |
|
StreamAggregateMovingCorrelation.inAggrVarY |
string |
|
The name of the second variance stream aggregator. |
innerStreamAggregateMovingCovariance
module:qm.StreamAggr
This stream aggregator represents the moving covariance window buffer. It calculates the moving covariance of the two stream aggregators, that it's connected to.
It implements the following methods:
module:qm.StreamAggr#getFloat returns the covariance of the values in it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "WaterConsumption", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window is 1 day.
var Celsius = {
name: 'CelsiusAggr',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius',
winsize: 86400000
}; base.store("Heat").addStreamAggr(Celsius);
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'WaterConsumption' field
// and the timestamp from the 'Time' field. The size of the window is 1 day.
var water = {
name: 'WaterAggr',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'WaterConsumption',
winsize: 86400000
}; base.store("Heat").addStreamAggr(water);
// add a covariance aggregator, that is connected with the 'CelsiusAggr' and 'WaterAggr' stream aggregators
var covariance = {
name: 'covAggr',
type: 'covariance',
store: 'Heat',
inAggrX: 'CelsiusAggr',
inAggrY: 'WaterAggr'
};
var covarianceAggr = base.store("Heat").addStreamAggr(covariance);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateMovingCovariance.name |
string |
|
The given name for the stream aggregator. |
|
StreamAggregateMovingCovariance.type |
string |
|
The type of the stream aggregator. It must be equal to 'covariance'. |
|
StreamAggregateMovingCovariance.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateMovingCovariance.inAggrX |
string |
|
The name of the first stream aggregator to which it connects and gets data. |
|
StreamAggregateMovingCovariance.inAggrY |
string |
|
The name of the recond stream aggregator to which it connects and gets data. |
innerStreamAggregateMovingVariance
module:qm.StreamAggr
This stream aggregator represents the moving variance window buffer. It calculates the moving variance of the stream aggregator, that it's connected to.
It implements the following methods:
module:qm.StreamAggr#getFloat returns the variance of the values in it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window is 1 day.
var timeser = {
name: 'TimeSeriesAggr',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius',
winsize: 86400000
};
var timeSeries = base.store("Heat").addStreamAggr(timeser);
// add a variance aggregator, that is connected with the 'TimeSeriesAggr' aggregator
var variance = {
name: 'varAggr',
type: 'variance',
store: 'Heat',
inAggr: 'TimeSeriesAggr'
};
var varianceAggr = base.store("Heat").addStreamAggr(variance);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateMovingVariance.name |
string |
|
The given name for the stream aggregator. |
|
StreamAggregateMovingVariance.type |
string |
|
The type of the stream aggregator. It must be equal to 'variance'. |
|
StreamAggregateMovingVariance.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateMovingVariance.inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. |
innerStreamAggregateRecordBuffer
module:qm.StreamAggr
This stream aggregator represents record buffer. It stores the values inside a moving window. It implements all the methods of except module:qm.StreamAggr#getFloat, module:qm.StreamAggr#getTimestamp.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store. The size of the window is 3 records.
var aggr = {
name: 'Delay',
type: 'recordBuffer',
size: 3
};
base.store("Heat").addStreamAggr(aggr);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateTimeSeriesWindow.name |
string |
|
The given name of the stream aggregator. |
|
StreamAggregateTimeSeriesWindow.type |
string |
|
The type of the stream aggregator. It must be equal to 'recordBuffer'. |
|
StreamAggregateTimeSeriesWindow.size |
number |
|
The size of the window. |
innerStreamAggregateResampler
module:qm.StreamAggr
This stream aggregator represents the resampler window buffer. It creates new values that are interpolated by using the values from an existing store. No methods are implemented for this aggregator.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
},
{
name: "interpolatedValues",
fields: [
{ name: "Value", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new resampler stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The interpolated values are stored in the 'interpolatedValues' store.
// The interpolation should be linear and the interval should be 2 seconds.
var res = {
name: 'resamplerAggr',
type: 'resampler',
store: 'Heat',
outStore: 'interpolatedValues',
timestamp: 'Time',
fields: [{
name: 'Celsius',
interpolator: 'linear'
}],
createStore: false,
interval: 2000
};
var resampler = base.store("Heat").addStreamAggr(res);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateResampler.name |
string |
|
The given name for the stream aggregator. |
|
StreamAggregateResampler.type |
string |
|
The type of the stream aggregator. It must be equal to 'resampler'. |
|
StreamAggregateResampler.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateResampler.outStore |
string |
|
The store in which the samples are stored. |
|
StreamAggregateResampler.timestamp |
string |
|
The store field from which it takes the timestamps. |
|
StreamAggregateResampler.fields |
Object |
|
The json, which contains:
|
|
StreamAggregateResampler.createStore |
boolean |
|
If the outStore must be created. |
|
StreamAggregateResampler.interval |
number |
|
The size/frequency the interpolated values should be given. |
innerStreamAggregateSimpleLinearRegression
module:qm.StreamAggr
This stream aggregator computes a simple linear regression given two stream aggregates that support the getFloatVector methods and represent variates (input) and covariates (output). Optionally the aggregate computes quantile bands: for each quantile q a parallel line to the fitted line is found, so that q fraction of (x,y) datapoints fall below the line. For example, under Gaussian noise, if Y = a + k X + N(0,sig) then the 0.95 quantile band will equal a + 2 sig. This means that 95% of (x,y) pairs lie below the line Y = a + 2 sig + k X.
The results are returned as a JSON by calling saveJson and are of type module:qm~StreamAggregateSimpleLinearRegressionResult.
Example
// import the qm module
var qm = require('qminer');
// create a base with X,Y measurements
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: 'Function',
fields: [
{ name: 'Time', type: 'datetime' },
{ name: 'X', type: 'float' },
{ name: 'Y', type: 'float' }
]
}]
});
var store = base.store('Function');
// 1 second buffer for X values
var winX = store.addStreamAggr({
type: 'timeSeriesWinBuf',
timestamp: 'Time',
value: 'X',
winsize: 1000
});
// 1 second buffer for Y values
var winY = store.addStreamAggr({
type: 'timeSeriesWinBuf',
timestamp: 'Time',
value: 'Y',
winsize: 1000
});
// the will find regression line, as well as two parallel quartile lines
var linReg = store.addStreamAggr({
type: 'simpleLinearRegression',
inAggrX: winX.name,
inAggrY: winY.name,
storeX: "Function",
storeY: "Function",
quantiles: [0.25, 0.75]
});
store.push({ Time: '2015-06-10T14:13:32.001', X: 0, Y: -2 });
store.push({ Time: '2015-06-10T14:13:32.002', X: 0, Y: -1 });
store.push({ Time: '2015-06-10T14:13:32.003', X: 0, Y: 1 });
store.push({ Time: '2015-06-10T14:13:32.004', X: 0, Y: 2 });
store.push({ Time: '2015-06-10T14:13:32.005', X: 1, Y: -1 });
store.push({ Time: '2015-06-10T14:13:32.006', X: 1, Y: -0 });
store.push({ Time: '2015-06-10T14:13:32.007', X: 1, Y: 2 });
store.push({ Time: '2015-06-10T14:13:32.008', X: 1, Y: 3 });
var res = linReg.saveJson();
res.bands[0] // -1.5
res.bands[1] // 1.5
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
name |
string |
|
The given name of the stream aggregator. |
|
type |
string |
|
The type for the stream aggregator. It must be equal to 'onlineVecDiff'. |
|
storeX |
string |
|
The name of the store from which it takes the data for the first vector. |
|
storeY |
string |
|
The name of the store from which it takes the data for the second vector. |
|
inAggrX |
string |
|
The name of the first stream aggregator to which it connects and gets data. |
|
inAggrY |
string |
|
The name of the second stream aggregator to which it connects and gets data. |
|
quantiles |
string |
|
An array of numbers between 0 and 1 for which the quantile bands will be computed. |
innerStreamAggregateSimpleLinearRegressionResult
Object
Simple linear regression result JSON
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateSimpleLinearRegressionResult.intercept |
number |
|
Regressor intercept. |
|
StreamAggregateSimpleLinearRegressionResult.slope |
number |
|
Regressor slope. |
|
StreamAggregateSimpleLinearRegressionResult.quantiles |
Array of number |
Yes |
Quantiles for which bands will be computed. |
|
StreamAggregateSimpleLinearRegressionResult.bands |
Array of number |
Yes |
Computed band intercepts. |
innerStreamAggregateSlottedHistogram
module:qm.StreamAggr
This stream aggregator represents an online slotted histogram. It can connect to a buffered aggregate (such as module:qm~StreamAggregateTimeSeriesWindow)
or a time series (such as module:qm~StreamAggregateEMA).
It maps historical values into single period (e.g. into hours of the week).
The aggregate defines an ordered set of points p(0), ..., p(n) that define n bins. Infinites at both ends are NOT allowed.
A new measurement is tested for inclusion in the left-closed right-opened intervals [p(i), p(i+1)) and the corresponding
bin counter is increased for the appropriate bin (or decreased if the point is outgoing from the buffer).
It implements the following methods:
module:qm.StreamAggr#getFloatLength returns the number of bins.
module:qm.StreamAggr#getFloatAt returns the count for a bin index.
module:qm.StreamAggr#getFloatVector returns the vector of counts, the length is equal to the number of bins.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window is 4 weeks.
var timeser = {
name: 'TimeSeriesBuffer',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius',
winsize:<PHONE_NUMBER> // 4 weeks
};
var timeSeries = base.store("Heat").addStreamAggr(timeser);
// add a slotted-histogram aggregator, that is connected with the 'TimeSeriesAggr' aggregator
// it will present accumulated histogram for the last 2 hours (window) of the week (period) for the last 4 weeks (see aggregate above)
var aggrJson = {
name: 'Histogram',
type: 'onlineSlottedHistogram',
store: 'Heat',
inAggr: 'TimeSeriesBuffer',
period: 604800000, // 1 week
window: 7200000, // 2h
bins: 5, // 5 possible clusters
granularity: 300000 // 5 min
};
var hist = base.store("Heat").addStreamAggr(aggrJson);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
name |
string |
|
The given name of the stream aggregator. |
|
type |
string |
|
The type for the stream aggregator. It must be equal to 'onlineHistogram'. |
|
store |
string |
|
The name of the store from which it takes the data. |
|
inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. |
|
period |
number |
|
Cycle length in msec. |
|
window |
number |
|
Window length that is reported when aggregate is queried. |
|
bins |
number |
|
The number of bins - input data is expected to be withing interval [0, bins-1]. |
|
granularity |
number |
|
Storage granularity in msec. History is stored in slots with this length. Number of slots=period/granularity |
innerStreamAggregateSparseVecSum
module:qm.StreamAggr
This stream aggregator represents the sparse-vector-sum moving window buffer. It sums all the sparse-vector values, that are in the connected stream aggregator.
It implements the following methods:
module:qm.StreamAggr#getValueVector returns the sum of the values of the records in it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
var qm = require('qminer');
var base = new qm.Base({
mode: 'createClean',
schema: [{
name: 'Docs',
fields: [
{ name: 'Time', type: 'datetime' },
{ name: 'Text', type: 'string' }
]
}]
});
var store = base.store('Docs');
var aggr = {
name: 'featureSpaceWindow',
type: 'timeSeriesWinBufFeatureSpace',
store: 'Docs',
timestamp: 'Time',
featureSpace: {
type: "categorical",
source: "Docs",
field: "Text"
},
winsize: 1000
};
var sa = store.addStreamAggr(aggr);
var aggr2 = {
name: 'sparseVectorSum',
type: 'winBufSpVecSum',
store: 'Docs',
inAggr: 'featureSpaceWindow'
};
var sa2 = store.addStreamAggr(aggr2);
store.push({ Time: '2015-06-10T14:13:32.0', Text: 'a' }); // 0
store.push({ Time: '2015-06-10T14:13:33.0', Text: 'b' }); // 1
store.push({ Time: '2015-06-10T14:14:34.0', Text: 'c' }); // 2
store.push({ Time: '2015-06-10T14:15:35.0', Text: 'd' }); // 3
store.push({ Time: '2015-06-10T14:15:36.0', Text: 'e' }); // 4
store.push({ Time: '2015-06-10T14:15:37.0', Text: 'f' }); // 5
var valVec2 = sa2.getValueVector(); // [0, 0, 0, 0, 1, 1] - only vectors 4 and 5 remain in window
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateSum.name |
string |
|
The given name of the stream aggregator. |
|
StreamAggregateSum.type |
string |
|
The type of the stream aggregator. It must be equal to 'winBufSpVecSum'. |
|
StreamAggregateSum.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateSum.inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. |
innerStreamAggregateSum
module:qm.StreamAggr
This stream aggregator represents the sum moving window buffer. It sums all the values, that are in the connected stream aggregator.
It implements the following methods:
module:qm.StreamAggr#getFloat returns the sum of the values of the records in the it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Income",
fields: [
{ name: "Amount", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Income' store, that takes the values from the 'Amount' field
// and the timestamp from the 'Time' field. The size of the window should 1 week.
var timeser = {
name: 'TimeSeriesAggr',
type: 'timeSeriesWinBuf',
store: 'Income',
timestamp: 'Time',
value: 'Amount',
winsize: 604800000 // 7 days in miliseconds
};
var timeSeries = base.store("Income").addStreamAggr(timeser);
// add a sum aggregator, that is connected with the 'TimeSeriesAggr' aggregator
var sum = {
name: 'SumAggr',
type: 'winBufSum',
store: 'Heat',
inAggr: 'TimeSeriesAggr'
};
var sumAggr = base.store("Income").addStreamAggr(sum);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateSum.name |
string |
|
The given name of the stream aggregator. |
|
StreamAggregateSum.type |
string |
|
The type of the stream aggregator. It must be equal to 'winBufSum'. |
|
StreamAggregateSum.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateSum.inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. |
innerStreamAggregateThreshold
module:qmStreamAggr
This stream aggregator represents a threshold indicator. It outputs 1 if the current value in the data streams is above the threshold and 0 otherwise.
module:qm.StreamAggr#getFloat returns the exponentional average of the values in it's buffer window.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer window.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series tick stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window should be 1 hour.
var timeser = {
name: 'TimeSeriesTickAggr',
type: 'timeSeriesTick',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius'
};
var timeSeries = base.store("Heat").addStreamAggr(timeser);
// a threshold aggregator, that is connected wit hthe 'TimeSeriesAggr' aggregator.
// It should output 1 when the temperature is over 3 degrees Celsius and 0 otherwise
var thresholdAggr = {
name: 'thresholdAggr1',
type: 'threshold',
store: 'Heat',
inAggr: 'TimeSeriesTickAggr',
threshold: 3
};
var expoMovingAverage = base.store("Heat").addStreamAggr(thresholdAggr);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateThreshold.name |
string |
|
The given name for the stream aggregator. |
|
StreamAggregateThreshold.type |
string |
|
The type of the stream aggregator. It must be equal to 'ema'. |
|
StreamAggregateThreshold.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateThreshold.inAggr |
string |
|
The name of the stream aggregator to which it connects and gets data. It cannot connect to the module:qm~StreamAggr_TimeSeriesWindow. |
|
StreamAggregateEMA.threshold |
string |
|
The threshold mentioned above. |
innerStreamAggregateTimeSeriesTick
module:qm.StreamAggr
This stream aggregator represents the time series tick window buffer. It exposes the data to other stream aggregators
(similar to module:qm~StreamAggr_TimeSeriesWindow). It implements the following methods:
module:qm.StreamAggr#getFloat returns the last value added in it's buffer.
module:qm.StreamAggr#getTimestamp returns the timestamp of the newest record in it's buffer.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Students",
fields: [
{ name: "Id", type: "float" },
{ name: "TimeOfGraduation", type: "datetime" }
]
}]
});
// create a new time series tick stream aggregator for the 'Students' store, that takes the values from the 'Id' field
// and the timestamp from the 'TimeOfGraduation' field.
var tick = {
name: 'TimeSeriesTickAggr',
type: 'timeSeriesTick',
store: 'Students',
timestamp: 'TimeOfGraduation',
value: 'Id',
};
var timeSeriesTick = base.store("Students").addStreamAggr(tick);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateTimeSeriesTick.name |
string |
|
The given name for the stream aggregator. |
|
StreamAggregateTimeSeriesTick.type |
string |
|
The type of the stream aggregator. It must be equal to 'timeSeriesTick'. |
|
StreamAggregateTimeSeriesTick.store |
string |
|
The name of the store from which it takes the data. |
|
StreamAggregateTimeSeriesTick.value |
string |
|
The name of the store field, from which it takes the values. |
|
StreamAggregateTimeSeriesTick.timestamp |
string |
|
The name of the store field, from which it takes the timestamp. |
innerStreamAggregateTimeSeriesWindow
module:qm.StreamAggr
This stream aggregator represents the time series window buffer. It stores the values inside a moving window. It implements all the methods of except module:qm.StreamAggr#getFloat, module:qm.StreamAggr#getTimestamp.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [
{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
// create a new time series stream aggregator for the 'Heat' store, that takes the values from the 'Celsius' field
// and the timestamp from the 'Time' field. The size of the window is 2 seconds (2000ms).
var aggr = {
name: 'TimeSeriesAggr',
type: 'timeSeriesWinBuf',
store: 'Heat',
timestamp: 'Time',
value: 'Celsius',
winsize: 2000
};
base.store("Heat").addStreamAggr(aggr);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateTimeSeriesWindow.name |
string |
|
The given name of the stream aggregator. |
|
StreamAggregateTimeSeriesWindow.type |
string |
|
The type of the stream aggregator. It must be equal to 'timeSeriesWinBuf'. |
|
StreamAggregateTimeSeriesWindow.store |
string |
|
The name of the store from which to takes the data. |
|
StreamAggregateTimeSeriesWindow.timestamp |
string |
|
The field of the store, where it takes the timestamp. |
|
StreamAggregateTimeSeriesWindow.value |
string |
|
The field of the store, where it takes the values. |
|
StreamAggregateTimeSeriesWindow.winsize |
number |
|
The size of the window, in milliseconds. |
|
StreamAggregateTimeSeriesWindow.delay |
number |
|
Delay in milliseconds. |
innerStreamAggregateTimeSeriesWindowVector
module:qm.StreamAggr
This stream aggregator represents the values read from a time series window buffer. It implements module:qm.StreamAggr#getFloatVector, module:qm.StreamAggr#getFloatAt, module:qm.StreamAggr#getFloatLength.
Example
// import the qm module
var qm = require('qminer');
// create a base with a simple store
var base = new qm.Base({
mode: "createClean",
schema: [{
name: "Heat",
fields: [
{ name: "Celsius", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
var store = base.store("Heat");
var tick = store.addStreamAggr({
type: 'timeSeriesTick',
timestamp: 'Time',
value: 'Celsius'
});
var winbufvec = store.addStreamAggr({
type: 'timeSeriesWinBufVector',
inAggr: tick.name,
winsize: 2000
});
store.push({ Time: '2015-06-10T14:13:32.0', Celsius: 1 });
winbufvec.getFloatVector().print(); // prints 1
store.push({ Time: '2015-06-10T14:33:30.0', Celsius: 2 });
winbufvec.getFloatVector().print(); // prints 2
store.push({ Time: '2015-06-10T14:33:31.0', Celsius: 3 });
winbufvec.getFloatVector().print(); // prints 2,3
store.push({ Time: '2015-06-10T14:33:32.0', Celsius: 4 });
winbufvec.getFloatVector().print(); // prints 2,3,4
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
StreamAggregateTimeSeriesWindowVector.name |
string |
|
The given name of the stream aggregator. |
|
StreamAggregateTimeSeriesWindowVector.type |
string |
|
The type of the stream aggregator. It must be equal to 'timeSeriesWinBuf'. |
|
StreamAggregateTimeSeriesWindowVector.store |
string |
|
The name of the store from which to takes the data. |
|
StreamAggregateTimeSeriesWindowVector.inAggr |
string |
|
The name of the window buffer aggregate that represents the input |
innerStreamAggregateVecDiff
module:qm.StreamAggr
This stream aggregator represents difference between two vectors (e.g. online histograms).
It implements the following methods:
module:qm.StreamAggr#getFloatLength returns the number of bins.
module:qm.StreamAggr#getFloatAt returns the count for a bin index.
module:qm.StreamAggr#getFloatVector returns the vector of counts, the length is equal to the number of bins.
Example
// import the qm module
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: "Rpm",
fields: [
{ name: "ClusterId", type: "float" },
{ name: "Time", type: "datetime" }
]
}]
});
var store = base.store('Rpm');
// create a new time series stream aggregator for the 'Rpm' store that takes the recorded cluster id
// and the timestamp from the 'Time' field. The size of the window is 4 weeks.
var timeser1 = {
name: 'TimeSeries1',
type: 'timeSeriesWinBuf',
store: 'Rpm',
timestamp: 'Time',
value: 'ClusterId',
winsize: 7200000 // 2 hours
};
var timeSeries1 = base.store("Rpm").addStreamAggr(timeser1);
// add a histogram aggregator, that is connected with the 'TimeSeries1' aggregator
var aggrJson1 = {
name: 'Histogram1',
type: 'onlineHistogram',
store: 'Rpm',
inAggr: 'TimeSeries1',
lowerBound: 0,
upperBound: 5,
bins: 5,
addNegInf: false,
addPosInf: false
};
var hist1 = base.store("Rpm").addStreamAggr(aggrJson1);
// create a new time series stream aggregator for the 'Rpm' store that takes the recorded cluster id
// and the timestamp from the 'Time' field.
var timeser2 = {
name: 'TimeSeries2',
type: 'timeSeriesWinBuf',
store: 'Rpm',
timestamp: 'Time',
value: 'ClusterId',
winsize: 21600000 // 6 hours
};
var timeSeries2 = base.store("Rpm").addStreamAggr(timeser2);
// add a histogram aggregator, that is connected with the 'TimeSeries1' aggregator
var aggrJson2 = {
name: 'Histogram2',
type: 'onlineHistogram',
store: 'Rpm',
inAggr: 'TimeSeries2',
lowerBound: 0,
upperBound: 5,
bins: 5,
addNegInf: false,
addPosInf: false
};
var hist2 = base.store("Rpm").addStreamAggr(aggrJson2);
// add diff aggregator that subtracts Histogram1 with 2h window from Histogram2 with 6h window
var aggrJson3 = {
name: 'DiffAggr',
type: 'onlineVecDiff',
storeX: 'Rpm',
storeY: 'Rpm',
inAggrX: 'Histogram2',
inAggrY: 'Histogram1'
}
var diff = store.addStreamAggr(aggrJson3);
base.close();
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
name |
string |
|
The given name of the stream aggregator. |
|
type |
string |
|
The type for the stream aggregator. It must be equal to 'onlineVecDiff'. |
|
storeX |
string |
|
The name of the store from which it takes the data for the first vector. |
|
storeY |
string |
|
The name of the store from which it takes the data for the second vector. |
|
inAggrX |
string |
|
The name of the first stream aggregator to which it connects and gets data. |
|
inAggrY |
string |
|
The name of the second stream aggregator to which it connects and gets data. |
innerStreamAggregators
module:qm.StreamAggr
Stream aggregator types.
Properties
| Name | Type | Optional | Description |
|---|---|---|---|
|
timeSeries |
|
The time series type. |
|
|
timeSeriesBufferVector |
|
The time series buffer vector type. |
|
|
recordBuffer |
|
The record buffer type. |
|
|
sum |
|
The sum type. |
|
|
min |
|
The minimal type. |
|
|
max |
|
The maximal type. |
|
|
sum |
|
The sparse-vector-sum type. |
|
|
tick |
|
The time series tick type. |
|
|
ma |
|
The moving average type. |
|
|
ema |
|
The exponental moving average type. |
|
|
ema |
|
The exponental moving average for sparse vectors type. |
|
|
var |
|
The moving variance type. |
|
|
cov |
|
The moving covariance type. |
|
|
cor |
|
The moving correlation type. |
|
|
res |
|
The resampler type. |
|
|
mer |
|
The merger type. |
|
|
hist |
|
The online histogram type. |
|
|
slotted-hist |
|
The online slotted-histogram type. |
|
|
vec-diff |
|
The difference of two vectors (e.g. online histograms) type. |
|
|
linReg |
|
The linear regressor type. |


---
layout: archive
title: Lean Prover Zulip Chat Archive
permalink: 113488general/71836partialorderwithbotXissounrflly.html
---
The archive URL format has changed. Please find this page at:
https://leanprover-community.github.io/archive/stream/113488-general/topic/partial_order.20(with_bot.20X).20is.20so.20unrflly.html


MY NAME IS VALENS
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHUUUUUUUUU JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
© &UNORDERD LIST
DEFINITION LIST


A client can stack a set of requests in a single HTTP round trip by POSTing to:
/api/ServiceController/latest
with a series of <request> objects like so:
where
- The <requests> object is mandatory.
- There is a single <request> element per stacked request.
- #{order} is the string serial or parallel:
- #{order} indicates if the server can run the requests in parallel or not.
- The default #{order} if not specified is serial.
- #{onerror} is the string stop or continue:
- #{onerror} indicates the server behavior if it encounters an error in a serial stacked request.
- If the value is stop, then for a serial stacked request, the
server MUST NOT execute any results after a request that returns an error, but
MUST return all of the results up to and including the result that generated the error.
- The default #{onerror} if not specified is stop for serial requests.
- #{onerror} should be completely ignored for parallel requests.


Debate only on margin, BJP will win all 15 seats: CM
by DHNSChief Minister B S Yediyurappa on Sunday said the party would win all the 15 seats and the victory margin of BJP candidates would be the matter of debate in the December 5 Assembly bypolls.
"With a deep sense of responsibility, I am saying that we will win all the 15 seats. The matter of debate, however, is the difference of votes with which the BJP candidates will win the by-elections," he said at an election rally at Banavasi in Uttara Kannada district.
Yediyurappa was in Banavasi to campaign for BJP candidate Shivaram Hebbar, who was previously elected from the Congress, but resigned from the Assembly and was subsequently disqualified by then speaker K R Ramesh Kumar.
After the Supreme Court allowed the disqualified MLAs to contest the bypolls, Hebbar joined the BJP and is contesting from Yellapur.
Addressing the gathering, Yediyurappa acknowledged the 'sacrifice' of the 17 MLAs whose resignation led to the fall of Congress-JD(S) coalition government in July this year and paved the way for BJP to come to power in the state.
"If these 17 people had not resigned from the assembly, neither I would have had the opportunity to speak to you as the chief minister, nor Kota Srinivasa Poojary or Govind Karjol would have become ministers," he said.
"Dejected with the lack of development in their government, they came out (of their parties)," Yediyurappa said.


The species name of a piscine (fish) patient.
A profile on the Practitioner resource for veterinarians. In the US, vets do not have National Provider Numbers.
A patient at Aquatic Veterinary Services.


What is Tuple?
A tuple is a collection of objects which ordered and immutable. Tuples are sequences, just like lists. The differences between tuples and lists are mutable, the tuples are immutable it means cannot be changed unlike lists and tuples
use parentheses, whereas lists use square brackets.You can access tuple items by referring to the index number, inside square brackets.
tuple1 = () //Empty Tuple tuple2 = ('Hello') //Tuple Item tuple3 = ('Green','Blue','Purple') //Tuple Items
Tuple advantages over list
- Program execution is faster when manipulating a tuple than it is for the equivalent list.
- Sometimes you don’t want data to be modified. If the values in the collection are meant to remain constant for the life of the program, using a tuple instead of a list guards against accidental modification.
- There is another Python data type that you will encounter shortly called a dictionary, which requires as one of its components a value that is of an immutable type. A tuple can be used for this purpose, whereas a list can’t be.
Basic Operations of Tuple
| Python Expression | Result | Operation |
|---|---|---|
| (1,2,3)+(8,9,9) |
(1,2,3,8,9,9) | Concatenation |
| len((4,5,6)) | 3 | Length |
| 7 in (1,4,7) | True | Membership |
| for n in(1,3,5): print(n) | 1,3,5 | Iteration |
Built-In function of Tuple
| Function | Description |
|---|---|
cmp(tuple1, tuple2) |
It compares two tuples and returns true if tuple1 is greater than tuple2 otherwise false. |
len(tuple) |
It calculates the length of the tuple. |
max(tuple) |
It returns the maximum element of the tuple. |
min(tuple) |
It returns the minimum element of the tuple. |
tuple(seq) |
It converts the specified sequence to the tuple. |
I hope you learned something new today and share it with your peers. Who knows it may be helpful for someone else.
I case you want to learn more about Set Click Here for some practical knowledge.


Reschedule Loan Account
Reschedule From Installment On
Reason For Rescheduling
Submitted On
Comment
Change Repayment Date ?
Installment Rescheduled To
Introduce Grace Period ?
Principle Grace Period
Interest Grace Period
Extend Repayment Period ?
Number Of New Repayment
Adjust Interest Rate ?
New Interest Rate


Command Name
- followed by More Descriptive
Command Titlecommandname [ options ] [ sourcefiles ] [ classes ] [ @argfiles ]
For example, you could introduce items like the following, as required.
Generally, what does a user do with this tool?
For what purpose was this tool developed?
You could state general differences in use/functionality for each OS (operating system) we support.
Place your introduction here. Then, if you have different categories of options, use multiple level 3 headings to create sub-sections as necessary. Options should be listed alphabetically within a sub-section.
Following are a few option examples from the
jconsole
and apt
man pages. They are
divided into three sub-sections, just to give an example of what
sub-sections look like.
jconsole
Options-interval
=n-notile
-pluginpath
pluginsMETA-INF/services/com.sun.tools.jconsole.JConsolePlugin
containing one line for each plugin specifying the fully qualified class name of the class implementing the com.sun.tools.jconsole.JConsolePlugin class.
-version
-help
-J<flag>
apt
Specific Options-s
dir-nocompile
-print
-A
[key[=
val]]apt
directly, but are made available
for use by individual processors-factorypath
path-factory
classnameapt
Options shared with javac
-d
dir-cp
path or -classpath
path-factorypath
is given, the classpath is
not searched for factories.Consult the javac(1) man page for information on
javac
options.
Use this section to briefly mention some common ways a developer might use this tool.
Here are some examples of starting jstatd. Note that the jstatd scripts automatically start the server in the background.
This example demonstrates starting jstatd with an internal RMI registry. This example assumes that no other server is bound to the default RMI Registry port (port 1099).
jstatd -J-Djava.security.policy=all.policy
This example demonstrates starting jstatd with a external RMI registry.
rmiregistry& jstatd -J-Djava.security.policy=all.policy
This example demonstrates starting jstatd with an external RMI registry server on port 2020.
rmiregistry 2020& jstatd -J-Djava.security.policy=all.policy -p 2020
This example demonstrates starting jstatd with an external RMI registry on port 2020, bound to name AlternateJstatdServerName.
rmiregistry 2020& jstatd -J-Djava.security.policy=all.policy -p 2020 -n AlternateJstatdServerName
This example demonstrates starting jstatd such that it will not create a RMI registry if one is not found. This example assumes an RMI registry is already running. If it is not, an appropriate error message is emitted.
jstatd -J-Djava.security.policy=all.policy -nr
This example demonstrates starting jstatd with RMI logging capabilities enabled. This technique is useful as a troubleshooting aid or for monitoring server activities.
jstatd -J-Djava.security.policy=all.policy -J-Djava.rmi.server.logCalls=true
Following is a SEE ALSO section taken from the
jstatd
man page.