Skip to content

Commit

Permalink
Use client.submit instead of dask.compute for SVM computations Gaussian.
Browse files Browse the repository at this point in the history
  • Loading branch information
muammar committed Jan 19, 2020
1 parent 96453bc commit 0a41f49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 3 additions & 4 deletions ml4chem/data/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error
from ml4chem.data.serialization import load
import time


def parity(predictions, true, scores=False, filename=None, **kwargs):
Expand All @@ -30,7 +29,7 @@ def parity(predictions, true, scores=False, filename=None, **kwargs):

min_val = min(true)
max_val = max(true)
fig = plt.figure(figsize=(6.0, 6.0))
fig = plt.figure(figsize=(6, 6))
ax = fig.add_subplot(111)
ax.plot(true, predictions, "r.")
ax.plot([min_val, max_val], [min_val, max_val], "k-", lw=0.3)
Expand Down Expand Up @@ -284,7 +283,7 @@ def plot_atomic_features(

labels = {str(axis[i]): "t-SNE-{}".format(i + 1) for i in range(len(axis))}

tsne = manifold.TSNE(n_components=dimensions)
tsne = manifold.TSNE(n_components=dimensions, perplexity=5)

tsne_result = tsne.fit_transform(full_ls)

Expand Down Expand Up @@ -324,4 +323,4 @@ def plot_atomic_features(
except:
pass

return plt
return plt, df
8 changes: 3 additions & 5 deletions ml4chem/features/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ def calculate(self, images=None, purpose="training", data=None, svm=False):

scaled_feature_space.append(features)

# scaled_feature_space = client.gather(scaled_feature_space)

else:
scaled_feature_space = []
Expand Down Expand Up @@ -397,13 +396,12 @@ def calculate(self, images=None, purpose="training", data=None, svm=False):

# image = (hash, ase_image) -> tuple
for atom in image[1]:
reference_space.append(
self.restack_atom(i, atom, scaled_feature_space)
)
restacked_atom = client.submit(self.restack_atom, *(i, atom, scaled_feature_space))
reference_space.append(restacked_atom)

feature_space.append(restacked)

reference_space = dask.compute(*reference_space, scheduler=self.scheduler)
reference_space = client.gather(reference_space)

elif svm is False and purpose == "training":
for i, image in enumerate(images.items()):
Expand Down

0 comments on commit 0a41f49

Please sign in to comment.