From d899c17ea8bbf65864efb63bf72c59c2116f7a31 Mon Sep 17 00:00:00 2001 From: Spiros Maggioros Date: Wed, 6 Nov 2024 20:58:17 +0200 Subject: [PATCH] Rework on packages | Reduced deprecation warnings on sklearn functions --- requirements.txt | 17 +++++++++-------- setup.py | 2 +- spare_scores/data_prep.py | 6 +++--- spare_scores/svm.py | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6eaf6a5..60f4739 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,19 +9,20 @@ exceptiongroup==1.1.1 filelock==3.12.2 fonttools==4.40.0 frozenlist==1.4.1 -grpcio==1.65.4 +grpcio==1.67.1 idna==3.4 importlib-resources==5.12.0 iniconfig==2.0.0 joblib==1.3.1 jsonschema==4.17.3 kiwisolver==1.4.4 -matplotlib==3.7.5 +matplotlib msgpack==1.0.5 numpy +optuna packaging==23.1 -pandas==2.0.3 -Pillow==9.5.0 +pandas +Pillow==11.0.0 pkgutil_resolve_name==1.3.10 pluggy==1.5.0 protobuf==4.23.3 @@ -32,14 +33,14 @@ python-dateutil==2.8.2 pytz==2023.3 PyYAML==6.0.2 requests==2.31.0 -scikit-learn==1.3.2 +scikit-learn==1.5.2 scipy six==1.16.0 threadpoolctl==3.1.0 tomli==2.0.1 -torch==2.2.1 -torchvision==0.17.1 -typing_extensions==4.8.0 +torch --index-url https://download.pytorch.org/whl/nightly/cpu +torchvision --index-url https://download.pytorch.org/whl/nightly/cpu +typing_extensions tzdata==2023.3 urllib3==2.0.3 zipp==3.15.0 diff --git a/setup.py b/setup.py index 3c373f7..f71fb0a 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ "pandas", "setuptools", "scikit-learn", - "torch<=2.3.1", + "torch<=2.5.2", "matplotlib", "optuna", ], diff --git a/spare_scores/data_prep.py b/spare_scores/data_prep.py index a7e3127..93d59ad 100644 --- a/spare_scores/data_prep.py +++ b/spare_scores/data_prep.py @@ -71,7 +71,7 @@ def check_train( logging.error("At least one of the groups to classify is too small (n<10).") return "At least one of the groups to classify is too small (n<10)." elif np.min(df[to_predict].value_counts()) < 100: - logging.warn( + logging.warning( "At least one of the groups to classify may be too small (n<100)." ) mdl_task = "Classification" @@ -84,7 +84,7 @@ def check_train( logging.error("Sample size is too small (n<10).") return "Sample size is too small (n<10)." elif len(df.index) < 100: - logging.warn("Sample size may be too small (n<100).") + logging.warning("Sample size may be too small (n<100).") if pos_group != "": logging.info( 'SPARE regression does not need a "pos_group". This will be ignored.' @@ -126,7 +126,7 @@ def check_test( # logging.warn('Some participants fall outside the age range of the SPARE model.') if np.sum(np.sum(pd.isna(df[meta_data["predictors"]]))) > 0: - logging.warn( + logging.warning( "Some participants have invalid (missing or NaN values) predictor variables." ) diff --git a/spare_scores/svm.py b/spare_scores/svm.py index 2dd3dac..e2ab81d 100644 --- a/spare_scores/svm.py +++ b/spare_scores/svm.py @@ -347,7 +347,7 @@ def get_stats(self, y_test: np.ndarray, y_score: np.ndarray) -> None: else: self.stats["MAE"].append(metrics.mean_absolute_error(y_test, y_score)) self.stats["RMSE"].append( - metrics.mean_squared_error(y_test, y_score, squared=False) + metrics.root_mean_squared_error(y_test, y_score) ) self.stats["R2"].append(metrics.r2_score(y_test, y_score)) logging.debug(