Skip to content

Commit

Permalink
Update scale.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHalford committed Aug 29, 2023
1 parent cb3d909 commit c658393
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions river/preprocessing/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,15 @@ def transform_many(self, X: pd.DataFrame):
"""

# Determine dtype of input
dtypes = X.dtypes.unique()
dtype = dtypes[0] if len(dtypes) == 1 else np.float64

# Check if the dtype is integer type and convert to corresponding float type
if np.issubdtype(dtype, np.integer):
bytes_size = dtype.itemsize
dtype = np.dtype(f"float{bytes_size * 8}")

means = np.array([self.means[c] for c in X.columns], dtype=dtype)
Xt = X.values - means

Expand Down

0 comments on commit c658393

Please sign in to comment.