Skip to content

Bump matminer from 0.8.0 to 0.9.0 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions modnet/featurizers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
__all__ = ("clean_df",)


def clean_df(df):
def clean_df(df, drop_allnan: bool = True):
"""Cleans dataframe by dropping missing values, replacing NaN's and infinities
and selecting only columns containing numerical data.

Args:
df (pd.DataFrame): the dataframe to clean.
drop_allnan: if True, clean_df will remove features that are fully NaNs.

Returns:
pandas.DataFrame: the cleaned dataframe.

"""

df = df.select_dtypes(include="number")
df = df.dropna(axis=1, how="all")
if drop_allnan:
df = df.dropna(axis=1, how="all")
df = df.replace([np.inf, -np.inf, np.nan], np.nan)

return df
5 changes: 5 additions & 0 deletions modnet/models/vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,11 @@ def _restore_model(self):
fill_value=-1,
).fit(np.zeros((1, self.n_feat))),
)
if not hasattr(self, "targets_groups"):
self.targets_groups = [x for subl in self.targets for x in subl]
LOG.warning(
"Installed modnet version (v>=0.4.0) does not match loaded model (v<0.4.0) and may result in errors. Please retrain or change your modnet version !"
)

def save(self, filename: str) -> None:
"""Save the `MODNetModel` to filename:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tensorflow==2.11.0
tensorflow-probability==0.19.0
pandas==1.5.2
pymatgen==2023.1.30
matminer==0.8.0
matminer==0.9.0
numpy>=1.20
scikit-learn==1.2.0
emmet-core<0.57 # Can remove after https://github.com/materialsproject/api/issues/819