Commit 1edfd96d authored by vincentvigon's avatar vincentvigon

markov fini

parent 7da51ea7
No preview for this file type
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -612,10 +612,10 @@
}
],
"source": [
"xt=np.loadtxt(\"data/accident_exposure_x.csv\")\n",
"xt=np.loadtxt(\"data/dataGLM/accident_exposure_x.csv\")\n",
"x=xt[:,0] #indice fangio\n",
"t=xt[:,1] #exposition\n",
"y=np.loadtxt(\"data/accident_exposure_y.csv\")\n",
"y=np.loadtxt(\"data/dataGLM/accident_exposure_y.csv\")\n",
"plt.plot(t,y,'.');"
]
},
......@@ -730,7 +730,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 22,
"metadata": {},
"outputs": [
{
......@@ -756,8 +756,8 @@
}
],
"source": [
"x=np.loadtxt(\"data/bacteria_alone_x.csv\")\n",
"y=np.loadtxt(\"data/bacteria_alone_y.csv\")\n",
"x=np.loadtxt(\"data/dataGLM/bacteria_alone_x.csv\")\n",
"y=np.loadtxt(\"data/dataGLM/bacteria_alone_y.csv\")\n",
"\n",
"print(\"matrice des inputs (transposée)\")\n",
"print(x[:10].T)\n",
......@@ -789,7 +789,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 23,
"metadata": {},
"outputs": [
{
......@@ -816,7 +816,7 @@
" <th>Date:</th> <td>Mon, 18 Jun 2018</td> <th> Deviance: </th> <td> 341.63</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Time:</th> <td>15:01:05</td> <th> Pearson chi2: </th> <td> 889.</td> \n",
" <th>Time:</th> <td>16:02:48</td> <th> Pearson chi2: </th> <td> 889.</td> \n",
"</tr>\n",
"<tr>\n",
" <th>No. Iterations:</th> <td>8</td> <th> Covariance Type: </th> <td>nonrobust</td>\n",
......@@ -848,7 +848,7 @@
"Link Function: logit Scale: 1.0000\n",
"Method: IRLS Log-Likelihood: -170.81\n",
"Date: Mon, 18 Jun 2018 Deviance: 341.63\n",
"Time: 15:01:05 Pearson chi2: 889.\n",
"Time: 16:02:48 Pearson chi2: 889.\n",
"No. Iterations: 8 Covariance Type: nonrobust\n",
"==============================================================================\n",
" coef std err z P>|z| [0.025 0.975]\n",
......@@ -860,7 +860,7 @@
"\"\"\""
]
},
"execution_count": 22,
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
......@@ -923,7 +923,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 25,
"metadata": {},
"outputs": [
{
......@@ -940,8 +940,8 @@
}
],
"source": [
"x=np.loadtxt(\"data/bacteria_grouped_x.csv\")\n",
"y=np.loadtxt(\"data/bacteria_grouped_y.csv\")\n",
"x=np.loadtxt(\"data/dataGLM/bacteria_grouped_x.csv\")\n",
"y=np.loadtxt(\"data/dataGLM/bacteria_grouped_y.csv\")\n",
"\n",
"print(\"matrice des inputs (transposée)\")\n",
"print(x[:10].T)\n",
......@@ -962,7 +962,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 26,
"metadata": {},
"outputs": [
{
......@@ -989,7 +989,7 @@
" <th>Date:</th> <td>Mon, 18 Jun 2018</td> <th> Deviance: </th> <td> 528.92</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Time:</th> <td>15:01:08</td> <th> Pearson chi2: </th> <td> 652.</td> \n",
" <th>Time:</th> <td>16:02:59</td> <th> Pearson chi2: </th> <td> 652.</td> \n",
"</tr>\n",
"<tr>\n",
" <th>No. Iterations:</th> <td>8</td> <th> Covariance Type: </th> <td>nonrobust</td>\n",
......@@ -1021,7 +1021,7 @@
"Link Function: logit Scale: 1.0000\n",
"Method: IRLS Log-Likelihood: -557.92\n",
"Date: Mon, 18 Jun 2018 Deviance: 528.92\n",
"Time: 15:01:08 Pearson chi2: 652.\n",
"Time: 16:02:59 Pearson chi2: 652.\n",
"No. Iterations: 8 Covariance Type: nonrobust\n",
"==============================================================================\n",
" coef std err z P>|z| [0.025 0.975]\n",
......@@ -1033,7 +1033,7 @@
"\"\"\""
]
},
"execution_count": 24,
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1074,7 +1074,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 27,
"metadata": {},
"outputs": [
{
......@@ -1113,7 +1113,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 28,
"metadata": {},
"outputs": [
{
......@@ -1187,7 +1187,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
......@@ -1247,7 +1247,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 31,
"metadata": {},
"outputs": [
{
......@@ -1443,20 +1443,20 @@
"9 10 1.51755 13.00 3.60 1.36 72.99 0.57 8.40 0.0 0.11 1"
]
},
"execution_count": 28,
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"glass_data_headers = [\"Id\", \"RI\", \"Na\", \"Mg\", \"Al\", \"Si\", \"K\", \"Ca\", \"Ba\", \"Fe\", \"glass-type\"]\n",
"glass_data = pd.read_csv(\"data/glass.csv\", names=glass_data_headers)\n",
"glass_data = pd.read_csv(\"data/dataGLM/glass.csv\", names=glass_data_headers)\n",
"glass_data.head(10)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 32,
"metadata": {},
"outputs": [
{
......@@ -1496,23 +1496,15 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"model_1 Accuracy : 0.9846153846153847\n",
"model_2 Accuracy : 0.8615384615384616\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/local/lib/python3.6/site-packages/sklearn/model_selection/_split.py:2026: FutureWarning: From version 0.21, test_size will always complement train_size unless both are specified.\n",
" FutureWarning)\n"
"model_1 Accuracy : 1.0\n",
"model_2 Accuracy : 0.7846153846153846\n"
]
}
],
......@@ -1525,7 +1517,7 @@
"x=glass_data[glass_data_headers[:-1]]\n",
"y=glass_data[glass_data_headers[-1]]\n",
"\n",
"train_x, test_x, train_y, test_y = train_test_split(x,y, train_size=0.7)\n",
"train_x, test_x, train_y, test_y = train_test_split(x,y, test_size=0.3)\n",
"\n",
"\n",
"# modèle multinomial\n",
......
This diff is collapsed.
No preview for this file type
,vigon,MacBook-Pro-de-irma.local,17.06.2018 21:17,file:///Users/vigon/Library/Application%20Support/OpenOffice/4;
\ No newline at end of file
{"url": "https://docs.google.com/open?id=1NHqCydGAUHz8VgHJeK1o3mOxRTXQSboX2eJZBKCguJU", "doc_id": "1NHqCydGAUHz8VgHJeK1o3mOxRTXQSboX2eJZBKCguJU", "email": "vincent.vigon@gmail.com"}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment