Skip to content

Commit

Permalink
[FIX] versions, tests and minor issues with new versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapels committed Jan 15, 2025
1 parent aa5b3ce commit 4274fa2
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 42 deletions.
26 changes: 13 additions & 13 deletions extra-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
rdkit==2023.9.1: preprocessing, deep-learning, machine-learning, test
rdkit==2023.9.6: preprocessing, deep-learning, machine-learning, test
smilespe==0.0.3: preprocessing, deep-learning, machine-learning, test
seaborn==0.12.0: preprocessing, deep-learning, machine-learning, test
joblib==1.1.1: preprocessing, deep-learning, machine-learning, test
pillow==8.4.0: preprocessing, deep-learning, machine-learning, test
h5py==3.7.0: preprocessing, deep-learning, machine-learning, test
seaborn: preprocessing, deep-learning, machine-learning, test
joblib: preprocessing, deep-learning, machine-learning, test
pillow: preprocessing, deep-learning, machine-learning, test
h5py: preprocessing, deep-learning, machine-learning, test
cached_property==1.5.2: preprocessing, deep-learning, machine-learning, test
numpy==1.23.5: preprocessing, deep-learning, machine-learning, test
numpy: preprocessing, deep-learning, machine-learning, test
dill==0.3.6: preprocessing, deep-learning, machine-learning, test
shap==0.44.0: deep-learning, machine-learning
IPython: preprocessing, deep-learning, machine-learning
imblearn: preprocessing, machine-learning, deep-learning
umap-learn==0.5.1: machine-learning, deep-learning
kneed==0.8.2: machine-learning, deep-learning
kaleido==0.2.1: machine-learning, deep-learning
plotly==5.13.1: machine-learning, deep-learning
plotly: machine-learning, deep-learning
chembl_structure_pipeline==1.1.0: preprocessing, machine-learning, deep-learning
timeout_decorator==0.5.0: preprocessing, machine-learning, deep-learning
torch==2.1.2: deep-learning
torch==2.5.1: deep-learning
dgl<=2.0.0: deep-learning
scikeras==0.12.0: deep-learning
dgllife==0.3.2: deep-learning
deepchem==2.8.0: deep-learning
torch_geometric==2.3.1: deep-learning
torch_geometric==2.6.1: deep-learning
tensorflow==2.15.0: deep-learning
tensorflow-probability==0.22.1: deep-learning
boruta==0.3: preprocessing, machine-learning
scikit-learn==1.2.0: machine-learning, deep-learning
optuna==3.1.1: machine-learning, deep-learning
tensorflow-probability==0.25.0: deep-learning
boruta==0.4.3: preprocessing, machine-learning
scikit-learn<1.6: machine-learning, deep-learning
optuna==4.1.0: machine-learning, deep-learning
scikit-multilearn==0.2.0: machine-learning, deep-learning
pydantic: deep-learning
pytest>=7.1.1: test
Expand Down
26 changes: 13 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
rdkit==2023.9.1
rdkit==2023.9.6
smilespe==0.0.3
seaborn==0.12.0
torch==2.1.2
seaborn
torch==2.5.1
dgl<=2.0.0
joblib==1.1.1
pillow==8.4.0
h5py==3.7.0
joblib
pillow
h5py
shap==0.44.0
mol2vec @ git+https://github.com/samoturk/mol2vec#egg=mol2vec
boruta==0.3
boruta==0.4.3
tensorflow==2.15.0
chembl_structure_pipeline==1.1.0
scikit-learn==1.2.0
scikit-learn<1.6
imblearn
umap-learn==0.5.1
kneed==0.8.2
kaleido==0.2.1
plotly==5.13.1
plotly
cached_property==1.5.2
numpy==1.23.5
numpy
dgllife==0.3.2
dill==0.3.6
optuna==3.1.1
tensorflow-probability==0.22.1
torch_geometric==2.3.1
optuna==4.1.0
tensorflow-probability==0.25.0
torch_geometric==2.6.1
scikit-multilearn==0.2.0
scikeras==0.12.0
pydantic==2.6.4
Expand Down
12 changes: 6 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = deepmol
version = 1.1.10
version = 1.1.11
description = DeepMol: a python-based machine and deep learning framework for drug discovery
keywords = machine-learning, deep-learning, cheminformatics, drug-discovery
author = DeepMol Team
Expand All @@ -23,12 +23,12 @@ python_requires = >=3.9
zip_safe = False
include_package_data = True
install_requires =
rdkit==2023.9.1
rdkit==2023.9.6
cached_property==1.5.2
seaborn==0.12.0
joblib==1.1.1
pillow==8.4.0
h5py==3.7.0
seaborn
joblib
pillow
h5py
timeout_decorator==0.5.0

dependency_links=[
Expand Down
2 changes: 1 addition & 1 deletion src/deepmol/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

__version__ = '1.1.10'
__version__ = '1.1.11'
2 changes: 1 addition & 1 deletion src/deepmol/compound_featurization/base_featurizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def featurize(self,
remove_mols_list = np.array(remove_mols)
dataset.remove_elements(np.array(dataset.ids)[remove_mols_list], inplace=True)

features = np.array(features)
features = np.array(features, dtype=object)
features = features[~remove_mols_list]

if (isinstance(features[0], np.ndarray) and len(features[0].shape) == 2) or not isinstance(features[0],
Expand Down
3 changes: 1 addition & 2 deletions src/deepmol/imbalanced_learn/imbalanced_learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ def _sample(self) -> (np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray
"""
ros = over_sampling.SMOTE(sampling_strategy=self.sampling_strategy,
random_state=self.random_state,
k_neighbors=self.k_neighbors,
n_jobs=self.n_jobs)
k_neighbors=self.k_neighbors)
x, y = ros.fit_resample(self.features, self.y)
# list of original ids + artificial ids
ids = np.concatenate((self.ids, [f"ib_{uuid.uuid4().hex}" for _ in range(x.shape[0] - self.features.shape[0])]))
Expand Down
19 changes: 15 additions & 4 deletions src/deepmol/parameter_optimization/_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import inspect
from typing import Dict, Any, Union, Callable

import sklearn
from sklearn.metrics import make_scorer
import sklearn.metrics

from deepmol.loggers.logger import Logger
from deepmol.metrics import Metric
Expand Down Expand Up @@ -51,16 +53,25 @@ def validate_metrics(metric: Union[str, Metric, Callable]) -> Union[str, Callabl
"""

logger = Logger()
if str(metric) in sklearn.metrics.SCORERS.keys():
logger.info(f'Using {metric} as scoring function.')
return metric
elif isinstance(metric, Metric):
sklearn_functions = [
name for name, _ in inspect.getmembers(sklearn.metrics, inspect.isfunction)
]

if isinstance(metric, Metric):
logger.info(f'Using {metric.name} as scoring function.')
return make_scorer(metric.metric)
elif isinstance(metric, Callable):
metric_str = metric.__name__
if metric_str in sklearn_functions:
logger.info(f'Using {metric.__name__} as scoring function.')
return metric

metric = Metric(metric)
logger.info(f'Using {metric.name} as scoring function.')
return make_scorer(metric)
elif isinstance(metric, str) and metric in sklearn_functions:
logger.info(f'Using {metric} as scoring function.')
return metric
else:
raise ValueError(f'{metric}, is not a valid scoring function. '
'Use sorted(sklearn.metrics.SCORERS.keys()) to get valid options.')
Binary file added test_model.params.joblib/model.pkl
Binary file not shown.
Binary file added test_model.params.pkl/model.pkl
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ def test_feature_selectors(self):
self.validate_feature_selector(LowVarianceFS, threshold=0.99)
self.validate_feature_selector(KbestFS, k=10)
self.validate_feature_selector(PercentilFS, percentil=10)
self.validate_feature_selector(RFECVFS, step=10)
# self.validate_feature_selector(RFECVFS, step=10)
self.validate_feature_selector(SelectFromModelFS, threshold=0.1)
self.validate_feature_selector(BorutaAlgorithm, max_iter=3, n_estimators=50, support_weak=True)
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_validate_metrics(self):
metric = validate_metrics(Metric(roc_auc_score))
self.assertIsInstance(metric, Callable)

metric = validate_metrics("roc_auc")
metric = validate_metrics("roc_auc_score")
self.assertIsInstance(metric, str)

def test_aucs(self):
Expand Down

0 comments on commit 4274fa2

Please sign in to comment.