Skip to content

Commit

Permalink
Correction to slope aadn intercept value
Browse files Browse the repository at this point in the history
  • Loading branch information
ArifAhmed1995 authored May 24, 2018
1 parent 1301f8f commit c1eed02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Week 3/Week 3 - Practice Assigment Solutions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
"y_sum = sum(y_i)\n",
"x_squared_sum = sum([x_coord**2 for x_coord in x_i])\n",
"\n",
"denom = n * x_squared_sum + x_sum ** 2\n",
"denom = n * x_squared_sum - x_sum ** 2\n",
"\n",
"if denom != 0:\n",
" slope = (n * product_sum + x_sum * y_sum) / denom\n",
" slope = (n * product_sum - x_sum * y_sum) / denom\n",
" y_intercept = y_sum / n - slope * x_sum / n\n",
" best_fit_y = [slope * x + y_intercept for x in x_i]\n",
" print(\"The best fit line is : \", \" y = \", slope, \"x + \", y_intercept)\n",
Expand Down

1 comment on commit c1eed02

@mukkachaitanya
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice !

Please sign in to comment.