From da1d5915cd48c77d5b1c89dc4e6767e82e4d8187 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Mon, 23 Jan 2023 13:29:32 -0500 Subject: [PATCH] Scikit learn (#643) * Replace sklearn with scikit-learn * Use underscore in python files * Lint fix --- miqa/learning/correlator.py | 2 +- miqa/learning/nn_inference.py | 7 ++++++- miqa/learning/nn_training.py | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/miqa/learning/correlator.py b/miqa/learning/correlator.py index 1cede05c..ad3e9af9 100644 --- a/miqa/learning/correlator.py +++ b/miqa/learning/correlator.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import pandas as pd -from sklearn.metrics import confusion_matrix +from scikit_learn.metrics import confusion_matrix df = pd.read_csv('M:/MIQA/data.csv') # manually converted TRUE/FALSE into 1/0 print(f'count NaN: {df.isnull().sum().sum()}') diff --git a/miqa/learning/nn_inference.py b/miqa/learning/nn_inference.py index 771908e6..faa723c2 100644 --- a/miqa/learning/nn_inference.py +++ b/miqa/learning/nn_inference.py @@ -4,7 +4,12 @@ import itk import monai import numpy as np -from sklearn.metrics import classification_report, confusion_matrix, mean_squared_error, r2_score +from scikit_learn.metrics import ( + classification_report, + confusion_matrix, + mean_squared_error, + r2_score, +) import torch from torch.utils.data import DataLoader import torchio diff --git a/miqa/learning/nn_training.py b/miqa/learning/nn_training.py index a7995271..d1ccc6d3 100755 --- a/miqa/learning/nn_training.py +++ b/miqa/learning/nn_training.py @@ -21,7 +21,7 @@ ) import numpy as np import pandas as pd -from sklearn.metrics import confusion_matrix +from scikit_learn.metrics import confusion_matrix import torch from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter diff --git a/setup.py b/setup.py index 1368c35a..fa55fc8d 100644 --- a/setup.py +++ b/setup.py @@ -73,7 +73,7 @@ 'learning': [ 'itk>=5.3rc4', 'monai', - 'sklearn', + 'scikit-learn', 'torch', 'torchio', 'wandb',