Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 1, 2024
1 parent cbebea2 commit 4decd44
Show file tree
Hide file tree
Showing 16 changed files with 13 additions and 19 deletions.
1 change: 0 additions & 1 deletion notebooks/boston_housing_hmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
NN performance on the simple Boston housing dataset.
"""


# %%
import tensorflow as tf
import tensorflow_probability as tfp
Expand Down
1 change: 0 additions & 1 deletion notebooks/data/feature_manifolds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
several dimensional reduction algorithms (t-SNE, UMAP, PCA) to check for clustering.
"""


# %%
import matplotlib.pyplot as plt
import pandas as pd
Expand Down
1 change: 0 additions & 1 deletion notebooks/data/gaultois_stats/gaultois_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
the four target columns in the Gaultois database: rho, seebeck, kappa, zT.
"""


# %%
import matplotlib.pyplot as plt
import numpy as np
Expand Down
1 change: 0 additions & 1 deletion notebooks/dropout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
figure of merit (zT).
"""


# %%
import matplotlib.pyplot as plt

Expand Down
1 change: 0 additions & 1 deletion notebooks/hmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Hamiltonian Monte Carlo (HMC).
"""


# %%
from functools import partial

Expand Down
1 change: 0 additions & 1 deletion notebooks/leaderboard/cv.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Cross-validated benchmarks."""


# %%
import pickle
from functools import partial
Expand Down
1 change: 0 additions & 1 deletion notebooks/leaderboard/mnf_vs_rf/mnf_vs_rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
automatminer-generated subselection of magpie features.
"""


# %%
import os

Expand Down
1 change: 0 additions & 1 deletion notebooks/random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
of merit (zT).
"""


# %%
import numpy as np

Expand Down
1 change: 0 additions & 1 deletion notebooks/relaxation_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
to experimentally non-measured temperatures.
"""


# %%
import matplotlib.pyplot as plt
import numpy as np
Expand Down
1 change: 0 additions & 1 deletion notebooks/screen/dft.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
risk management. See src/notsbooks/screen/random_forest.py for details.
"""


# %%
import pandas as pd
from matplotlib import pyplot as plt
Expand Down
1 change: 0 additions & 1 deletion notebooks/screen/mnf_magpie/mnf_magpie_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
for viable thermoelectrics.
"""


# %%
import os

Expand Down
1 change: 0 additions & 1 deletion notebooks/screen/random_forest_magpie/random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
regression.
"""


# %%
import os
import pickle
Expand Down
1 change: 0 additions & 1 deletion thermo/data/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
- thermoelectric figure of merit (zT): dimensionless
"""


import numpy as np
import pandas as pd

Expand Down
1 change: 1 addition & 0 deletions thermo/rf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""If enough time, compare our implementation
with https://github.com/CitrineInformatics/lolo.
"""

from collections.abc import Sequence
from typing import Any

Expand Down
10 changes: 6 additions & 4 deletions thermo/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ def predict_multiple_targets(pred_func, X_train, y_train, X_test, y_test=None):

processed = [
# convert lists and arrays to dataframes, restoring former label names and index
pd.DataFrame(np.array(x).T, columns=col_names, index=idx)
if isinstance(x[0], np.ndarray)
# convert single-entry results (e.g. trained models) to dicts named by label
else dict(zip(col_names, x))
(
pd.DataFrame(np.array(x).T, columns=col_names, index=idx)
if isinstance(x[0], np.ndarray)
# convert single-entry results (e.g. trained models) to dicts named by label
else dict(zip(col_names, x))
)
# transpose results so first dim is different result types (y_pred, y_var, etc.)
# where before first dim was different targets
for x in zip(*results)
Expand Down
8 changes: 6 additions & 2 deletions thermo/utils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ def wrapped_function(*args, **kwargs):
try:
return func(*args, **kwargs)
except KeyboardInterrupt:
handler() if handler else print(
f"\nDetected KeyboardInterrupt: Aborting call to {func.__name__}"
(
handler()
if handler
else print(
f"\nDetected KeyboardInterrupt: Aborting call to {func.__name__}"
)
)

return wrapped_function
Expand Down

0 comments on commit 4decd44

Please sign in to comment.