From a55d48b4fbe69e6ad8114a02eb1a002a3ce29c8b Mon Sep 17 00:00:00 2001 From: "Moshe Raboh Moshiko.Raboh@ibm.com" Date: Fri, 4 Oct 2024 09:56:27 -0400 Subject: [PATCH 1/3] rmse score fix --- fuse/eval/metrics/regression/metrics.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fuse/eval/metrics/regression/metrics.py b/fuse/eval/metrics/regression/metrics.py index 7c5d38238..1e7eb9627 100644 --- a/fuse/eval/metrics/regression/metrics.py +++ b/fuse/eval/metrics/regression/metrics.py @@ -2,7 +2,12 @@ from fuse.eval.metrics.libs.stat import Stat from fuse.eval.metrics.metrics_common import MetricDefault import numpy as np -from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score +from sklearn.metrics import ( + mean_absolute_error, + mean_squared_error, + r2_score, + root_mean_squared_error, +) class MetricPearsonCorrelation(MetricDefault): @@ -107,26 +112,23 @@ def __init__( super().__init__( pred=pred, target=target, - metric_func=self.mse, + metric_func=self.rmse, **kwargs, ) - def mse( + def rmse( self, pred: Union[List, np.ndarray], target: Union[List, np.ndarray], **kwargs: dict, ) -> float: - pred = np.array(pred).flatten() target = np.array(target).flatten() - assert len(pred) == len( target ), f"Expected pred and target to have the dimensions but found: {len(pred)} elements in pred and {len(target)} in target" - squared_diff = (pred - target) ** 2 - return squared_diff.mean() + return root_mean_squared_error(y_true=target, y_pred=pred) class MetricR2(MetricDefault): From 9d7fde3e95de3af7f6fa19375cb99db9761538b2 Mon Sep 17 00:00:00 2001 From: "Moshe Raboh Moshiko.Raboh@ibm.com" Date: Sun, 6 Oct 2024 03:57:07 -0400 Subject: [PATCH 2/3] .. --- fuse/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuse/requirements.txt b/fuse/requirements.txt index 9e5a1e3a4..787677751 100644 --- a/fuse/requirements.txt +++ b/fuse/requirements.txt @@ -5,7 +5,7 @@ pandas>=1.2 tqdm>=4.52.0 scipy>=1.5.4 matplotlib>=3.3.3 -scikit-learn>=0.23.2 +scikit-learn>=1.4 termcolor>=1.1.0 pycocotools>=2.0.1 pytorch_lightning>=1.6 From 711add24fba77efa78b599b18447902aba0540eb Mon Sep 17 00:00:00 2001 From: "Moshe Raboh Moshiko.Raboh@ibm.com" Date: Sun, 6 Oct 2024 07:21:11 -0400 Subject: [PATCH 3/3] bump python version --- README.md | 4 ++-- run_all_unit_tests.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a8345a9c4..d4498c8c9 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ Note - in general, we find it helpful to follow the same directory structure sho # Installation -FuseMedML is tested on Python >= 3.7 and PyTorch >= 1.5 +FuseMedML is tested on Python >= 3.9 and PyTorch >= 2.0 ## We recommend using a Conda environment @@ -234,7 +234,7 @@ $ pip install fuse-med-ml[all,examples] * [**Mortality prediction for ICU patients**](./fuse_examples/multimodality/ehr_transformer) - Example of EHR transformer applied to the data of Intensive Care Units patients for in-hospital mortality prediction. The dataset is from [PhysioNet Computing in Cardiology Challenge (2012)](https://physionet.org/content/challenge-2012/1.0.0/) * Pre-training * [**Medical Imaging Pre-training and Downstream Task Validation**](./fuse_examples/imaging/oai_example) - pre-training a model on 3D MRI medical imaging and then using it for classification and segmentation downstream tasks. - + ## Walkthrough template * [**Walkthrough Template**](./fuse/dl/templates/walkthrough_template.py) - includes several TODO notes, marking the minimal scope of code required to get your pipeline up and running. The template also includes useful explanations and tips. diff --git a/run_all_unit_tests.sh b/run_all_unit_tests.sh index 4a7b3a1df..ace9be4e2 100755 --- a/run_all_unit_tests.sh +++ b/run_all_unit_tests.sh @@ -32,7 +32,7 @@ create_env() { fi # Python version - PYTHON_VER=3.8 + PYTHON_VER=3.9 ENV_NAME="fuse_$PYTHON_VER-CUDA-$force_cuda_version-$(echo -n $requirements | sha256sum | awk '{print $1;}')" echo $ENV_NAME