Skip to content
This repository was archived by the owner on Dec 8, 2024. It is now read-only.

Develop #94

Merged
merged 65 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
baa57eb
Merge remote-tracking branch 'upstream/develop' into develop
SilviaAmAm Jul 30, 2018
ceb9ef5
Merge remote-tracking branch 'upstream/develop' into develop
SilviaAmAm Aug 15, 2018
d974133
SilviaAmAm Aug 24, 2018
8a3fbf3
Started updating so that model can be trained after its been reloaded
SilviaAmAm Aug 24, 2018
7a2dc7e
SilviaAmAm Aug 25, 2018
b33a537
Merge remote-tracking branch 'upstream/develop' into develop
SilviaAmAm Aug 25, 2018
5525d3b
Updated model so one can predict from xyz and disabled shuffling in t…
SilviaAmAm Aug 26, 2018
bb28c4a
SilviaAmAm Aug 27, 2018
4b29b95
Added some tests to make sure the predictions work
SilviaAmAm Aug 27, 2018
a4dc496
SilviaAmAm Aug 27, 2018
ef5c880
SilviaAmAm Aug 28, 2018
d1e27ad
SilviaAmAm Aug 28, 2018
f3a3e9c
Modified the name of a parameter
SilviaAmAm Aug 29, 2018
c77272e
Made modifications to make te symmetry functions more numerically stable
SilviaAmAm Aug 31, 2018
3db69a3
SilviaAmAm Sep 5, 2018
acf0ee7
SilviaAmAm Sep 5, 2018
49b36c2
SilviaAmAm Sep 6, 2018
75aac67
SilviaAmAm Sep 6, 2018
1f694f8
SilviaAmAm Sep 7, 2018
e5c4787
Attempt at fixing issue #10
SilviaAmAm Sep 11, 2018
fef6fba
another attempt at fixing #10
SilviaAmAm Sep 11, 2018
61fefce
Removed a pointless line
SilviaAmAm Sep 12, 2018
386be84
Merge
SilviaAmAm Sep 13, 2018
4c050f7
set-up
SilviaAmAm Sep 13, 2018
3bdd928
SilviaAmAm Sep 13, 2018
81c9824
Modifications which prevent installation from breaking on BC4
Sep 13, 2018
f4a7424
Merge branch 'kill_gracefully' into develop
SilviaAmAm Sep 13, 2018
4a41f14
Modification to add neural networks to qmlearn
SilviaAmAm Sep 14, 2018
7d7f580
Merge remote-tracking branch 'upstream/develop' into develop_qmlearn
SilviaAmAm Sep 18, 2018
898b640
Fix for issue #8
SilviaAmAm Sep 21, 2018
f77d040
SilviaAmAm Sep 24, 2018
2d5988f
SilviaAmAm Sep 24, 2018
da8b524
SilviaAmAm Sep 25, 2018
227e2b8
SilviaAmAm Sep 25, 2018
250031d
SilviaAmAm Sep 25, 2018
687291b
uncommented examples
SilviaAmAm Sep 25, 2018
4391906
Removed unique_elements in data class
larsbratholm Sep 26, 2018
2fb8d39
Made tensorflow an optional dependency
larsbratholm Sep 26, 2018
819fa71
Made is_numeric non-private and removed legacy code
larsbratholm Sep 26, 2018
20ca689
Added 1d array util function
larsbratholm Sep 27, 2018
9ef8c10
Removed QML check and moved functions from utils to tf_utils
larsbratholm Sep 27, 2018
00a2a7c
Support for linear models (no hidden layers)
larsbratholm Sep 27, 2018
a925ee0
fixed import bug in tf_utils
larsbratholm Sep 27, 2018
c8cf008
Added text to explain that you are scoring on training set
larsbratholm Sep 27, 2018
96713c0
Restructure.
larsbratholm Sep 28, 2018
f313eff
Moved documentation from init to class
larsbratholm Sep 28, 2018
20b78b8
Constant features will now be removed at fit/predict time
larsbratholm Sep 28, 2018
4b785f1
Moved get_batch_size back into utils, since it doesn't depend on tf
larsbratholm Sep 28, 2018
8d62084
Made the NeuralNetwork class compliant with sklearn
larsbratholm Sep 28, 2018
d8447e7
Fixed tests that didn't pass
larsbratholm Sep 28, 2018
a8f6062
Fixed mistake in checks of set_classes() in ARMP
SilviaAmAm Sep 28, 2018
d4d98b6
SilviaAmAm Oct 1, 2018
9539704
Merge remote-tracking branch 'upstream/develop' into develop
SilviaAmAm Oct 1, 2018
2b22aa3
Fixed bug in padding and added examples that give low errors
SilviaAmAm Oct 1, 2018
8f082c5
Attempted fix to make representations single precision
SilviaAmAm Oct 2, 2018
21fd2fd
Hot fix for AtomScaler
SilviaAmAm Oct 2, 2018
f2f7770
Merge pull request #13 from larsbratholm/nn_qmlearn
Oct 2, 2018
999301d
Merge branch 'develop_qmlearn' into develop
SilviaAmAm Oct 2, 2018
9ce72c6
Minor bug fixes
SilviaAmAm Oct 2, 2018
70e8622
SilviaAmAm Oct 2, 2018
89dfda9
Fixed some tests that had failures
SilviaAmAm Oct 3, 2018
908da82
SilviaAmAm Oct 3, 2018
c47ad62
SilviaAmAm Oct 3, 2018
fdc485e
Readded changes to tests
SilviaAmAm Oct 3, 2018
255ea74
Modifications after code review
SilviaAmAm Oct 3, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 76 additions & 34 deletions docs/source/qml_examples/examples.ipynb

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions examples/ARMP_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@

## ------------- ** 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)
acsf_params = {"nRs2": 5, "nRs3": 5, "nTs": 5, "rcut": 5, "acut": 5, "zeta": 220.127, "eta": 30.8065}
estimator = ARMP(iterations=5000, representation_name='acsf', representation_params=acsf_params, tensorboard=False,
learning_rate=0.075, l1_reg=0.0, l2_reg=0.0)

estimator.generate_compounds(filenames)
estimator.set_properties(energies)
Expand Down
2 changes: 1 addition & 1 deletion examples/ARMP_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

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

estimator = ARMP(iterations=100, l2_reg=0.0)
estimator = ARMP(iterations=3000, learning_rate=0.075, l1_reg=0.0, l2_reg=0.0, tensorboard=True, store_frequency=50)

estimator.set_representations(representations=descriptor)
estimator.set_classes(zs)
Expand Down
2 changes: 1 addition & 1 deletion examples/ARMP_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

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

estimator = ARMP(iterations=150, l2_reg=0.0, learning_rate=0.005, hidden_layer_sizes=(40, 20, 10))
estimator = ARMP(iterations=3000, learning_rate=0.075, l1_reg=0.0, l2_reg=0.0, tensorboard=True, store_frequency=50)

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

Expand Down
41 changes: 41 additions & 0 deletions examples/ARMP_qm7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
This example shows how to use ARMP to overfit 100 data-points for the QM7 data set. It uses the Atom Centred Symmetry
functions as the representation.

This example takes about 3.5 min to run on a mac.
"""

from qml.aglaia.aglaia import ARMP
import glob
import numpy as np
import matplotlib.pyplot as plt
from sklearn import model_selection as modsel

filenames = sorted(glob.glob("../test/qm7/*.xyz"))
energies = np.loadtxt("../test/data/hof_qm7.txt", usecols=[1])
n_samples = len(filenames)
print("%i files were loaded." % (n_samples))

acsf_params = {"nRs2": 5, "nRs3": 5, "nTs": 5, "rcut": 5, "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="fortran")
print("The shape of the representation is: %s" % (str(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)))

ene_pred = estimator.predict(idx_train)

# Plotting the predictions against the true values
plt.scatter(energies[idx_train], ene_pred)
plt.show()
2 changes: 1 addition & 1 deletion examples/MRMP_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

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

estimator = MRMP(representation='slatm', representation_params={'slatm_dgrid2': 0.06, 'slatm_dgrid1': 0.06})
estimator = MRMP(representation_name='slatm', representation_params={'slatm_dgrid2': 0.06, 'slatm_dgrid1': 0.06})

estimator.generate_compounds(filenames[:100])
estimator.set_properties(energies[:100])
Expand Down
60 changes: 60 additions & 0 deletions examples/qmlearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,64 @@ def pipelines():
print("*** End pipelines examples ***")
print()

def pipelines_2():
"""
Scikit learn pipeline with a molecular neural network
"""

print("\n *** Begin pipelines example with molecular Neural Network ***")

data = qmlearn.Data("../test/qm7/*.xyz")
energies = np.loadtxt("../test/data/hof_qm7.txt", usecols=1)
data.set_energies(energies)

# Create model
model = sklearn.pipeline.make_pipeline(
qmlearn.preprocessing.AtomScaler(data),
qmlearn.representations.CoulombMatrix(),
qmlearn.models.NeuralNetwork(iterations=500, batch_size=50, learning_rate=0.005),
)

indices = np.arange(1000)
np.random.shuffle(indices)

model.fit(indices[:100])

# Score on the TRAINING set, since you won't get good predictions in 500 iterations
scores = model.score(indices[:100])
print("Negative MAE:", scores)

print("*** End pipelines example with molecular Neural Network *** \n")

def pipelines_3():
"""
Scikit learn pipeline with an atomic neural network
"""

print("\n *** Begin pipelines example with atomic Neural Network ***")

data = qmlearn.Data("../test/qm7/*.xyz")
energies = np.loadtxt("../test/data/hof_qm7.txt", usecols=1)
data.set_energies(energies)

# Create model
model = sklearn.pipeline.make_pipeline(
qmlearn.preprocessing.AtomScaler(data),
qmlearn.representations.AtomCenteredSymmetryFunctions(),
qmlearn.models.NeuralNetwork(iterations=500, batch_size=50, learning_rate=0.005),
)

indices = np.arange(1000)
np.random.shuffle(indices)

model.fit(indices[:100])

# Score on the TRAINING set, since you won't get good predictions in 500 iterations
scores = model.score(indices[:100])
print("Negative MAE:", scores)

print("*** End pipelines example with atomic Neural Network *** \n")

def cross_validation():
"""
Doing cross validation with qmlearn
Expand Down Expand Up @@ -285,3 +343,5 @@ def cross_validation():
models()
pipelines()
cross_validation()
pipelines_2()
pipelines_3()
Loading