From e407cd77832e8f073b33169c8eafcec84b3269e2 Mon Sep 17 00:00:00 2001 From: bnb32 Date: Wed, 6 Mar 2024 10:38:20 -0700 Subject: [PATCH] sklearn OneHotEncoder "sparse" parameter renaming to "sparse_output" --- phygnn/utilities/pre_processing.py | 12 ++++++------ phygnn/version.py | 2 +- requirements.txt | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phygnn/utilities/pre_processing.py b/phygnn/utilities/pre_processing.py index 24a5886..8cb83b6 100644 --- a/phygnn/utilities/pre_processing.py +++ b/phygnn/utilities/pre_processing.py @@ -3,10 +3,11 @@ Data pre-processing module. """ import logging +from warnings import warn + import numpy as np import pandas as pd from sklearn.preprocessing import OneHotEncoder -from warnings import warn logger = logging.getLogger(__name__) @@ -168,9 +169,7 @@ def _is_one_hot(arr, convert_int=False): one_hot = False - if isinstance(sample, str): - one_hot = True - elif np.issubdtype(type(sample), np.integer) and convert_int: + if isinstance(sample, str) or np.issubdtype(type(sample), np.integer) and convert_int: one_hot = True return one_hot @@ -277,9 +276,10 @@ def _get_one_hot_data(self, convert_int=False, categories=None): cats = [categories[name]] logger.debug('Using categories {} for column {}' ''.format(cats, name)) - oh_obj = OneHotEncoder(sparse=False, categories=cats) + oh_obj = OneHotEncoder(sparse_output=False, + categories=cats) else: - oh_obj = OneHotEncoder(sparse=False) + oh_obj = OneHotEncoder(sparse_output=False) oh_obj.fit(col) one_hot_data.append(oh_obj.transform(col)) diff --git a/phygnn/version.py b/phygnn/version.py index 9b6286e..4a4587c 100644 --- a/phygnn/version.py +++ b/phygnn/version.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- """Physics Guided Neural Network version.""" -__version__ = '0.0.26' +__version__ = '0.0.27' diff --git a/requirements.txt b/requirements.txt index 7645f3f..15b6312 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,5 @@ NREL-rex numpy>=1.16 pandas>=0.25 pytest>=5.2 -scikit-learn>=0.22 +scikit-learn>=1.2 tensorflow