コード例 #1
0
            efel_feature_means[protocol_name].items():
        feature_name = '%s.%s' % (protocol_name, efel_feature_name)
        feature = nrpel.efeatures.eFELFeature(
            feature_name,
            efel_feature_name=efel_feature_name,
            recording_names={'': '%s.soma.v' % protocol_name},
            stim_start=stim_start,
            stim_end=stim_end,
            exp_mean=mean,
            exp_std=0.05 * mean)
        objective = objective = nrpel.objectives.SingletonObjective(
            feature_name, feature)
        objectives.append(objective)

score_calc = nrpel.scorecalculators.ObjectivesScoreCalculator(objectives)
cell_evaluator = nrpel.cellevaluator.CellEvaluator(
    cell_template=simple_cell,
    param_names=['gnabar_hh', 'gkbar_hh'],
    fitness_protocols=protocols,
    fitness_calculator=score_calc)

optimisation = nrp.Optimisation(
    evaluator=cell_evaluator,
    eval_function=cell_evaluator.evaluate_with_lists,
    offspring_size=10,
    use_scoop=True)

if __name__ == '__main__':
    final_pop, hall_of_fame, logs, hist = optimisation.run(max_ngen=2)
    print('BEST:', hall_of_fame[0])
コード例 #2
0
ファイル: opt_l5pc.py プロジェクト: wvangeit/BluePyOpt
# TODO store definition dicts in json
# TODO rename 'score' into 'objective'
# TODO add functionality to read settings of every object from config format

import l5pc_evaluator
evaluator = l5pc_evaluator.create()


def evaluate(parameter_array):
    """Global evaluate function"""

    return evaluator.evaluate(parameter_array)

opt = bluepyopt.Optimisation(
    evaluator=evaluator,
    eval_function=evaluate,
    offspring_size=2,
    use_scoop=True)


def main():
    """Main"""

    import argparse
    parser = argparse.ArgumentParser(description='L5PC example')
    parser.add_argument('--start', action="store_true")
    parser.add_argument('--continue_cp', action="store_true")
    parser.add_argument('--analyse', action="store_true")

    # TODO read checkpoint filename from arguments
    cp_filename = 'checkpoint.pkl'