|
|
@@ -102,7 +102,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 21,
|
|
|
+ "execution_count": 1,
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
@@ -140,7 +140,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 24,
|
|
|
+ "execution_count": 2,
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
@@ -177,7 +177,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 39,
|
|
|
+ "execution_count": 3,
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
@@ -283,13 +283,13 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 42,
|
|
|
+ "execution_count": 4,
|
|
|
"metadata": {},
|
|
|
"outputs": [
|
|
|
{
|
|
|
"data": {
|
|
|
"application/vnd.jupyter.widget-view+json": {
|
|
|
- "model_id": "081c8551585642b2b2ea6136696b799d",
|
|
|
+ "model_id": "497996fed9b54cf7ad359e5ecab0098b",
|
|
|
"version_major": 2,
|
|
|
"version_minor": 0
|
|
|
},
|
|
|
@@ -303,12 +303,12 @@
|
|
|
{
|
|
|
"data": {
|
|
|
"application/vnd.jupyter.widget-view+json": {
|
|
|
- "model_id": "1d10d27396dd478e8c684f41495c3fd9",
|
|
|
+ "model_id": "0c3b483a31a7405ca003da355c8d1cf7",
|
|
|
"version_major": 2,
|
|
|
"version_minor": 0
|
|
|
},
|
|
|
"text/plain": [
|
|
|
- "Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 640x480 with 1 Axes>', 'i…"
|
|
|
+ "Output()"
|
|
|
]
|
|
|
},
|
|
|
"metadata": {},
|
|
|
@@ -343,7 +343,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 44,
|
|
|
+ "execution_count": 5,
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
@@ -531,13 +531,13 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 47,
|
|
|
+ "execution_count": 6,
|
|
|
"metadata": {},
|
|
|
"outputs": [
|
|
|
{
|
|
|
"data": {
|
|
|
"application/vnd.jupyter.widget-view+json": {
|
|
|
- "model_id": "d72830d524704fe69cf2ef205e0ad4c5",
|
|
|
+ "model_id": "e83a5df3674e4e4b863b66f0ce6ad940",
|
|
|
"version_major": 2,
|
|
|
"version_minor": 0
|
|
|
},
|
|
|
@@ -551,12 +551,12 @@
|
|
|
{
|
|
|
"data": {
|
|
|
"application/vnd.jupyter.widget-view+json": {
|
|
|
- "model_id": "a1990c0264884670a49ffa4ecf045daa",
|
|
|
+ "model_id": "a9ccd02bb35b4b5cb97e43d9408c85fa",
|
|
|
"version_major": 2,
|
|
|
"version_minor": 0
|
|
|
},
|
|
|
"text/plain": [
|
|
|
- "Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 640x480 with 2 Axes>', 'i…"
|
|
|
+ "Output()"
|
|
|
]
|
|
|
},
|
|
|
"metadata": {},
|
|
|
@@ -604,7 +604,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 49,
|
|
|
+ "execution_count": 7,
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
@@ -679,19 +679,101 @@
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
+ "cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
+ "source": [
|
|
|
+ "#### Exploration to Appraisal Example\n",
|
|
|
+ "\n",
|
|
|
+ "Let's modify the above dashboard to demonstrate a powerful solution for a commonly encounter problem in resource exploration.\n",
|
|
|
+ "\n",
|
|
|
+ "* prior distribution - from an exploration campaign, usually including 2D seismic / remote sensing data along with analog mature resources (using statistical from similar and better sampled settings)\n",
|
|
|
+ "\n",
|
|
|
+ "* likelihood distribution - from an appraisal campaign, usually including sparse wells/ drill holes (large spacings) and 3D seismic / remote sensing\n",
|
|
|
+ "\n",
|
|
|
+ "Now we can apply Bayesian updating to calculate a,\n",
|
|
|
+ "\n",
|
|
|
+ "* posterior distribution - updating the exploration prior distribution with the appraisal likelihood distribution.\n",
|
|
|
+ "\n",
|
|
|
+ "Let's take a mining example, i.e., a gold mine. For example, the estimated proven and probablity reserves at Bingham Canyon Mine, Utah, USA is 2.09 million onces. Let's use this to guide our units and ranges. "
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 52,
|
|
|
+ "execution_count": 8,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "l = widgets.Text(value=' Gold Resources Bayesian Updating Demo, Michael Pyrcz, Professor, The University of Texas at Austin',\n",
|
|
|
+ " layout=Layout(width='900px', height='30px'))\n",
|
|
|
+ "# P_happening_label = widgets.Text(value='Probability of Happening',layout=Layout(width='50px',height='30px',line-size='0 px'))\n",
|
|
|
+ "mu_prior = widgets.FloatSlider(min=0.0, max = 2.0, value=0.5, step = 0.1, description = r'$\\mu_{Au,prior}$',orientation='horizontal', \n",
|
|
|
+ " style = {'description_width':'initial'},layout=Layout(width='400px',height='30px'),continuous_update=False,readout_format='.3f')\n",
|
|
|
+ "sigma_prior = widgets.FloatSlider(min = 0, max = 1.0, value=0.1, step = 0.02, description = r'$\\sigma_{Au,prior}$',orientation='horizontal', \n",
|
|
|
+ " style = {'description_width': 'initial'},layout=Layout(width='400px', height='30px'),continuous_update=False,readout_format='.3f')\n",
|
|
|
+ "\n",
|
|
|
+ "mu_like = widgets.FloatSlider(min=0.0, max = 2.0, value=1.0, step = 0.1, description = r'$\\mu_{Au,like}$',orientation='horizontal', \n",
|
|
|
+ " style = {'description_width':'initial'},layout=Layout(width='400px',height='30px'),continuous_update=False,readout_format='.3f')\n",
|
|
|
+ "sigma_like = widgets.FloatSlider(min=0, max = 1.0, value=0.1, step = 0.02, description = r'$\\sigma_{Au,like}$',orientation='horizontal', \n",
|
|
|
+ " style = {'description_width': 'initial'},layout=Layout(width='400px', height='30px'),continuous_update=False,readout_format='.3f')\n",
|
|
|
+ "\n",
|
|
|
+ "ui_prior = widgets.VBox([mu_prior,sigma_prior],)\n",
|
|
|
+ "ui_like = widgets.VBox([mu_like,sigma_like],)\n",
|
|
|
+ "\n",
|
|
|
+ "ui_summary3 = widgets.HBox([ui_prior,ui_like,],)\n",
|
|
|
+ "ui2_summary3 = widgets.VBox([l,ui_summary3],)\n",
|
|
|
+ "\n",
|
|
|
+ "def run_plot_summary3(mu_prior,sigma_prior,mu_like,sigma_like):\n",
|
|
|
+ " sigma2_prior = sigma_prior*sigma_prior; sigma2_like = sigma_like*sigma_like\n",
|
|
|
+ " mu_post = (mu_like * sigma2_prior + mu_prior * sigma2_like)/((1 - sigma2_like)*(sigma2_prior - 1) + 1)\n",
|
|
|
+ " sigma2_post = (sigma2_prior * sigma2_like)/((1 - sigma2_like)*(sigma2_prior - 1) + 1)\n",
|
|
|
+ " \n",
|
|
|
+ " values = np.linspace(-3,3,1000)\n",
|
|
|
+ " PDF_prior = st.norm.pdf(values,loc = mu_prior,scale = math.sqrt(sigma2_prior))\n",
|
|
|
+ " PDF_like = st.norm.pdf(values,loc = mu_like,scale = math.sqrt(sigma2_like))\n",
|
|
|
+ " PDF_post = st.norm.pdf(values,loc = mu_post,scale = math.sqrt(sigma2_post))\n",
|
|
|
+ " \n",
|
|
|
+ " pvalues = np.linspace(0.001,0.999,1000) # CDF\n",
|
|
|
+ " Perc_prior = st.norm.ppf(pvalues,loc = mu_prior,scale = math.sqrt(sigma2_prior))\n",
|
|
|
+ " Perc_like = st.norm.ppf(pvalues,loc = mu_like,scale = math.sqrt(sigma2_like))\n",
|
|
|
+ " Perc_post = st.norm.ppf(pvalues,loc = mu_post,scale = math.sqrt(sigma2_post))\n",
|
|
|
+ " \n",
|
|
|
+ " plt.subplot(121)\n",
|
|
|
+ " plt.plot(values,PDF_prior,c='green',label='Prior, Exploration',zorder=10); plt.fill_between(values,PDF_prior,color='green',alpha=0.05,zorder=1)\n",
|
|
|
+ " plt.plot(values,PDF_like,c='red',label='Likelihood, New Appraisal Data',zorder=10); plt.fill_between(values,PDF_like,color='red',alpha=0.05,zorder=1) \n",
|
|
|
+ " plt.plot(values,PDF_post,c='black',label='Posterior, Exploration + New Appraisal Data',zorder=10); plt.fill_between(values,PDF_post,color='black',alpha=0.05,zorder=1)\n",
|
|
|
+ " \n",
|
|
|
+ " plt.xlabel('Gold Reserves (million ounces)'); plt.ylabel('Density'); plt.title('Gold Mine Reserves, Bayesian Updating Gaussian, PDFs')\n",
|
|
|
+ " plt.xlim([0.0,2.0]); plt.ylim(0,10); add_grid(); plt.legend(loc = 'upper left')\n",
|
|
|
+ " \n",
|
|
|
+ " plt.subplot(122)\n",
|
|
|
+ " plt.plot(Perc_prior,pvalues,c='green',label='Prior, Exploration')\n",
|
|
|
+ " plt.plot(Perc_like,pvalues,c='red',label='Likelihood, New Appraisal Data')\n",
|
|
|
+ " plt.plot(Perc_post,pvalues,c='black',label='Posterior, Exploration + New Appraisal Data')\n",
|
|
|
+ " \n",
|
|
|
+ " plt.xlabel('Gold Reserves (million ounces)'); plt.ylabel('Cumulative Probability'); plt.title('Gold Mine Reserves, Bayesian Updating Gaussian, CDFs')\n",
|
|
|
+ " plt.xlim([0.,2.0]); plt.ylim([0,1]); add_grid(); plt.legend(loc = 'lower right')\n",
|
|
|
+ " \n",
|
|
|
+ " plt.subplots_adjust(left=0.0, bottom=0.0, right=2., top=1.0, wspace=0.2, hspace=0.1); plt.show()\n",
|
|
|
+ " \n",
|
|
|
+ "interactive_plot_summary3 = widgets.interactive_output(run_plot_summary3, \n",
|
|
|
+ " {'mu_prior':mu_prior,'sigma_prior':sigma_prior,'mu_like':mu_like,'sigma_like':sigma_like})\n",
|
|
|
+ "interactive_plot_summary3.clear_output(wait = True) "
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 9,
|
|
|
"metadata": {},
|
|
|
"outputs": [
|
|
|
{
|
|
|
"data": {
|
|
|
"application/vnd.jupyter.widget-view+json": {
|
|
|
- "model_id": "b4f1ca08d731472986942298dc82a0a1",
|
|
|
+ "model_id": "81b6b594d997431ead0cbbb11e09ccc4",
|
|
|
"version_major": 2,
|
|
|
"version_minor": 0
|
|
|
},
|
|
|
"text/plain": [
|
|
|
- "VBox(children=(Text(value=' Bayesian Updating Demo, Micha…"
|
|
|
+ "VBox(children=(Text(value=' Gold Resources Bayesian Updating Demo, Michael Pyr…"
|
|
|
]
|
|
|
},
|
|
|
"metadata": {},
|
|
|
@@ -700,12 +782,12 @@
|
|
|
{
|
|
|
"data": {
|
|
|
"application/vnd.jupyter.widget-view+json": {
|
|
|
- "model_id": "2f3199f4b3d243b5932dd4d9a3571ced",
|
|
|
+ "model_id": "cc553ae2726f4a9e930f9da3f026a380",
|
|
|
"version_major": 2,
|
|
|
"version_minor": 0
|
|
|
},
|
|
|
"text/plain": [
|
|
|
- "Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': '<Figure size 640x480 with 2 Axes>', 'i…"
|
|
|
+ "Output()"
|
|
|
]
|
|
|
},
|
|
|
"metadata": {},
|
|
|
@@ -713,7 +795,7 @@
|
|
|
}
|
|
|
],
|
|
|
"source": [
|
|
|
- "display(ui2_summary2, interactive_plot_summary2) # display the interactive plot"
|
|
|
+ "display(ui2_summary3, interactive_plot_summary3) # display the interactive plot"
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
@@ -793,7 +875,7 @@
|
|
|
"name": "python",
|
|
|
"nbconvert_exporter": "python",
|
|
|
"pygments_lexer": "ipython3",
|
|
|
- "version": "3.12.4"
|
|
|
+ "version": "3.13.9"
|
|
|
}
|
|
|
},
|
|
|
"nbformat": 4,
|