def transform(self, X):
"""Scaling features of X according to feature_range.
Parameters
----------
X : array-like with shape [n_samples, n_features]
Input data that will be transformed.
"""
check_is_fitted(self, 'scale_')
X = check_array(X, accept_sparse="csc", copy=self.copy,
dtype=np.float32)
if sparse.issparse(X):
for i in range(X.shape[1]):
X.data[X.indptr[i]:X.indptr[i + 1]] *= self.scale_[i]
X.data[X.indptr[i]:X.indptr[i + 1]] += self.min_[i]
else:
X *= self.scale_
X += self.min_
return X
MinMaxScaler.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录