Skip to content

Commit

Permalink
update import for newer sklearn
Browse files Browse the repository at this point in the history
  • Loading branch information
mhangaard committed Mar 2, 2020
1 parent 65c2b70 commit 18d58ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions catlearn/preprocess/clean_data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Functions to clean data."""
import numpy as np
from collections import defaultdict
from sklearn.preprocessing import Imputer
from sklearn.impute import SimpleImputer
from scipy.stats import skew


Expand Down Expand Up @@ -147,7 +147,7 @@ def clean_infinite(train, test=None, targets=None, labels=None, mask=None,

# Get the fraction of finite values in each column.
if max_impute_fraction > 0:
impute = Imputer(missing_values="NaN", strategy=strategy)
impute = SimpleImputer(strategy=strategy)
impute_fraction = 1 - np.isfinite(train).mean(axis=0)
to_impute = impute_fraction <= max_impute_fraction
train[:, to_impute] = impute.fit_transform(train[:, to_impute])
Expand Down

0 comments on commit 18d58ac

Please sign in to comment.