Ejemplo n.º 1
0
    data = pd.read_csv('errors/li_durbin_errors_{0}.csv'.format(s))
    traces = []
    for n in islands:
        traces.append(Box(y=list(data[str(n)]), name=n))
    traces = Data(traces)
    layout = Layout(
        title='{0} switches errors'.format(s),
        xaxis=XAxis(
            title='Islands'
            ),
        yaxis=YAxis(
            title='Squared error'
        )
    )
    fig = Figure(data=traces, layout=layout)
    plot_url = py.plot(fig, filename='{0} switches'.format(s))

#########################
### Time distribution ###
#########################

file = 'individuals/{0}_switches/{1}_islands.json'

islands = 12

for s in switches:
    individual = json.loads(open(file.format(s, islands)).read())
    m = model.StSICMR(individual['n'], individual['T'], individual['M'])
    plotting.plotModel(m, liDurbin_tk, liDurbin_lk, logScale=True,
                       save=str(s), show=False)
Ejemplo n.º 2
0
l0 = 1 / l_list[0]
t_list *= l0
l_list *= l0

#########################
### Genetic Algorithm ###
#########################

# Build a group of models
pop = genalg.Population(model.StSICMR, t_list, l_list,
                        maxIslands=100, switches=3,
                        size=1000, repetitions=5)
# Enhance them all
pop.enhance(200)
# Plot the best one
plotting.plotModel(pop.best.model, t_list, l_list,
                   logScale=True)

################
### Boxplots ###
################

#switches = range(2, 7)
#islands = range(2, 31)
#for s in switches:
#    data = pd.DataFrame()
#    for n in islands:
#        errors = []
#        minError = np.inf
#        bestIndi = None
#        for _ in range(20):
#            pop = genalg.Population(model.StSICMR, liDurbin_tk, liDurbin_lk,
Ejemplo n.º 3
0
import sys
sys.path.append('../../lib/')
from inference import genalg
import model
import plotting
import psmcfit

data = psmcfit.get_psmc_history('Norduz.psmc')

times, lambdas = psmcfit.search_increase(data['times'], data['lambdas'])

l0 = 1 / lambdas[0]

times *= l0
lambdas *= l0

#~ # Build a group of models
pop = genalg.Population(model.StSICMR, times, lambdas,
                        maxIslands=100, switches=4,
                        size=1000, repetitions=4)
# Enhance them all
pop.enhance(1000)
# Plot the best one
plotting.plotModel(pop.best.model, times, lambdas, logScale=True)