Skip to content

Commit

Permalink
sklearn OneHotEncoder "sparse" parameter renaming to "sparse_output"
Browse files Browse the repository at this point in the history
  • Loading branch information
bnb32 committed Mar 6, 2024
1 parent 36442df commit e407cd7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions phygnn/utilities/pre_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion phygnn/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
"""Physics Guided Neural Network version."""

__version__ = '0.0.26'
__version__ = '0.0.27'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ NREL-rex
numpy>=1.16
pandas>=0.25
pytest>=5.2
scikit-learn>=0.22
scikit-learn>=1.2
tensorflow

0 comments on commit e407cd7

Please sign in to comment.