diff --git a/stackoverflow-survey.ipynb b/stackoverflow-survey.ipynb index 5f514c4..c6edf5d 100644 --- a/stackoverflow-survey.ipynb +++ b/stackoverflow-survey.ipynb @@ -178,19 +178,20 @@ "\n", " model.fit(X_train, y_train)\n", " y_pred = model.predict(X_test)\n", - "\n", + " \n", + " m = model.coef_[0][0]\n", + " b = model.intercept_[0]\n", " print(\"+----------------------+\")\n", " print(\"%s regression line for %s\" % (line_color, self.language))\n", - " print(\"coefficient =\", model.coef_)\n", - " print('intercept=', model.intercept_)\n", + " print(\"coefficient = %0.2f\" % m)\n", + " print('intercept = %0.2f' % b)\n", " rmse = root_mean_squared_error(y_test, y_pred)\n", - " print(\"rmse = \", rmse)\n", + " print(\"rmse = %0.2f\" % rmse)\n", " r2 = r2_score(y_test, y_pred)\n", - " print(\"r2 score = \", r2)\n", + " print(\"r2 score = %0.2f\" % r2)\n", " print(\"sample predictions:\")\n", " print(y_pred[3:6])\n", " print(\"+----------------------+\")\n", - " b = model.intercept_[0]\n", "\n", " plt.figure(self.canvas)\n", " plt.plot(X_test, y_pred, color=line_color, label='Regression Line')\n", @@ -247,7 +248,7 @@ "\n", "* The income of a data professional can either increase by 2,000 per year (red) or 10,000 per year (cyan).\n", "\n", - "* For both models, the r2 score ranges from poor to moderate = 0.20 - 0.37 depending on the random number. The variability not explained by the model could be the result of the fields such as advertising, finance, or bio/medical technology.\n", + "* For both models, the r2 score ranges from poor to moderate = 0.20 - 0.37 depending on the random number. The variability not explained by the model could be the result of different fields that employ dats scientists/analysts/engineers such as finance, bio/med, or advertising.\n", "\n", "* For any given point in the career, the model is off by 39,000 or 42,000 dollars.\n", "\n",