The LinearRegression
is a Coral Actor which calculates the outcome variable based on a linear combination of input variables. For example, it can calculate the outcome variable if the formula is as follows:
Y = a + bX + cY + dZ
X, Y and Z are provided in the trigger JSON, while a, b, c and d are coefficients which are given in the constructor of this actor.
The LinearRegressionActor 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 (a). |
outcome |
string | no | The name of the outcome variable to use. If not provided, “score” is used. |
In this model, the formula becomes as follows:
creditscore = 3.972 + 0.47353 * salary + 1.86766 * tnxcount1month + 4.52352 * age
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:
Based on this input object, the LinearRegressionActor would calculate the following:
The score that is calculated is
creditscore = 3.972 + (0.47353 * 3000) + (1.86766 * 25) + (4.52352 * 30) = 1606.9591.
The LinearRegressionActor
enriches the received trigger JSON with the predicted score and emits it. It looks like the following:
The LinearRegressionActor
does not keep any state.
The LinearRegressionActor
does not collect state from other actors.
The LinearRegressionActor
does not provide timer actions.