The LinearRegression
is a Coral Actor which performs prediction on the streaming data, based on the behavior of past observations.
The creation JSON of the LinearRegression actor (see Coral Actor) has "type": "linearregression"
.
The params
value contains the following fields:
field | type | required | description |
---|---|---|---|
weights |
JObject | yes | An object containing the feature names and coefficients of the model. |
intercept |
Double | yes | The intercept of the linear regression model. |
{
"data": {
"type": "actors",
"attributes": {
"type": "linearregression",
"params": {
"intercept": 3.972,
"weights": {
"salary": 0.47353,
"tnxcount1month": 1.86766,
"age": 4.52352
}
}
}
}
}
The LinearRegressionActor
accepts JSON objects that contain the fields that were defined in the constructor.
An example of a JSON object that comes in is as follows:
{
"salary": 3000,
"tnxcount1month": 25,
"age": 30
}
Based on this input object, the LinearRegressionActor would calculate the following:
The score that is calculated is intercept + weightSalary * salary + weightTnxcount1month * tnxcount1month + weightAge * age, which is 3.972 + 0.47353 * 3000 + 1.86766 * 25 + 4.52352 * 30, which is 1606,9591.
The LinearRegressionActor
enriches the received trigger JSON with the predicted score and emits it. It looks like the following:
{
"salary": 3000,
"tnxcount1month": 25,
"age": 30,
"score": 1606.9591
}
The LinearRegressionActor
does not keep any state.
The LinearRegressionActor
does not collect state from other actors.
The LinearRegressionActor
does not provide timer actions.