Of Knowledge Gained From Paths Constrained

Show code
import pandas as pd
import numpy as np
import os
import sys
sys.path.append("../python")
import general
import visualizations
import incremental_information as incInf
Show code
from IPython.display import HTML

HTML('''<script>
code_show=true; 
function code_toggle() {
 if (code_show){
 $('div.input').hide();
 } else {
 $('div.input').show();
 }
 code_show = !code_show
} 
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
Show code
params = {'OUTPUT' : {'path' : os.path.join('output_html', 'incremental_information'),
                      'name' : 'incremental_information_20201010'},
         'SIMULATION' : { 'n_samples' : 10000, 
                          'pctiles' : [0.25,0.5,0.75,0.9,0.95,0.99],
                          'elapsed_times' : [0.1, 0.5, 1, 2, 5, 10],
                    'gaussian' : {'mu' : 6, 'sigma' : 2},
                    'exponential' : {'lambda': 0.1},
                    'gamma' : {'alpha' : 0.4},
                    'lognormal' : {'mu' : 0.5, 'sigma' : 1},
                    'powerLaw' : {'xmin' : 1, 'alpha': 2},
                    'empirical_wFailure' : {'p_success' : 0.5}}}

In business and life, often struggle and strife
Derive from the time and the money expended
But how might we guess in the midst of duress
If what’s already known means the pain is extended?

To wit, please envisage the anodyne image
Of one simple poet a-writing some code
Who, quite episodic but aperiodic
Must rise from his couch to inspect his commode!

Show code
ordered_dists = incInf.simulateOrderedDists(params)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [4], in <module>
----> 1 ordered_dists = incInf.simulateOrderedDists(params)

NameError: name 'incInf' is not defined

If varied hydration yields varied durations
Of intervals ‘twixt poet trips to the loo
We choose a solution of one distribution
The bell curve, the ’normal’ - what times will ensue?

Show code
interval_df = incInf.generateMidIntervalDF(ordered_dists, 'gaussian', params)
Show code
visualizations.intervalBars(interval_df, 'Gaussian')

Since these intermissions of human conditions
Are always observed in the midst of their span
The longer I’ve waited since last needs were sated
The shorter the time ’till I run to the can

Show code
interval_df = incInf.generateMidIntervalDF(ordered_dists, 'powerLaw', params)

But what if we sample a different example,
The time ’till a team has completed its task
The longer embroiled, the more they have toiled
The longer the guess when the boss deigns to ask!

For most tasks are greeted and quickly completed
An email is written, a button is clicked
But if in execution, we remain without solution
We know the task’s a doozy since the problem ain’t been licked!

Show code
visualizations.intervalBars(interval_df, 'Power Law')

And in the jaws of power laws
As watches tick and funds are spent
We worsen afflictions and dire predictions
The languor that lingers is loathe to relent

Show code
odds_df = incInf.getUpdatedOddsDF(params, ordered_dists)

But progress is uncertain, so we peer behind the curtain
To observe who has converted and the masses left behind
We modify the chances of success as time advances
The fraction we expect to close, the others, less-inclined

Show code
visualizations.oddsBars(odds_df)

But times ’till leads can warm will be distributed lognorm-ly
The odds of wins grow longer and so too the waits expected
For in such a formulation, every tick adds information
The odds and times are modified - how have they been affected?

The static distribution still retains its definitions
We update expectations as we process new conditions!

Show code
if not os.path.exists(params['OUTPUT']['path']): os.makedirs(params['OUTPUT']['path'])
general.publish('incrementalInformation', params['OUTPUT']['path'], params['OUTPUT']['name'])