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
Data is passed into the model as an array. A second parameter can be used to configure the model. The configuration parameter is optional. null values are ignored. The precision option will set the number of significant figures the output is rounded to.
Configuration options
Below are the default values for the configuration parameter.
{order: 2,precision: 2,}
Properties
equation: an array containing the coefficients of the equation
string: A string representation of the equation
points: an array containing the predicted data in the domain of the input
r2: the coefficient of determination (R2)
predict(x): This function will return the predicted value
API
regression.linear(data[, options])
Fits the input data to a straight line with the equation . It returns the coefficients in the form [m, c].
regression.exponential(data[, options])
Fits the input data to a exponential curve with the equation . It returns the coefficients in the form [a, b].
regression.logarithmic(data[, options])
Fits the input data to a logarithmic curve with the equation . It returns the coefficients in the form [a, b].
regression.power(data[, options])
Fits the input data to a power law curve with the equation . It returns the coefficients in the form [a, b].
regression.polynomial(data[, options])
Fits the input data to a polynomial curve with the equation . It returns the coefficients in the form [an..., a1, a0]. The order can be configure with the order option.