def time_euclidean_distance_learning():
    "run learning with Euc distance to see the time taken and compare with chemical_distance"

    db = DB("y4_python/11k_molecule_database_eV.db")
    reg = MyRegression(db)
    mol_list = db.get_mol_ids()
    pm7_energies = db.get_pm7_energies()
    blyp_energies = db.get_blyp_energies()
    deviation_list = (list(
        map(reg.distance_from_regress, pm7_energies, blyp_energies)))

    main_euclidean_distance(k_neighbours=5,
                            k_folds=10,
                            metric_params={},
                            mol_list=mol_list,
                            deviation_list=deviation_list)
def time_chemical_distance_learning():
    "run learning with different params to see what takes the longest. Use limited set of data so it doesn't take so long on each run."

    db = DB("y4_python/11k_molecule_database_eV.db")
    reg = MyRegression(db)

    cutoff = 1000

    mol_list = db.get_mol_ids()[:cutoff]
    pm7_energies = db.get_pm7_energies()[:cutoff]
    blyp_energies = db.get_blyp_energies()[:cutoff]
    deviation_list = (list(
        map(reg.distance_from_regress, pm7_energies, blyp_energies)))
    fingerprint_list = db.get_fingerprints()[:cutoff]
    homo_list = db.get_homo_molecular_orbitals()[:cutoff]
    lumo_list = db.get_lumo_molecular_orbitals()[:cutoff]

    params = MetricParams(homo_coeff=1.0,
                          lumo_coeff=0.0,
                          fingerprint_list=fingerprint_list,
                          homo_orbital_list=homo_list,
                          lumo_orbital_list=lumo_list,
                          c_struct=0.0,
                          c_orbital=1.0,
                          inertia_coefficient=0.0,
                          IPR_coefficient=0.0,
                          N_coefficient=0.0,
                          O_coefficient=0.0,
                          S_coefficient=0.0,
                          P_coefficient=0.0,
                          radial_distribution_coeff=1.0)

    results = main_chemical_distance(k_neighbours=5,
                                     k_folds=10,
                                     metric_params=params,
                                     mol_list=mol_list,
                                     deviation_list=deviation_list,
                                     save=False)
    print(results)

if __name__ == "__main__":
    c_struct_lim = (0.0, 10.0)
    c_orbital_lim = (0.0, 10.0)
    bounds = [c_struct_lim] + [
        c_orbital_lim
    ]  # this will be whatever hyperparameters you want to optimize. The length of this sequence is what indicates the number of hyperparameters mini_args = (X, y, condition,fixed_hyperparams) # this will be a tuple with the rest of arguments needed for your function NCPU = 20 # this will be the number of CPUs you want

    num_CPU = 20

    db = DB("y4_python/11k_molecule_database_eV.db")
    my_regression = MyRegression(db)
    mol_list = db.get_mol_ids()
    pm7_energies = db.get_pm7_energies()
    blyp_energies = db.get_blyp_energies()
    deviation_list = (list(
        map(my_regression.distance_from_regress, pm7_energies, blyp_energies)))
    fingerprint_list = db.get_fingerprints()
    homo_molecular_orbital_list = db.get_homo_molecular_orbitals()
    lumo_molecular_orbital_list = db.get_lumo_molecular_orbitals()

    fixed_hyperparams = MetricParams(
        homo_coeff=1.0,
        lumo_coeff=0.0,
        fingerprint_list=fingerprint_list,
        homo_orbital_list=homo_molecular_orbital_list,
        lumo_orbital_list=lumo_molecular_orbital_list,
        c_struct=0.0  # TO BE OPTIMISED...
        ,
        c_orbital=0.0  # TO BE OPTIMISED...