Skip to content

Commit 83b59fd

Browse files
authored
Add files via upload
1 parent d505434 commit 83b59fd

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

Interactive_DecisionMaking.ipynb

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
},
9090
{
9191
"cell_type": "code",
92-
"execution_count": 5,
92+
"execution_count": 1,
9393
"metadata": {},
9494
"outputs": [],
9595
"source": [
@@ -106,7 +106,7 @@
106106
},
107107
{
108108
"cell_type": "code",
109-
"execution_count": 6,
109+
"execution_count": 2,
110110
"metadata": {},
111111
"outputs": [],
112112
"source": [
@@ -139,7 +139,7 @@
139139
},
140140
{
141141
"cell_type": "code",
142-
"execution_count": 32,
142+
"execution_count": 9,
143143
"metadata": {},
144144
"outputs": [],
145145
"source": [
@@ -155,10 +155,10 @@
155155
"ui1 = widgets.VBox([mean,stdev],kwargs = {'justify_content':'center'})\n",
156156
"\n",
157157
"slope_under = widgets.FloatSlider(min=0.00, max = 1.0,value = 0.1,step=0.01,description = '$m_{under}$',orientation='horizontal',layout=Layout(width='230px', height='50px'),continuous_update=False)\n",
158-
"slope_under.style.handle_color = 'blue'\n",
158+
"slope_under.style.handle_color = 'green'\n",
159159
"\n",
160160
"power_under = widgets.FloatSlider(min=1.0, max = 5.0, value = 0.0, description = '$p_{under}$',orientation='horizontal',layout=Layout(width='230px', height='50px'),continuous_update=False)\n",
161-
"power_under.style.handle_color = 'blue'\n",
161+
"power_under.style.handle_color = 'green'\n",
162162
"\n",
163163
"ui2 = widgets.VBox([slope_under,power_under],kwargs = {'justify_content':'center'})\n",
164164
"\n",
@@ -209,14 +209,20 @@
209209
" plt.subplot(131) # plot uncertainty distribution\n",
210210
" plt.plot(X,pdf,'--',color='darkorange',alpha=0.7,zorder=10,lw=3)\n",
211211
" hist = plt.hist(y,bins=X,edgecolor='black',color='darkorange',alpha=0.7,density=True,stacked=True)\n",
212-
" plt.plot([best_estimate,best_estimate],[0,np.max(hist[0])*1.2],color='black',linestyle='--')\n",
213-
" plt.annotate('Optimum Estimate = ' + str(np.round(best_estimate,2)),[best_estimate,np.max(hist[0])*0.6], rotation=270)\n",
212+
" if best_estimate >= 0 and best_estimate <= 1.0:\n",
213+
" plt.plot([best_estimate,best_estimate],[0,np.max(hist[0])*1.2],color='black',linestyle='--')\n",
214+
" plt.annotate('Optimum Estimate = ' + str(np.round(best_estimate,2)),[best_estimate,np.max(hist[0])*0.6], rotation=270)\n",
215+
" elif best_estimate < 0.0: \n",
216+
" plt.annotate('Optimum Estimate = ' + str('$-\\infty$'),[0,np.max(hist[0])*0.6], rotation=270)\n",
217+
" else:\n",
218+
" plt.annotate('Optimum Estimate = ' + str('$+\\infty$'),[0.96,np.max(hist[0])*0.6], rotation=270)\n",
214219
" plt.xlim(0.0,1.0); plt.xlabel(\"Feature, $y_1$\"); plt.ylim([0,np.max(hist[0])*1.2])\n",
215220
" plt.title('Uncertainty Distribution'); plt.ylabel('Density')\n",
216221
" plt.grid(color='grey', ls = '-.', lw = 0.1)\n",
217222
"\n",
218223
" plt.subplot(132) # plot loss function, loss vs. estimate error\n",
219-
" plt.plot(delta,loss,color='blue',alpha=0.8,lw=3)\n",
224+
" plt.plot(delta[delta>0],loss[delta>0],color='blue',alpha=0.8,lw=3)\n",
225+
" plt.plot(delta[delta<0],loss[delta<0],color='green',alpha=0.8,lw=3)\n",
220226
"# plt.plot([0,0],[0,np.max(loss)],color='black',linestyle='--',alpha=0.3)\n",
221227
" plt.plot([0,0],[0,1.0],color='black',linestyle='--',alpha=0.8)\n",
222228
"# plt.annotate('Underestimation',[(xmax-xmin)*-0.1,np.max(loss)*0.8], rotation=0,horizontalalignment='right')\n",
@@ -229,13 +235,18 @@
229235
" plt.xlabel('Error In Estimate'); plt.title('Loss Function'); plt.ylabel('Loss') \n",
230236
" plt.grid(color='grey', ls = '-.', lw = 0.1)\n",
231237
" \n",
232-
" \n",
233238
" plt.subplot(133) # plot expected loss vs. estimate\n",
234239
" #plt.plot(X,pdf/1000*stdev,'--',color='black',alpha=0.7,zorder=1)\n",
235240
" plt.plot(x_exp_loss,exp_loss,color='red',alpha=0.8,lw=3)\n",
236-
" plt.plot([best_estimate,best_estimate],[0,max_loss_plot],color='black',linestyle='--',lw=2)\n",
241+
" if best_estimate >= 0 and best_estimate <= 1.0:\n",
242+
" plt.plot([best_estimate,best_estimate],[0,max_loss_plot],color='black',linestyle='--',lw=2)\n",
243+
" plt.annotate('Optimum Estimate = ' + str(np.round(best_estimate,2)),[best_estimate,max_loss_plot*0.6], rotation=270)\n",
244+
" elif best_estimate < 0:\n",
245+
" plt.annotate('Optimum Estimate = ' + str('$-\\infty$'),[0,max_loss_plot*0.6], rotation=270)\n",
246+
" else:\n",
247+
" plt.annotate('Optimum Estimate = ' + str('$+\\infty$'),[0.96,max_loss_plot*0.6], rotation=270)\n",
248+
" \n",
237249
" plt.xlim([0.0,1.0]); # plt.ylim([0,1.0])\n",
238-
" plt.annotate('Optimum Estimate = ' + str(np.round(best_estimate,2)),[best_estimate,max_loss_plot*0.6], rotation=270)\n",
239250
"# plt.plot([xmin,xmax],[min_loss,min_loss],color='black',linestyle='--',alpha=0.3)\n",
240251
" plt.plot([0,1],[min_loss,min_loss],color='black',linestyle='--',alpha=0.7,lw=2)\n",
241252
" plt.annotate('Minimum Expected Loss',[xmin+(xmax-xmin)*0.2,min_loss*1.1], rotation=0,horizontalalignment='left')\n",
@@ -270,13 +281,13 @@
270281
},
271282
{
272283
"cell_type": "code",
273-
"execution_count": 33,
284+
"execution_count": 10,
274285
"metadata": {},
275286
"outputs": [
276287
{
277288
"data": {
278289
"application/vnd.jupyter.widget-view+json": {
279-
"model_id": "a46774a506fe4020851065741a7d3c58",
290+
"model_id": "40ebbaf980c74081ad812614ea114d10",
280291
"version_major": 2,
281292
"version_minor": 0
282293
},
@@ -290,7 +301,7 @@
290301
{
291302
"data": {
292303
"application/vnd.jupyter.widget-view+json": {
293-
"model_id": "f7defe23730049aea9b6a071d1aacbde",
304+
"model_id": "1ebaaaa00be143439c82be0649a1d3eb",
294305
"version_major": 2,
295306
"version_minor": 0
296307
},
@@ -351,13 +362,6 @@
351362
"\n",
352363
"#### More Resources Available at: [Twitter](https://twitter.com/geostatsguy) | [GitHub](https://github.com/GeostatsGuy) | [Website](http://michaelpyrcz.com) | [GoogleScholar](https://scholar.google.com/citations?user=QVZ20eQAAAAJ&hl=en&oi=ao) | [Book](https://www.amazon.com/Geostatistical-Reservoir-Modeling-Michael-Pyrcz/dp/0199731446) | [YouTube](https://www.youtube.com/channel/UCLqEr-xV-ceHdXXXrTId5ig) | [LinkedIn](https://www.linkedin.com/in/michael-pyrcz-61a648a1)"
353364
]
354-
},
355-
{
356-
"cell_type": "code",
357-
"execution_count": null,
358-
"metadata": {},
359-
"outputs": [],
360-
"source": []
361365
}
362366
],
363367
"metadata": {

0 commit comments

Comments
 (0)