diff --git a/.github/workflows/deepretro_tests.yml b/.github/workflows/deepretro_tests.yml index adab4976..53192cf7 100644 --- a/.github/workflows/deepretro_tests.yml +++ b/.github/workflows/deepretro_tests.yml @@ -60,4 +60,3 @@ jobs: - name: Run tests run: | pytest deepretro/tests/ -v - diff --git a/deepretro/algorithms/stability_checker.py b/deepretro/algorithms/stability_checker.py index 430afbdb..a66ef428 100644 --- a/deepretro/algorithms/stability_checker.py +++ b/deepretro/algorithms/stability_checker.py @@ -70,6 +70,8 @@ * `is_valid_smiles` — quick check that a SMILES string parses. """ +from __future__ import annotations + from rdkit import Chem from rdkit.Chem import Descriptors from rdkit.Chem.rdMolDescriptors import ( diff --git a/deepretro/utils/metrics.py b/deepretro/utils/metrics.py index 625e8cb4..2dd4f832 100644 --- a/deepretro/utils/metrics.py +++ b/deepretro/utils/metrics.py @@ -3,7 +3,6 @@ from typing import Sequence import numpy as np -from sklearn.metrics import precision_recall_curve def find_optimal_threshold( @@ -42,6 +41,10 @@ def find_optimal_threshold( >>> f1 > 0.0 True """ + # Import lazily so docs and lightweight tooling can import this module + # without pulling in sklearn's full scipy stack at module import time. + from sklearn.metrics import precision_recall_curve + precision, recall, thresholds = precision_recall_curve(y_true, probabilities) f1_scores = 2 * (precision * recall) / (precision + recall + 1e-10) best_idx = np.argmax(f1_scores) diff --git a/docs/source/conf.py b/docs/source/conf.py index 4b657ac2..4869defa 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -175,11 +175,17 @@ 'diskcache', 'dotenv', 'jax', + 'lightgbm', + 'numpy', + 'pandas', 'PIL', + 'rdkit', 'rootutils', + 'sklearn', 'structlog', 'tensorflow', 'torch', + 'xgboost', ] # Todo settings