Obtenir y_hat, ou valeurs prévues de y basées sur x_values

//Get y_hat, or predicted values of y based on x_values
//Loop through x_values, and run the elements through the lr equation to get predictions
var y_hat = [];
for(i=0; i<x_values.length; i++){
  console.log(x_values[i])
  y_hat.push(x_values[i]*regressor['slope']+regressor['intercept']);
}

//Add to regressor object
regressor['y_hat'] = y_hat;
Clean Caterpillar