|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 61, |
| 5 | + "execution_count": 1, |
6 | 6 | "metadata": {}, |
7 | 7 | "outputs": [], |
8 | 8 | "source": [ |
|
29 | 29 | }, |
30 | 30 | { |
31 | 31 | "cell_type": "code", |
32 | | - "execution_count": 58, |
| 32 | + "execution_count": 2, |
33 | 33 | "metadata": {}, |
34 | 34 | "outputs": [ |
35 | 35 | { |
|
38 | 38 | "['adjid', 'Correction', 'Angle', '% MBE']" |
39 | 39 | ] |
40 | 40 | }, |
41 | | - "execution_count": 58, |
| 41 | + "execution_count": 2, |
42 | 42 | "metadata": {}, |
43 | 43 | "output_type": "execute_result" |
44 | 44 | } |
|
53 | 53 | }, |
54 | 54 | { |
55 | 55 | "cell_type": "code", |
56 | | - "execution_count": 59, |
| 56 | + "execution_count": 3, |
57 | 57 | "metadata": {}, |
58 | 58 | "outputs": [ |
59 | 59 | { |
|
62 | 62 | "['n', 'Angle', 'style']" |
63 | 63 | ] |
64 | 64 | }, |
65 | | - "execution_count": 59, |
| 65 | + "execution_count": 3, |
66 | 66 | "metadata": {}, |
67 | 67 | "output_type": "execute_result" |
68 | 68 | } |
|
122 | 122 | }, |
123 | 123 | { |
124 | 124 | "cell_type": "code", |
125 | | - "execution_count": 32, |
| 125 | + "execution_count": 4, |
126 | 126 | "metadata": {}, |
127 | 127 | "outputs": [ |
128 | 128 | { |
|
131 | 131 | "['Angle', 'bias_percent']" |
132 | 132 | ] |
133 | 133 | }, |
134 | | - "execution_count": 32, |
| 134 | + "execution_count": 4, |
135 | 135 | "metadata": {}, |
136 | 136 | "output_type": "execute_result" |
137 | 137 | } |
|
146 | 146 | }, |
147 | 147 | { |
148 | 148 | "cell_type": "code", |
149 | | - "execution_count": 33, |
| 149 | + "execution_count": 5, |
150 | 150 | "metadata": {}, |
151 | 151 | "outputs": [ |
152 | 152 | { |
|
163 | 163 | }, |
164 | 164 | { |
165 | 165 | "cell_type": "code", |
166 | | - "execution_count": 44, |
| 166 | + "execution_count": 6, |
167 | 167 | "metadata": {}, |
168 | 168 | "outputs": [], |
169 | 169 | "source": [ |
|
192 | 192 | }, |
193 | 193 | { |
194 | 194 | "cell_type": "code", |
195 | | - "execution_count": 45, |
| 195 | + "execution_count": 11, |
196 | 196 | "metadata": {}, |
197 | 197 | "outputs": [ |
198 | 198 | { |
|
220 | 220 | " <thead>\n", |
221 | 221 | " <tr>\n", |
222 | 222 | " <th></th>\n", |
223 | | - " <th colspan=\"5\" halign=\"left\">% MAE</th>\n", |
| 223 | + " <th colspan=\"5\" halign=\"left\">% MBE</th>\n", |
224 | 224 | " </tr>\n", |
225 | 225 | " <tr>\n", |
226 | 226 | " <th></th>\n", |
|
269 | 269 | "</div>" |
270 | 270 | ], |
271 | 271 | "text/plain": [ |
272 | | - " % MAE \\\n", |
| 272 | + " % MBE \\\n", |
273 | 273 | " median percentile_25 percentile_75 mse_0 \n", |
274 | 274 | "Correction \n", |
275 | 275 | "Corrected -3.429877 -8.068872 0.260054 55.458272 \n", |
|
284 | 284 | "Model corrected M=-0.5 95% CIs [-0.6, -0.3] " |
285 | 285 | ] |
286 | 286 | }, |
287 | | - "execution_count": 45, |
| 287 | + "execution_count": 11, |
288 | 288 | "metadata": {}, |
289 | 289 | "output_type": "execute_result" |
290 | 290 | } |
|
296 | 296 | }, |
297 | 297 | { |
298 | 298 | "cell_type": "code", |
299 | | - "execution_count": 51, |
| 299 | + "execution_count": 8, |
300 | 300 | "metadata": {}, |
301 | 301 | "outputs": [ |
302 | 302 | { |
303 | 303 | "data": { |
304 | 304 | "text/plain": [ |
305 | | - "['adjid', 'Correction', 'Angle', '% MAE']" |
| 305 | + "['adjid', 'Correction', 'Angle', '% MBE']" |
306 | 306 | ] |
307 | 307 | }, |
308 | | - "execution_count": 51, |
| 308 | + "execution_count": 8, |
309 | 309 | "metadata": {}, |
310 | 310 | "output_type": "execute_result" |
311 | 311 | } |
312 | 312 | ], |
313 | 313 | "source": [ |
314 | 314 | "#same again but at 20 degrees\n", |
315 | 315 | "#load data\n", |
316 | | - "sql=\"select adjid ,'Model corrected' as Correction ,rotation as Angle ,bias_percent as '% MBE' from adjust_all where abs(rotation) < 21 union select adjid ,'Corrected' as Correction ,rotation as Angle ,all_corr_rot_adj2_mm_error_perc as '% MAE' from adjust_all where abs(rotation) < 21 union select adjid ,'Lens only' as Correction ,rotation as Angle ,mv_lens_correction_mm_error_perc as '% MAE' from adjust_all where abs(rotation) < 21 \"\n", |
| 316 | + "\n", |
| 317 | + "sql=\"select adjid ,'Model corrected' as Correction ,rotation as Angle ,bias_percent as '% MBE' from adjust_all where abs(rotation) < 21 union select adjid ,'Corrected' as Correction ,rotation as Angle ,all_corr_rot_adj2_mm_error_perc as '% MBE' from adjust_all where abs(rotation) < 21 union select adjid ,'Lens only' as Correction ,rotation as Angle ,mv_lens_correction_mm_error_perc as '% MBE' from adjust_all where abs(rotation) < 21 \"\n", |
317 | 318 | "\n", |
318 | 319 | "with mssql.Conn('imagedb', '(local)') as cnn:\n", |
319 | 320 | " dfadj20 = pd.read_sql(sql, cnn)\n", |
|
322 | 323 | }, |
323 | 324 | { |
324 | 325 | "cell_type": "code", |
325 | | - "execution_count": 63, |
326 | | - "metadata": {}, |
327 | | - "outputs": [], |
328 | | - "source": [ |
329 | | - "dfadj20.groupby(['Correction']).agg({'% MBE':[np.mean, mse(0), ci]})" |
330 | | - ] |
331 | | - }, |
332 | | - { |
333 | | - "cell_type": "code", |
334 | | - "execution_count": 64, |
| 326 | + "execution_count": 12, |
335 | 327 | "metadata": {}, |
336 | 328 | "outputs": [ |
337 | 329 | { |
338 | 330 | "data": { |
| 331 | + "text/html": [ |
| 332 | + "<div>\n", |
| 333 | + "<style scoped>\n", |
| 334 | + " .dataframe tbody tr th:only-of-type {\n", |
| 335 | + " vertical-align: middle;\n", |
| 336 | + " }\n", |
| 337 | + "\n", |
| 338 | + " .dataframe tbody tr th {\n", |
| 339 | + " vertical-align: top;\n", |
| 340 | + " }\n", |
| 341 | + "\n", |
| 342 | + " .dataframe thead tr th {\n", |
| 343 | + " text-align: left;\n", |
| 344 | + " }\n", |
| 345 | + "\n", |
| 346 | + " .dataframe thead tr:last-of-type th {\n", |
| 347 | + " text-align: right;\n", |
| 348 | + " }\n", |
| 349 | + "</style>\n", |
| 350 | + "<table border=\"1\" class=\"dataframe\">\n", |
| 351 | + " <thead>\n", |
| 352 | + " <tr>\n", |
| 353 | + " <th></th>\n", |
| 354 | + " <th colspan=\"3\" halign=\"left\">% MBE</th>\n", |
| 355 | + " </tr>\n", |
| 356 | + " <tr>\n", |
| 357 | + " <th></th>\n", |
| 358 | + " <th>mean</th>\n", |
| 359 | + " <th>mse_0</th>\n", |
| 360 | + " <th>ci</th>\n", |
| 361 | + " </tr>\n", |
| 362 | + " <tr>\n", |
| 363 | + " <th>Correction</th>\n", |
| 364 | + " <th></th>\n", |
| 365 | + " <th></th>\n", |
| 366 | + " <th></th>\n", |
| 367 | + " </tr>\n", |
| 368 | + " </thead>\n", |
| 369 | + " <tbody>\n", |
| 370 | + " <tr>\n", |
| 371 | + " <th>Corrected</th>\n", |
| 372 | + " <td>-2.049863</td>\n", |
| 373 | + " <td>28.576984</td>\n", |
| 374 | + " <td>M=-2.0 95% CIs [-2.2, -1.9]</td>\n", |
| 375 | + " </tr>\n", |
| 376 | + " <tr>\n", |
| 377 | + " <th>Lens only</th>\n", |
| 378 | + " <td>-9.265658</td>\n", |
| 379 | + " <td>108.897709</td>\n", |
| 380 | + " <td>M=-9.3 95% CIs [-9.4, -9.1]</td>\n", |
| 381 | + " </tr>\n", |
| 382 | + " <tr>\n", |
| 383 | + " <th>Model corrected</th>\n", |
| 384 | + " <td>-0.055286</td>\n", |
| 385 | + " <td>13.288200</td>\n", |
| 386 | + " <td>M=-0.1 95% CIs [-0.2, 0.1]</td>\n", |
| 387 | + " </tr>\n", |
| 388 | + " </tbody>\n", |
| 389 | + "</table>\n", |
| 390 | + "</div>" |
| 391 | + ], |
339 | 392 | "text/plain": [ |
340 | | - "pandas.core.frame.DataFrame" |
| 393 | + " % MBE \n", |
| 394 | + " mean mse_0 ci\n", |
| 395 | + "Correction \n", |
| 396 | + "Corrected -2.049863 28.576984 M=-2.0 95% CIs [-2.2, -1.9]\n", |
| 397 | + "Lens only -9.265658 108.897709 M=-9.3 95% CIs [-9.4, -9.1]\n", |
| 398 | + "Model corrected -0.055286 13.288200 M=-0.1 95% CIs [-0.2, 0.1]" |
341 | 399 | ] |
342 | 400 | }, |
343 | | - "execution_count": 64, |
| 401 | + "execution_count": 12, |
344 | 402 | "metadata": {}, |
345 | 403 | "output_type": "execute_result" |
346 | 404 | } |
347 | 405 | ], |
348 | | - "source": [] |
349 | | - }, |
350 | | - { |
351 | | - "cell_type": "code", |
352 | | - "execution_count": 65, |
353 | | - "metadata": {}, |
354 | | - "outputs": [ |
355 | | - { |
356 | | - "name": "stdout", |
357 | | - "output_type": "stream", |
358 | | - "text": [ |
359 | | - " % MAE \\\n", |
360 | | - " median percentile_25 percentile_75 mse_0 \n", |
361 | | - "Correction \n", |
362 | | - "Corrected -1.777259 -5.136181 1.044947 28.576984 \n", |
363 | | - "Lens only -9.007796 -12.247619 -6.036656 108.897709 \n", |
364 | | - "Model corrected -0.190457 -2.038379 1.811059 13.288200 \n", |
365 | | - "\n", |
366 | | - " \n", |
367 | | - " ci \n", |
368 | | - "Correction \n", |
369 | | - "Corrected M=-2.0 95% CIs [-2.2, -1.9] \n", |
370 | | - "Lens only M=-9.3 95% CIs [-9.4, -9.1] \n", |
371 | | - "Model corrected M=-0.1 95% CIs [-0.2, 0.1] \n" |
372 | | - ] |
373 | | - } |
374 | | - ], |
375 | | - "source": [] |
| 406 | + "source": [ |
| 407 | + "dfadj20.groupby(['Correction']).agg({'% MBE':[np.mean, mse(0), ci]})" |
| 408 | + ] |
376 | 409 | }, |
377 | 410 | { |
378 | 411 | "cell_type": "code", |
|
0 commit comments