Skip to content

Commit 90c4197

Browse files
committed
work
1 parent 856707c commit 90c4197

14 files changed

Lines changed: 417 additions & 485 deletions

imagedb/graphs.py

Lines changed: 154 additions & 46 deletions
Large diffs are not rendered by default.

imagedb/imagedb.pyproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<SchemaVersion>2.0</SchemaVersion>
66
<ProjectGuid>965fc95c-7dbc-4efc-adab-5ed89451655a</ProjectGuid>
77
<ProjectHome>.</ProjectHome>
8-
<StartupFile>oneoffwork.py</StartupFile>
8+
<StartupFile>graphs.py</StartupFile>
99
<SearchPath>..\</SearchPath>
1010
<WorkingDirectory>.</WorkingDirectory>
1111
<OutputPath>.</OutputPath>

jupyter/mv_graph_length_simple.ipynb

Lines changed: 16 additions & 8 deletions
Large diffs are not rendered by default.

jupyter/mv_graph_model.ipynb

Lines changed: 90 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 61,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -29,7 +29,7 @@
2929
},
3030
{
3131
"cell_type": "code",
32-
"execution_count": 58,
32+
"execution_count": 2,
3333
"metadata": {},
3434
"outputs": [
3535
{
@@ -38,7 +38,7 @@
3838
"['adjid', 'Correction', 'Angle', '% MBE']"
3939
]
4040
},
41-
"execution_count": 58,
41+
"execution_count": 2,
4242
"metadata": {},
4343
"output_type": "execute_result"
4444
}
@@ -53,7 +53,7 @@
5353
},
5454
{
5555
"cell_type": "code",
56-
"execution_count": 59,
56+
"execution_count": 3,
5757
"metadata": {},
5858
"outputs": [
5959
{
@@ -62,7 +62,7 @@
6262
"['n', 'Angle', 'style']"
6363
]
6464
},
65-
"execution_count": 59,
65+
"execution_count": 3,
6666
"metadata": {},
6767
"output_type": "execute_result"
6868
}
@@ -122,7 +122,7 @@
122122
},
123123
{
124124
"cell_type": "code",
125-
"execution_count": 32,
125+
"execution_count": 4,
126126
"metadata": {},
127127
"outputs": [
128128
{
@@ -131,7 +131,7 @@
131131
"['Angle', 'bias_percent']"
132132
]
133133
},
134-
"execution_count": 32,
134+
"execution_count": 4,
135135
"metadata": {},
136136
"output_type": "execute_result"
137137
}
@@ -146,7 +146,7 @@
146146
},
147147
{
148148
"cell_type": "code",
149-
"execution_count": 33,
149+
"execution_count": 5,
150150
"metadata": {},
151151
"outputs": [
152152
{
@@ -163,7 +163,7 @@
163163
},
164164
{
165165
"cell_type": "code",
166-
"execution_count": 44,
166+
"execution_count": 6,
167167
"metadata": {},
168168
"outputs": [],
169169
"source": [
@@ -192,7 +192,7 @@
192192
},
193193
{
194194
"cell_type": "code",
195-
"execution_count": 45,
195+
"execution_count": 11,
196196
"metadata": {},
197197
"outputs": [
198198
{
@@ -220,7 +220,7 @@
220220
" <thead>\n",
221221
" <tr>\n",
222222
" <th></th>\n",
223-
" <th colspan=\"5\" halign=\"left\">% MAE</th>\n",
223+
" <th colspan=\"5\" halign=\"left\">% MBE</th>\n",
224224
" </tr>\n",
225225
" <tr>\n",
226226
" <th></th>\n",
@@ -269,7 +269,7 @@
269269
"</div>"
270270
],
271271
"text/plain": [
272-
" % MAE \\\n",
272+
" % MBE \\\n",
273273
" median percentile_25 percentile_75 mse_0 \n",
274274
"Correction \n",
275275
"Corrected -3.429877 -8.068872 0.260054 55.458272 \n",
@@ -284,7 +284,7 @@
284284
"Model corrected M=-0.5 95% CIs [-0.6, -0.3] "
285285
]
286286
},
287-
"execution_count": 45,
287+
"execution_count": 11,
288288
"metadata": {},
289289
"output_type": "execute_result"
290290
}
@@ -296,24 +296,25 @@
296296
},
297297
{
298298
"cell_type": "code",
299-
"execution_count": 51,
299+
"execution_count": 8,
300300
"metadata": {},
301301
"outputs": [
302302
{
303303
"data": {
304304
"text/plain": [
305-
"['adjid', 'Correction', 'Angle', '% MAE']"
305+
"['adjid', 'Correction', 'Angle', '% MBE']"
306306
]
307307
},
308-
"execution_count": 51,
308+
"execution_count": 8,
309309
"metadata": {},
310310
"output_type": "execute_result"
311311
}
312312
],
313313
"source": [
314314
"#same again but at 20 degrees\n",
315315
"#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",
317318
"\n",
318319
"with mssql.Conn('imagedb', '(local)') as cnn:\n",
319320
" dfadj20 = pd.read_sql(sql, cnn)\n",
@@ -322,57 +323,89 @@
322323
},
323324
{
324325
"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,
335327
"metadata": {},
336328
"outputs": [
337329
{
338330
"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+
],
339392
"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]"
341399
]
342400
},
343-
"execution_count": 64,
401+
"execution_count": 12,
344402
"metadata": {},
345403
"output_type": "execute_result"
346404
}
347405
],
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+
]
376409
},
377410
{
378411
"cell_type": "code",

jupyter/mv_graph_scale.ipynb

Lines changed: 17 additions & 13 deletions
Large diffs are not rendered by default.

jupyter/mv_sklearn_forest_outliers.ipynb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
"from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C\n",
2525
"\n",
2626
"\n",
27-
"from funclib.iolib import folder_open\n",
28-
"from funclib.baselib import pickle, unpickle\n",
29-
"from funclib.numericslib import roundx\n",
30-
"from dblib import mssql\n",
31-
"from plotlib.mplfuncs import FigWidthsInch\n",
32-
"from plotlib import qplot"
27+
"from funclib.iolib import folder_open #GGM library\n",
28+
"from funclib.baselib import pickle, unpickle #GGM library\n",
29+
"from funclib.numericslib import roundx #GGM library\n",
30+
"from dblib import mssql #GGM library\n",
31+
"from plotlib.mplfuncs import FigWidthsInch #GGM library\n",
32+
"from plotlib import qplot #GGM library"
3333
]
3434
},
3535
{
@@ -65,6 +65,7 @@
6565
}
6666
],
6767
"source": [
68+
"#This loads the data from SQL Server, load the CSV dataframe here\n",
6869
"sql=\"select tl_mm, lens_subj_triangle_est, abs(rotation) as rotationabs, rotation,accuracy ,hw_ratio, all_corr_rot_adj2_mm_error_perc as bias_percent, abs(all_corr_rot_adj2_mm_error_perc) as abs_bias_percent from v_mv_long_form where cnn = 'nas' and (transform like 'r%' or transform like 'none') and accuracy>0.5\"\n",
6970
"\n",
7071
"with mssql.Conn('imagedb', '(local)') as cnn:\n",

0 commit comments

Comments
 (0)