Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save dataprofessor/f5303fdaa22362ca563b2b8e5314cda1 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": "06_model_predicts_test_set.ipynb",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "code",
"metadata": {
"id": "I_eFbrlaHhPU",
"colab_type": "code",
"colab": {}
},
"source": [
"Y_pred_test = model.predict(X_test)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "TQnDfyl5HkUr",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 85
},
"outputId": "32b22212-424a-458f-8f0f-57095f5903ec"
},
"source": [
"print('Coefficients:', model.coef_)\n",
"print('Intercept:', model.intercept_)\n",
"print('Mean squared error (MSE): %.2f'\n",
" % mean_squared_error(Y_test, Y_pred_test))\n",
"print('Coefficient of determination (R^2): %.2f'\n",
" % r2_score(Y_test, Y_pred_test))"
],
"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.00\n",
"Coefficient of determination (R^2): 0.74\n"
],
"name": "stdout"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment