コード例 #1
0
         **shootingintegrand_kwargs,
         use_analytic_solution=use_analytic_solution,
         use_rnn_mode=use_particle_rnn_mode)
 elif args.shooting_model == '2nd_order':
     smodel = smodels.AutoShootingIntegrandModelSecondOrder(
         **shootingintegrand_kwargs, use_rnn_mode=use_particle_rnn_mode)
 elif args.shooting_model == 'updown':
     smodel = smodels.AutoShootingIntegrandModelUpDown(
         **shootingintegrand_kwargs,
         use_analytic_solution=use_analytic_solution,
         inflation_factor=inflation_factor,
         use_rnn_mode=use_particle_rnn_mode)
 elif args.shooting_model == 'updown_universal':
     smodel = smodels.AutoShootingIntegrandModelUpDownUniversal(
         **shootingintegrand_kwargs,
         use_analytic_solution=use_analytic_solution,
         inflation_factor=inflation_factor,
         use_rnn_mode=use_particle_rnn_mode)
 elif args.shooting_model == 'general_updown':
     smodel = smodels.AutoShootingIntegrandModelGeneralUpDown(
         **shootingintegrand_kwargs,
         use_analytic_solution=True,
         inflation_factor=inflation_factor,
         use_rnn_mode=use_particle_rnn_mode)
 elif args.shooting_model == 'periodic':
     smodel = smodels.AutoShootingIntegrandModelUpdownPeriodic(
         **shootingintegrand_kwargs,
         use_analytic_solution=use_analytic_solution,
         inflation_factor=inflation_factor,
         use_rnn_mode=use_particle_rnn_mode)
 elif args.shooting_model == 'dampened_updown':
コード例 #2
0
def setup_shooting_block(integrator=None,
                         in_features=20,
                         shooting_model='updown',
                         parameter_weight=1.0,
                         nr_of_particles=10,
                         inflation_factor=2,
                         nonlinearity='relu',
                         use_particle_rnn_mode=False,
                         use_particle_free_rnn_mode=False,
                         optimize_over_data_initial_conditions=False,
                         optimize_over_data_initial_conditions_type='linear'):

    if shooting_model == 'updown':
        smodel = shooting_models.AutoShootingIntegrandModelUpDown(
            in_features=in_features,
            nonlinearity=nonlinearity,
            parameter_weight=parameter_weight,
            inflation_factor=inflation_factor,
            nr_of_particles=nr_of_particles,
            particle_dimension=1,
            particle_size=in_features,
            use_analytic_solution=True,
            use_rnn_mode=use_particle_rnn_mode,
            optimize_over_data_initial_conditions=
            optimize_over_data_initial_conditions,
            optimize_over_data_initial_conditions_type=
            optimize_over_data_initial_conditions_type)
    elif shooting_model == 'updown_universal':
        smodel = shooting_models.AutoShootingIntegrandModelUpDownUniversal(
            in_features=in_features,
            nonlinearity=nonlinearity,
            parameter_weight=parameter_weight,
            inflation_factor=inflation_factor,
            nr_of_particles=nr_of_particles,
            particle_dimension=1,
            particle_size=in_features,
            use_analytic_solution=True,
            optional_weight=0.1,
            use_rnn_mode=use_particle_rnn_mode,
            optimize_over_data_initial_conditions=
            optimize_over_data_initial_conditions,
            optimize_over_data_initial_conditions_type=
            optimize_over_data_initial_conditions_type)
    elif shooting_model == 'periodic':
        smodel = shooting_models.AutoShootingIntegrandModelUpdownPeriodic(
            in_features=in_features,
            nonlinearity=nonlinearity,
            parameter_weight=parameter_weight,
            inflation_factor=inflation_factor,
            nr_of_particles=nr_of_particles,
            particle_dimension=1,
            particle_size=in_features,
            use_analytic_solution=True,
            use_rnn_mode=use_particle_rnn_mode,
            optimize_over_data_initial_conditions=
            optimize_over_data_initial_conditions,
            optimize_over_data_initial_conditions_type=
            optimize_over_data_initial_conditions_type)
    elif shooting_model == 'simple':
        smodel = shooting_models.AutoShootingIntegrandModelSimple(
            in_features=in_features,
            nonlinearity=nonlinearity,
            parameter_weight=parameter_weight,
            nr_of_particles=nr_of_particles,
            particle_dimension=1,
            particle_size=in_features,
            use_analytic_solution=True,
            use_rnn_mode=use_particle_rnn_mode)

    print('Using shooting model {}'.format(shooting_model))

    par_initializer = pi.VectorEvolutionParameterInitializer(
        only_random_initialization=True, random_initialization_magnitude=0.5)
    smodel.set_state_initializer(state_initializer=par_initializer)

    shooting_block = shooting_blocks.ShootingBlockBase(
        name='simple',
        shooting_integrand=smodel,
        use_particle_free_rnn_mode=use_particle_free_rnn_mode,
        integrator=integrator)

    return shooting_block
コード例 #3
0
for current_model in check_models:

    if current_model == 'simple':
        shooting_model = shooting_models.AutoShootingIntegrandModelSimple(
            in_features=in_features_size,
            nonlinearity=nonlinearity,
            nr_of_particles=nr_of_particles,
            particle_dimension=1,
            particle_size=in_features_size,
            parameter_weight=parameter_weight)
    elif current_model == 'updown_universal':
        shooting_model = shooting_models.AutoShootingIntegrandModelUpDownUniversal(
            in_features=in_features_size,
            nonlinearity=nonlinearity,
            nr_of_particles=nr_of_particles,
            particle_dimension=1,
            particle_size=in_features_size,
            parameter_weight=parameter_weight,
            inflation_factor=5)

    elif current_model == 'updown':
        shooting_model = shooting_models.AutoShootingIntegrandModelUpDown(
            in_features=in_features_size,
            nonlinearity=nonlinearity,
            nr_of_particles=nr_of_particles,
            particle_dimension=1,
            particle_size=in_features_size,
            parameter_weight=parameter_weight,
            inflation_factor=5)

    elif current_model == 'DEBUG':