Skip to content

Commit 836060f

Browse files
authored
Merge pull request #48 from NREL/bnb/sklearn_update
sklearn OneHotEncoder "sparse" parameter renaming to "sparse_output"
2 parents 36442df + da93661 commit 836060f

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

phygnn/utilities/pre_processing.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
Data pre-processing module.
44
"""
55
import logging
6+
from warnings import warn
7+
68
import numpy as np
79
import pandas as pd
810
from sklearn.preprocessing import OneHotEncoder
9-
from warnings import warn
1011

1112
logger = logging.getLogger(__name__)
1213

@@ -168,9 +169,8 @@ def _is_one_hot(arr, convert_int=False):
168169

169170
one_hot = False
170171

171-
if isinstance(sample, str):
172-
one_hot = True
173-
elif np.issubdtype(type(sample), np.integer) and convert_int:
172+
if (isinstance(sample, str) or np.issubdtype(type(sample), np.integer)
173+
and convert_int):
174174
one_hot = True
175175

176176
return one_hot
@@ -277,9 +277,10 @@ def _get_one_hot_data(self, convert_int=False, categories=None):
277277
cats = [categories[name]]
278278
logger.debug('Using categories {} for column {}'
279279
''.format(cats, name))
280-
oh_obj = OneHotEncoder(sparse=False, categories=cats)
280+
oh_obj = OneHotEncoder(sparse_output=False,
281+
categories=cats)
281282
else:
282-
oh_obj = OneHotEncoder(sparse=False)
283+
oh_obj = OneHotEncoder(sparse_output=False)
283284

284285
oh_obj.fit(col)
285286
one_hot_data.append(oh_obj.transform(col))

phygnn/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22
"""Physics Guided Neural Network version."""
33

4-
__version__ = '0.0.26'
4+
__version__ = '0.0.27'

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ NREL-rex
33
numpy>=1.16
44
pandas>=0.25
55
pytest>=5.2
6-
scikit-learn>=0.22
6+
scikit-learn>=1.2
77
tensorflow

0 commit comments

Comments
 (0)