📜  创建回归器对象以存储方程的数据 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:28.604000             🧑  作者: Mango

代码示例1
//Create the regressor object to store the equation's data
var regressor = {};

//Set variables we'll need to get the slope and intercept; we need to find the equation in the format y = m*x+b where m is the slope and b is the intercept
var x_mean = x_values.reduce((a, b) => a + b, 0)/x_values.length;
var y_mean = y_values.reduce((a, b) => a + b, 0)/y_values.length;