MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / __init__

Method __init__

numpy_ml/preprocessing/general.py:142–169  ·  view source on GitHub ↗

Feature-wise standardization for vector inputs. Notes ----- Due to the sensitivity of empirical mean and standard deviation calculations to extreme values, `Standardizer` cannot guarantee balanced feature scales in the presence of outliers. In partic

(self, with_mean=True, with_std=True)

Source from the content-addressed store, hash-verified

140
141class Standardizer:
142 def __init__(self, with_mean=True, with_std=True):
143 """
144 Feature-wise standardization for vector inputs.
145
146 Notes
147 -----
148 Due to the sensitivity of empirical mean and standard deviation
149 calculations to extreme values, `Standardizer` cannot guarantee
150 balanced feature scales in the presence of outliers. In particular,
151 note that because outliers for each feature can have different
152 magnitudes, the spread of the transformed data on each feature can be
153 very different.
154
155 Similar to sklearn, `Standardizer` uses a biased estimator for the
156 standard deviation: ``numpy.std(x, ddof=0)``.
157
158 Parameters
159 ----------
160 with_mean : bool
161 Whether to scale samples to have 0 mean during transformation.
162 Default is True.
163 with_std : bool
164 Whether to scale samples to have unit variance during
165 transformation. Default is True.
166 """
167 self.with_mean = with_mean
168 self.with_std = with_std
169 self._is_fit = False
170
171 @property
172 def hyperparameters(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected