You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[model.nGramMax]|`int`|`1`| Maximum n-gram size |
24
-
|[model.minimumConfidence]|`int`\|`float`|`0.2`| Minimum confidence required for predictions |
25
24
|[model.vocabulary]|`Array`\|`Set`\|`false`|`[]`| Terms mapped to indexes in the model data, set to `false` to store terms directly in the data entries |
26
25
|[model.data]|`Object`|`{}`| Key-value store of labels and training data vectors |
27
26
@@ -49,7 +48,7 @@ Return an array of one or more Prediction instances
49
48
| --- | --- | --- | --- |
50
49
| input |`string`|| Input string to make a prediction from |
51
50
|[maxMatches]|`int`|`1`| Maximum number of predictions to return |
52
-
|[minimumConfidence]|`float`|`null`| Minimum confidence required to include a prediction |
51
+
|[minimumConfidence]|`float`|`0.2`| Minimum confidence required to include a prediction |
|[config.nGramMax]|`int`|`1`| Maximum n-gram size |
23
-
|[config.minimumConfidence]|`int`\|`float`|`0.2`| Minimum confidence required for predictions |
24
22
|[config.vocabulary]|`Array`\|`Set`\|`false`|`[]`| Terms mapped to indexes in the model data entries, set to false to store terms directly in the data entries |
25
23
|[config.data]|`Object`|`{}`| Key-value store containing all training data |
26
24
@@ -34,11 +32,6 @@ Minimum n-gram size
34
32
### model.nGramMax : `int`
35
33
Maximum n-gram size
36
34
37
-
<aname="Model+minimumConfidence"></a>
38
-
39
-
### model.minimumConfidence : `float`
40
-
Minimum confidence required for predictions
41
-
42
35
<aname="Model+vocabulary"></a>
43
36
44
37
### model.vocabulary : `Vocabulary`\|`false`
@@ -52,7 +45,6 @@ Model data
52
45
<aname="Model+serialize"></a>
53
46
54
47
### model.serialize() ⇒ `Object`
55
-
Return the model in its current state for storing, including the configured
56
-
n-gram min/max values, the minimum confidence required for for predictions,
57
-
the vocabulary as an array (if any, otherwise false), and an object literal
58
-
with all the training data
48
+
Return the model in its current state an an object literal, including the
49
+
configured n-gram min/max values, the vocabulary as an array (if any,
50
+
otherwise false), and an object literal with all the training data
* @param {int} [model.nGramMax=1] - Maximum n-gram size
9
-
* @param {(int|float)} [model.minimumConfidence=0.2] - Minimum confidence required for predictions
10
9
* @param {(Array|Set|false)} [model.vocabulary=[]] - Terms mapped to indexes in the model data entries, set to false to store terms directly in the data entries
11
10
* @param {Object} [model.data={}] - Key-value store containing all training data
12
11
* @constructor
@@ -94,24 +93,32 @@ class Classifier {
94
93
*
95
94
* @param {string} input - Input string to make a prediction from
96
95
* @param {int} [maxMatches=1] Maximum number of predictions to return
97
-
* @param {float} [minimumConfidence=null] Minimum confidence required to include a prediction
96
+
* @param {float} [minimumConfidence=0.2] Minimum confidence required to include a prediction
* @param {int} [config.nGramMax=1] - Maximum n-gram size
7
-
* @param {(int|float)} [config.minimumConfidence=0.2] - Minimum confidence required for predictions
8
7
* @param {(Array|Set|false)} [config.vocabulary=[]] - Terms mapped to indexes in the model data entries, set to false to store terms directly in the data entries
9
8
* @param {Object} [config.data={}] - Key-value store containing all training data
10
9
* @constructor
@@ -18,7 +17,6 @@ class Model {
18
17
config={
19
18
nGramMin: 1,
20
19
nGramMax: 1,
21
-
minimumConfidence: 0.2,
22
20
vocabulary: [],
23
21
data: {},
24
22
...config
@@ -40,18 +38,6 @@ class Model {
40
38
thrownewError('Config value nGramMax must be at least 1')
41
39
}
42
40
43
-
if(typeofconfig.minimumConfidence!=='number'){
44
-
thrownewError('Config value minimumConfidence must be a number')
45
-
}
46
-
47
-
if(config.minimumConfidence<0){
48
-
thrownewError('Config value minimumConfidence can not be lower than 0')
49
-
}
50
-
51
-
if(config.minimumConfidence>1){
52
-
thrownewError('Config value minimumConfidence can not be higher than 1')
53
-
}
54
-
55
41
if(config.nGramMax<config.nGramMin){
56
42
thrownewError('Invalid nGramMin/nGramMax combination in config')
57
43
}
@@ -66,7 +52,6 @@ class Model {
66
52
67
53
this._nGramMin=config.nGramMin
68
54
this._nGramMax=config.nGramMax
69
-
this._minimumConfidence=config.minimumConfidence
70
55
this._vocabulary=config.vocabulary
71
56
this._data={...config.data}
72
57
}
@@ -105,31 +90,6 @@ class Model {
105
90
this._nGramMax=size
106
91
}
107
92
108
-
/**
109
-
* Minimum confidence required for predictions
110
-
*
111
-
* @type {float}
112
-
*/
113
-
getminimumConfidence(){
114
-
returnthis._minimumConfidence
115
-
}
116
-
117
-
setminimumConfidence(confidence){
118
-
if(typeofconfidence!=='number'){
119
-
thrownewError('minimumConfidence must be a number')
120
-
}
121
-
122
-
if(confidence<0){
123
-
thrownewError('minimumConfidence can not be lower than 0')
124
-
}
125
-
126
-
if(confidence>1){
127
-
thrownewError('minimumConfidence can not be higher than 1')
128
-
}
129
-
130
-
this._minimumConfidence=confidence
131
-
}
132
-
133
93
/**
134
94
* Vocabulary instance
135
95
*
@@ -165,18 +125,16 @@ class Model {
165
125
}
166
126
167
127
/**
168
-
* Return the model in its current state for storing, including the configured
169
-
* n-gram min/max values, the minimum confidence required for for predictions,
170
-
* the vocabulary as an array (if any, otherwise false),and an object literal
171
-
* with all the training data
128
+
* Return the model in its current state an an object literal, including the
129
+
* configured n-gram min/max values, the vocabulary as an array (if any,
130
+
* otherwise false), and an object literal with all the training data
0 commit comments