Пример #1
0
def create_problem(load_data):
    Problem = NaProblem(seed=2019)

    Problem.load_data(load_data)

    #Problem.preprocessing(minmaxstdscaler)

    Problem.search_space(create_search_space, num_layers=10)

    Problem.hyperparameters(
        verbose=0,
        batch_size=100,
        learning_rate=0.001,  #lr search: 0.01, lr post: 0.001
        optimizer='adam',
        num_epochs=50,
        callbacks=dict(EarlyStopping=dict(
            monitor='val_r2', mode='max', verbose=0, patience=5)))

    Problem.loss('mse')

    Problem.metrics(['r2'])

    Problem.objective('val_r2__last')

    Problem.post_training(num_epochs=1000,
                          metrics=['r2'],
                          callbacks=dict(ModelCheckpoint={
                              'monitor': 'val_r2',
                              'mode': 'max',
                              'save_best_only': True,
                              'verbose': 1
                          },
                                         EarlyStopping={
                                             'monitor': 'val_r2',
                                             'mode': 'max',
                                             'verbose': 1,
                                             'patience': 50
                                         },
                                         TensorBoard=dict(log_dir='{}'.format(
                                             time.time()), )))

    if __name__ == '__main__':
        print(Problem)
        from pprint import pprint
        pprint(Problem.space)
Пример #2
0
Problem.hyperparameters(
    batch_size=64,
    learning_rate=0.001,
    optimizer='adam',
    num_epochs=1,
)

Problem.loss('mse')

Problem.metrics(['r2'])

Problem.objective('val_r2__last')

Problem.post_training(num_epochs=1000,
                      metrics=['r2'],
                      model_checkpoint={
                          'monitor': 'val_r2',
                          'mode': 'max',
                          'save_best_only': True,
                          'verbose': 1
                      },
                      early_stopping={
                          'monitor': 'val_r2',
                          'mode': 'max',
                          'verbose': 1,
                          'patience': 20
                      })

if __name__ == '__main__':
    print(Problem)
Пример #3
0
Problem.objective('r2__max')  # or 'val_acc__last' ?

Problem.post_training(
    repeat=1,
    num_epochs=1000,
    metrics=["mse", "r2"],
    callbacks=dict()
    # callbacks=dict(
    #     ModelCheckpoint={
    #         'monitor': 'val_r2',
    #         'mode': 'max',
    #         'save_best_only': True,
    #         'verbose': 1
    #     },
    #     EarlyStopping={
    #         'monitor': 'val_r2',
    #         'mode': 'max',
    #         'verbose': 1,
    #         'patience': 10
    #     },
    #     TensorBoard={
    #         'log_dir':'tb_logs',
    #         'histogram_freq':1,
    #         'batch_size':64,
    #         'write_graph':True,
    #         'write_grads':True,
    #         'write_images':True,
    #         'update_freq':'epoch'
    #     })
)

# Just to print your problem, to test its definition and imports in the current python environment.
Пример #4
0
    callbacks=dict(EarlyStopping=dict(
        monitor='val_r2', mode='max', verbose=0, patience=5)))

Problem.loss('mse')

Problem.metrics(['r2'])

Problem.objective('val_r2__last')

Problem.post_training(num_epochs=1000,
                      metrics=['r2'],
                      callbacks=dict(ModelCheckpoint={
                          'monitor': 'val_r2',
                          'mode': 'max',
                          'save_best_only': True,
                          'verbose': 1
                      },
                                     EarlyStopping={
                                         'monitor': 'val_r2',
                                         'mode': 'max',
                                         'verbose': 1,
                                         'patience': 50
                                     },
                                     TensorBoard=dict(log_dir='{}'.format(
                                         time.time()), )))

if __name__ == '__main__':
    print(Problem)
    from pprint import pprint
    pprint(Problem.space)