Functions of this type do a lookup in a stats table trained with the
statsTable.bagOfWords.train
procedure type and return
the probability of outcome for each of the words provided as input.
A new function of type statsTable.bagOfWords.posneg
named <id>
can be created as follows:
mldb.put("/v1/functions/"+<id>, {
"type": "statsTable.bagOfWords.posneg",
"params": {
"numPos": <int>,
"numNeg": <int>,
"minTrials": <int>,
"outcomeToUse": <string>,
"statsTableFileUrl": <Url>
}
})
with the following key-value definitions for params
:
Field, Type, Default | Description |
---|---|
numPos | Number of top positive words to use |
numNeg | Number of top negative words to use |
minTrials | Minimum number of trials a word needs to have in order to be considered |
outcomeToUse | This must be one of the outcomes the stats table was trained with. |
statsTableFileUrl | URL of the model file (with extension '.st') to load. This file is created by the |
Functions of this type have a single input value named words
which is a row.
Functions of this type have a single output value named probs
which is also a row.
The row will contain P(outcome | word) for each valid word given the function configuration.
statsTable.bagOfWords.train
procedure type trains a bag of words stats table.