{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Quick regression example",
"provenance": [],
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "R5ApiQ53zuc1",
"colab_type": "text"
},
"source": [
"# Regression\n",
"\n",
"We'll use the famous [Boston house prices](https://www.cs.toronto.edu/~delve/data/boston/bostonDetail.html) dataset."
]
},
{
"cell_type": "code",
"metadata": {
"id": "IuDW61LQ7FHJ",
"colab_type": "code",
"outputId": "cfb1c567-46c9-42c3-f16f-78bef344db0b",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
}
},
"source": [
"import pandas as pd\n",
"from sklearn.datasets import load_boston\n",
"\n",
"boston = load_boston()\n",
"df = pd.DataFrame(boston['data'], columns=boston['feature_names'])\n",
"df.head()"
],
"execution_count": 1,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"
| \n", " | CRIM | \n", "ZN | \n", "INDUS | \n", "CHAS | \n", "NOX | \n", "RM | \n", "AGE | \n", "DIS | \n", "RAD | \n", "TAX | \n", "PTRATIO | \n", "B | \n", "LSTAT | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0.00632 | \n", "18.0 | \n", "2.31 | \n", "0.0 | \n", "0.538 | \n", "6.575 | \n", "65.2 | \n", "4.0900 | \n", "1.0 | \n", "296.0 | \n", "15.3 | \n", "396.90 | \n", "4.98 | \n", "
| 1 | \n", "0.02731 | \n", "0.0 | \n", "7.07 | \n", "0.0 | \n", "0.469 | \n", "6.421 | \n", "78.9 | \n", "4.9671 | \n", "2.0 | \n", "242.0 | \n", "17.8 | \n", "396.90 | \n", "9.14 | \n", "
| 2 | \n", "0.02729 | \n", "0.0 | \n", "7.07 | \n", "0.0 | \n", "0.469 | \n", "7.185 | \n", "61.1 | \n", "4.9671 | \n", "2.0 | \n", "242.0 | \n", "17.8 | \n", "392.83 | \n", "4.03 | \n", "
| 3 | \n", "0.03237 | \n", "0.0 | \n", "2.18 | \n", "0.0 | \n", "0.458 | \n", "6.998 | \n", "45.8 | \n", "6.0622 | \n", "3.0 | \n", "222.0 | \n", "18.7 | \n", "394.63 | \n", "2.94 | \n", "
| 4 | \n", "0.06905 | \n", "0.0 | \n", "2.18 | \n", "0.0 | \n", "0.458 | \n", "7.147 | \n", "54.2 | \n", "6.0622 | \n", "3.0 | \n", "222.0 | \n", "18.7 | \n", "396.90 | \n", "5.33 | \n", "