Exemplo n.º 1
0
#after generations, do 25 more at a time and test for convergence
test_size = 25

################## neuron /data specific specifications #############
ntype = 'arky'
morph_file = 'GP_arky_41comp.p'
dataname = 'arky120'
exp_to_fit = gpe.data[dataname + '-2s'][[0, 2, 4]]

dirname = 'cond_' + dataname + str(seed)
if not dirname in os.listdir(rootdir):
    os.mkdir(rootdir + dirname)
os.chdir(rootdir + dirname)

######## set up parameters and fitness to be used for all opts  ############
params1, fitness = pfc.params_fitness(morph_file, ntype, modeltype)

# set-up and do the optimization
fit1 = fit_commands.fit_commands(dirname, exp_to_fit, modeltype, ntype,
                                 fitness, params1, generations, popsiz, seed,
                                 test_size)
if test_size > 0:
    mean_dict, std_dict, CV = converge.iterate_fit(fit1,
                                                   test_size,
                                                   popsiz,
                                                   std_crit=0.02,
                                                   max_evals=12000)

###########look at results
drawing.plot_history(fit1, fit1.measurement)
Exemplo n.º 2
0
#after generations, do 25 more at a time and test for convergence
test_size = 25

################## neuron /data specific specifications #############
ntype = 'D1'
morph_file = 'MScell-primDend.p'
dataname = 'non05Jan2015_SLH004'
exp_to_fit = a2a.alldata[dataname][[0, 20]]  #0,6 are hyperpol

dirname = 'tmp_' + dataname + str(seed)
if not dirname in os.listdir(rootdir):
    os.mkdir(rootdir + dirname)
os.chdir(rootdir + dirname)

######## set up parameters and fitness
params, fitness = params_fitness.params_fitness(morph_file, ntype, modeltype,
                                                ghkkluge)

########### set-up and do optimization
fit, mean_dict, std_dict, CV = fit_commands.fit_commands(
    dirname, exp_to_fit, modeltype, ntype, fitness, params, generations,
    popsiz, seed, test_size)

#look at results
drawing.plot_history(fit, fit.measurement)

#Save parameters of good results from end of optimization, and all fitness values
startgood = 0  #set to 0 to print all
threshold = 5  #set to large number to print all

save_params.save_params(fit, startgood, threshold)