91 lines
1.8 KiB
Plaintext
91 lines
1.8 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 59,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import seaborn as sns\n",
|
|
"import pandas as pd\n",
|
|
"import numpy as np\n",
|
|
"from matplotlib import pyplot as plt\n",
|
|
"from sklearn import linear_model\n",
|
|
"from sklearn.metrics import classification_report as summary\n",
|
|
"\n",
|
|
"sns.set()\n",
|
|
"sns.set(style=\"whitegrid\")\n",
|
|
"tips = sns.load_dataset(\"tips\")\n",
|
|
"plt.rcParams[\"figure.figsize\"] = (5,8)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 66,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"Boston = pd.read_csv(\"../../datasets/Boston.csv\")\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 67,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[-0.95004935] 34.5538408793831\n",
|
|
"0.5441462975864797\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"X = np.array(Boston[\"lstat\"]).reshape(-1,1)\n",
|
|
"y = Boston[\"medv\"]\n",
|
|
"model = linear_model.LinearRegression()\n",
|
|
"model.fit(X, y)\n",
|
|
"print(model.coef_, model.intercept_)\n",
|
|
"print(model.score(X,y))\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.2"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|