Skip to content

Commit

Permalink
Fix: simplified initialization for the LinearRegression() and fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkFischinger committed Apr 8, 2024
1 parent c39779e commit 8207db9
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,7 @@
"source": [
"def modelEval(ytest, yPreds):\n",
" print(\"\\n---- Evaluation Metrics ----\")\n",
" print(f\"Mean Absoulte Error: {np.mean(np.abs(yPreds - ytest)):.2f}\")\n",
" print(f\"Mean Absolute Error: {np.mean(np.abs(yPreds - ytest)):.2f}\")\n",
" print(f\"Mean Squared Error: {np.mean(np.power(yPreds - ytest, 2)):.2f}\")\n",
" print(f\"Root Mean Squared Error: {np.sqrt(np.mean(np.power(yPreds - ytest, 2))):.2f}\")\n",
" print(f\"R2 score: {r2score(ytest, yPreds):.2f}\")"
Expand Down Expand Up @@ -2143,7 +2143,7 @@
}
],
"source": [
"model = mlpack.LinearRegression(check_input_matrices=False, copy_all_inputs=False, lambda_=0.0, verbose=False)\n",
"model = mlpack.LinearRegression()\n",
"\n",
"k = 5\n",
"kf = KFold(n_splits = k, random_state = None)\n",
Expand Down Expand Up @@ -2173,7 +2173,7 @@
" modelEval(y_test, yPredsLr)\n",
"\n",
"print(\"\\n-- Mean Evaluation Metrics --\")\n",
"print(f\"Mean Absoulte Error: {np.mean(mae_score):.2f}\")\n",
"print(f\"Mean Absolute Error: {np.mean(mae_score):.2f}\")\n",
"print(f\"Mean Squared Error: {np.mean(mse_score):.2f}\")\n",
"print(f\"Root Mean Squared Error: {np.mean(rmse_score):.2f}\")\n",
"print(f\"R2 score: {np.mean(r2_score):.2f}\")"
Expand Down Expand Up @@ -2255,7 +2255,7 @@
}
],
"source": [
"model = mlpack.LinearRegression(check_input_matrices=False, copy_all_inputs=False, lambda_=0.1, verbose=False)\n",
"model = mlpack.LinearRegression()\n",
"\n",
"k = 5\n",
"kf = KFold(n_splits = k, random_state = None)\n",
Expand Down Expand Up @@ -2285,7 +2285,7 @@
" modelEval(y_test, yPredsRr)\n",
"\n",
"print(\"\\n-- Mean Evaluation Metrics --\")\n",
"print(f\"Mean Absoulte Error: {np.mean(mae_score):.2f}\")\n",
"print(f\"Mean Absolute Error: {np.mean(mae_score):.2f}\")\n",
"print(f\"Mean Squared Error: {np.mean(mse_score):.2f}\")\n",
"print(f\"Root Mean Squared Error: {np.mean(rmse_score):.2f}\")\n",
"print(f\"R2 score: {np.mean(r2_score):.2f}\")"
Expand Down Expand Up @@ -2397,7 +2397,7 @@
" modelEval(y_test, yPredsBlr)\n",
"\n",
"print(\"\\n-- Mean Evaluation Metrics --\")\n",
"print(f\"Mean Absoulte Error: {np.mean(mae_score):.2f}\")\n",
"print(f\"Mean Absolute Error: {np.mean(mae_score):.2f}\")\n",
"print(f\"Mean Squared Error: {np.mean(mse_score):.2f}\")\n",
"print(f\"Root Mean Squared Error: {np.mean(rmse_score):.2f}\")\n",
"print(f\"R2 score: {np.mean(r2_score):.2f}\")"
Expand Down

0 comments on commit 8207db9

Please sign in to comment.