Skip to content
Snippets Groups Projects
Commit 8dc10a7e authored by Nikolai.Hartmann's avatar Nikolai.Hartmann
Browse files

handle zero scales for WeightedRobustScaler

parent 87b25c46
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ import numpy as np ...@@ -6,6 +6,7 @@ import numpy as np
import keras.backend as K import keras.backend as K
from sklearn.preprocessing import RobustScaler from sklearn.preprocessing import RobustScaler
from sklearn.preprocessing.data import _handle_zeros_in_scale
from meme import cache from meme import cache
...@@ -140,5 +141,6 @@ class WeightedRobustScaler(RobustScaler): ...@@ -140,5 +141,6 @@ class WeightedRobustScaler(RobustScaler):
wqs = np.array([weighted_quantile(X[:,i], [0.25, 0.5, 0.75], sample_weight=weights) for i in range(X.shape[1])]) wqs = np.array([weighted_quantile(X[:,i], [0.25, 0.5, 0.75], sample_weight=weights) for i in range(X.shape[1])])
self.center_ = wqs[:,1] self.center_ = wqs[:,1]
self.scale_ = wqs[:,2]-wqs[:,0] self.scale_ = wqs[:,2]-wqs[:,0]
self.scale_ = _handle_zeros_in_scale(self.scale_, copy=False)
return self return self
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment