Skip to content

Instantly share code, notes, and snippets.

@dataprofessor
Created August 15, 2020 03:44
Show Gist options
  • Select an option

  • Save dataprofessor/dfeac2d6361c00ec6650039af329bd58 to your computer and use it in GitHub Desktop.

Select an option

Save dataprofessor/dfeac2d6361c00ec6650039af329bd58 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "05_model_predicts_training_set.ipynb",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "code",
"metadata": {
"id": "tZr9CBGvRp1F",
"colab_type": "code",
"colab": {}
},
"source": [
"Y_pred_train = model.predict(X_train)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "0x3saPCyRtJP",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 85
},
"outputId": "68235d8c-e66a-4acb-e4d3-83ef26e92629"
},
"source": [
"print('Coefficients:', model.coef_)\n",
"print('Intercept:', model.intercept_)\n",
"print('Mean squared error (MSE): %.2f'\n",
" % mean_squared_error(Y_train, Y_pred_train))\n",
"print('Coefficient of determination (R^2): %.2f'\n",
" % r2_score(Y_train, Y_pred_train))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"Coefficients: [-0.76779153 -0.00668131 0.00654032 -0.36959403]\n",
"Intercept: 0.3108998121270652\n",
"Mean squared error (MSE): 1.01\n",
"Coefficient of determination (R^2): 0.77\n"
],
"name": "stdout"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment