Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
muammar committed Oct 28, 2019
1 parent ddb1d42 commit 3fadbcc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ml4chem/data/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def set(self, purpose):
self.preprocessor = joblib.load(self.preprocessing)

else:
logger.warning("Preprocessor is not supported.")
logger.warning("{} with {} is not supported.".format(self.preprocessing, self.kwargs))
self.preprocessor = preprocessor_name = None


if purpose == "training" and preprocessor_name is not None:
logger.info("Data preprocessing")
Expand Down
6 changes: 4 additions & 2 deletions ml4chem/data/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,11 @@ def plot_atomic_features(latent_space, method="PCA", dimensions=2, backend="seab
if dimensions == 3 and backend == "plotly":
args["color"] = "Symbol"
plt = px.scatter_3d(df, **args)
plt.update_traces(marker=dict(size=4))
plt.update_traces(marker=dict(size=2))
elif dimensions == 2 and backend == "plotly":
args["color"] = "Symbol"
plt = px.scatter(df, **args)
plt.update_traces(marker=dict(size=2))
elif dimensions == 3 and backend == "seaborn":
raise ("This backend is for 2D visualization")
elif dimensions == 2 and backend == "seaborn":
Expand Down Expand Up @@ -300,10 +301,11 @@ def plot_atomic_features(latent_space, method="PCA", dimensions=2, backend="seab
if dimensions == 3 and backend == "plotly":
args["color"] = "Symbol"
plt = px.scatter_3d(df, **args)
plt.update_traces(marker=dict(size=4))
plt.update_traces(marker=dict(size=2))
elif dimensions == 2 and backend == "plotly":
args["color"] = "Symbol"
plt = px.scatter(df, **args)
plt.update_traces(marker=dict(size=2))
elif dimensions == 3 and backend == "seaborn":
raise ("This backend is for 2D visualization")
elif dimensions == 2 and backend == "seaborn":
Expand Down
3 changes: 2 additions & 1 deletion ml4chem/potentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Potentials(Calculator, object):
# This is a good way to make attributes available to the class. This can be
# accessed as Potentials.attribute
svm_models = ["KernelRidge", "GaussianProcess"]
autoencoders = ["AutoEncoder", "VAE"]
module_names = {
"PytorchPotentials": "neuralnetwork",
"PytorchIonicPotentials": "ionic",
Expand Down Expand Up @@ -175,7 +176,7 @@ def save(model=None, features=None, path=None, label="ml4chem"):

torch.save(model.state_dict(), path + ".ml4c")

if model_name == "AutoEncoder":
if model_name in Potentials.autoencoders:
output_dimension = {"output_dimension": model.output_dimension}
params["model"].update(output_dimension)
else:
Expand Down

0 comments on commit 3fadbcc

Please sign in to comment.