Пример #1
0
def test_fit_1():
    """
    This function tests the first way of fitting the descriptor: the data is passed by first creating compounds and then
    the descriptors are created from the compounds.
    """
    test_dir = os.path.dirname(os.path.realpath(__file__))

    filenames = glob.glob(test_dir + "/CN_isobutane/*.xyz")
    energies = np.loadtxt(test_dir + '/CN_isobutane/prop_kjmol_training.txt',
                          usecols=[1])
    filenames.sort()

    estimator = ARMP(representation="acsf")
    estimator.generate_compounds(filenames[:50])
    estimator.set_properties(energies[:50])
    estimator.generate_representation()

    idx = np.arange(0, 50)
    estimator.fit(idx)
Пример #2
0
    "acut": 5,
    "zeta": 220.127,
    "eta": 30.8065
}
estimator = ARMP(iterations=6000,
                 representation_name='acsf',
                 representation_params=acsf_params,
                 l1_reg=0.0,
                 l2_reg=0.0,
                 scoring_function="rmse",
                 tensorboard=False,
                 store_frequency=10,
                 learning_rate=0.075)

estimator.set_properties(energies[:100])
estimator.generate_compounds(filenames[:100])
estimator.generate_representation(method="tf")
print(estimator.representation.shape)

idx = list(range(100))

idx_train, idx_test = modsel.train_test_split(idx,
                                              test_size=0,
                                              random_state=42,
                                              shuffle=True)

estimator.fit(idx_train)

score = estimator.score(idx_train)
print("The RMSE is %s kcal/mol." % (str(score)))
Пример #3
0
from qml.aglaia.aglaia import ARMP
import glob
import numpy as np
from sklearn import model_selection as modsel

test_dir = "/Volumes/Transcend/repositories/my_qml_fork/qml/test/"

filenames = glob.glob(test_dir + "/qm7/*.xyz")
energies = np.loadtxt(test_dir + '/data/hof_qm7.txt', usecols=[1])
filenames.sort()

n_samples = 500

estimator = ARMP(representation_name="acsf", iterations=100)
estimator.generate_compounds(filenames[:n_samples])
estimator.set_properties(energies[:n_samples])
estimator.generate_representation(method="fortran")

idx = np.arange(0, n_samples)
idx_train, idx_test = modsel.train_test_split(idx,
                                              random_state=42,
                                              shuffle=True,
                                              test_size=0.1)

estimator.fit(idx_train)

estimator.score(idx_train)
Пример #4
0
import numpy as np
import os

## ------------- ** Loading the data ** ---------------

current_dir = os.path.dirname(os.path.realpath(__file__))
filenames = glob.glob(current_dir + '/../test/CN_isobutane/*.xyz')
energies = np.loadtxt(current_dir + '/../test/CN_isobutane/prop_kjmol_training.txt', usecols=[1])
filenames.sort()

## ------------- ** Setting up the estimator ** ---------------

estimator = ARMP(iterations=10, representation='acsf', representation_params={"radial_rs": np.arange(0, 10, 1), "angular_rs": np.arange(0.5, 10.5, 1),
"theta_s": np.arange(0, 5, 1)}, tensorboard=False)

estimator.generate_compounds(filenames)
estimator.set_properties(energies)

estimator.generate_representation()

##  ------------- ** Fitting to the data ** ---------------

idx = np.arange(0,100)

estimator.fit(idx)


##  ------------- ** Predicting and scoring ** ---------------

score = estimator.score(idx)