Exemple #1
0
test_theorems = set(theorems) - set(train_theorems)

params_data_trans = {'features': features, 'chronology': chronology}
train_labels, train_array = prs.proofs_to_train(proofs_train,
                                                params_data_trans,
                                                n_jobs=N_JOBS,
                                                logfile=LOG_FILE)
params_train = {}
model = prs.train(train_labels,
                  train_array,
                  params=params_train,
                  n_jobs=N_JOBS,
                  logfile=LOG_FILE)
rankings_train = prs.Rankings(train_theorems,
                              model,
                              params_data_trans,
                              n_jobs=N_JOBS,
                              logfile=LOG_FILE)
rankings_test = prs.Rankings(test_theorems,
                             model,
                             params_data_trans,
                             n_jobs=N_JOBS,
                             logfile=LOG_FILE)
params_atp_eval = {}
proofs_train.update(
    prs.atp_evaluation(rankings_train,
                       statements,
                       params_atp_eval,
                       dirpath=ATP_DIR,
                       n_jobs=N_JOBS,
                       logfile=LOG_FILE))
statements = prs.Statements(from_file=join(DATA_DIR, 'statements'),
                            logfile=LOG_FILE)
features = prs.Features(from_file=join(DATA_DIR, 'features'), logfile=LOG_FILE)
chronology = prs.Chronology(from_file=join(DATA_DIR, 'chronology'),
                            logfile=LOG_FILE)
theorems = prs.utils.readlines(join(DATA_DIR, 'theorems_atpproved'))
params_data_trans = {
    'features': features,
    'chronology': chronology,
    'only_short_proofs': False
}

# randomly generated rankings
rankings_random = prs.Rankings(theorems,
                               model=None,
                               params=params_data_trans,
                               n_jobs=N_JOBS,
                               logfile=LOG_FILE)

proofs = prs.atp_evaluation(rankings_random,
                            statements,
                            dirpath=ATP_DIR,
                            n_jobs=N_JOBS,
                            logfile=LOG_FILE)

for i in range(40):
    prs.utils.printline("ITERATION: {}".format(i), LOG_FILE)
    train_labels, train_array = prs.proofs_to_train(proofs,
                                                    params_data_trans,
                                                    n_jobs=N_JOBS,
                                                    logfile=LOG_FILE)