示例#1
0

def confidence_interval(data, confidence=0.90):
    s = np.array(data)
    n, min_max, mean, var, skew, kurt = scipy.stats.describe(s)
    normalized_var = var / math.sqrt(0.5)
    std = math.sqrt(normalized_var)
    interval = scipy.stats.norm.interval(0.90, loc=mean, scale=std)
    return interval


#here starts the main script to brute force try many constant joining values and evaluate the error with expt
#*abdul sees 3e6 per molar per second in his work*
#the kjoins predicted by bernie/hill are ~20 and ~2, so fairly close to 1, makes sense that roughly the same range of param would work

jode_constant = joining_ode_class.ODE_joining('constant')
jode_hill = joining_ode_class.ODE_joining('hill')
jode_bernie = joining_ode_class.ODE_joining('bernie')
plot_dir_name = "bin10/optimal_parameter/"
n_bootstrap = 1
n_bins = 10
max_tube_length = 10.0


def optimal_parameter_hill(hill_model):
    param_list = np.linspace(1e10, 1.5e11, 400)
    kjoin_list = [param_list[i] for i in range(len(param_list))]
    #original: kjoin_list = [1e10+(i*1e9) for i in range(200)]
    squared_error_list = []
    #kjoin_list = [1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14]
    #kjoin_list = [10000*(i*10) for i in range(10)]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#script to generate data files needed for plotting
import numpy as np
import joining_ode_class
import matplotlib.pyplot as plt
import scipy.stats
from scipy.stats import gaussian_kde
from scipy.interpolate import UnivariateSpline

jode_constant = joining_ode_class.ODE_joining('constant')
jode_hill = joining_ode_class.ODE_joining('hill')
jode_bernie = joining_ode_class.ODE_joining('bernie')
plot_dir_name = "bin10/optimal_parameter/"

params = [3.86e6, 2.98e10, 7.175e7]  #optimized parameters
models = [jode_constant, jode_hill, jode_bernie]

########################################################################################################
#plotting simulated distributions with time for each variable of interest here

for i in range(len(models)):
    model = models[i]
    param = params[i]
    line_types = ['red', 'green', 'blue', 'black']
    t, w = model.perform_integration(param)

    t, A_conc_data, B_conc_data, C_conc_data, B_joined_conc_data = model.unpack_concentrations_from_ode_format(
        w, t)

    #simulated C tube distributions with time
示例#3
0

#xfmt = matplotlib.ticker.ScalarFormatter()
#xfmt.set_powerlimits((-3,3))

f_cost_fxns, axarr_cost_fxns = plt.subplots(3,3, sharex = False, sharey = False, figsize = (9,9))


#here starts the main script to brute force try many constant joining values and evaluate the error with expt
#*abdul sees 3e6 per molar per second in his work*
#the kjoins predicted by bernie/hill are ~20 and ~2, so fairly close to 1, makes sense that roughly the same range of param would work

#this script will perform the same brute force search as the original brute_force_parameter_search but it will use three different cost functions
#and will output a 3x3 grid of subplots for inclusion in our paper

jode_constant = joining_ode_class.ODE_joining('constant')
jode_hill = joining_ode_class.ODE_joining('hill')
jode_bernie = joining_ode_class.ODE_joining('bernie')
plot_dir_name = "bin10/optimal_parameter/"
n_bootstrap = 1 
n_bins = 10
max_tube_length = 10.0

models = ['constant','hill','bernie']
cost_fxns = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]

for model in models:
	for cost_fxn in cost_fxns:
		jode = joining_ode_class.ODE_joining(joining_model = model, weight_joining_percentage = cost_fxn[0], weight_a_cdf = cost_fxn[1], weight_c_cdf = cost_fxn[2])
		if model == 'hill':
			param_list = np.linspace(1e10, 1.5e11, 100)
示例#4
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#script to generate data files needed for plotting
import numpy as np
import joining_ode_class
import matplotlib.pyplot as plt

jode_constant = joining_ode_class.ODE_joining('constant')
jode_hill = joining_ode_class.ODE_joining('hill')
jode_bernie = joining_ode_class.ODE_joining('bernie')
plot_dir_name = "bin10/bootstrapping/"

params = [.4e7, .6e11, 1e8]  #optimized parameters
models = [jode_constant, jode_hill, jode_bernie]

########################################################################################################
#plotting simulated distributions with time for each variable of interest here
for i in range(len(models)):
    model = models[i]
    param = params[i]
    line_types = ['red', 'green', 'blue', 'black']
    t, w = model.perform_integration(param)

    t, A_conc_data, B_conc_data, C_conc_data, B_joined_conc_data = model.unpack_concentrations_from_ode_format(
        w, t)

    #simulated C tube distributions with time
    for timepoint in range(len(t)):
        C_conc_timepoint = C_conc_data[timepoint]
        lengths = [
            float((bin + 1)) * model.bin_length