Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Get y_hat, or predicted values of y based on 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;
Source by gist.githubusercontent.com #
 
PREVIOUS NEXT
Tagged: #Get #predicted #values #based
ADD COMMENT
Topic
Name
7+1 =