@@ -244,6 +244,24 @@ class MinMaxScaler(BaseEstimator, TransformerMixin):
244244 .. versionadded:: 0.17
245245 *data_range_*
246246
247+ Examples
248+ --------
249+ >>> from sklearn.preprocessing import MinMaxScaler
250+ >>>
251+ >>> data = [[-1, 2], [-0.5, 6], [0, 10], [1, 18]]
252+ >>> scaler = MinMaxScaler()
253+ >>> print(scaler.fit(data))
254+ MinMaxScaler(copy=True, feature_range=(0, 1))
255+ >>> print(scaler.data_max_)
256+ [ 1. 18.]
257+ >>> print(scaler.transform(data))
258+ [[ 0. 0. ]
259+ [ 0.25 0.25]
260+ [ 0.5 0.5 ]
261+ [ 1. 1. ]]
262+ >>> print(scaler.transform([[2, 2]]))
263+ [[ 1.5 0. ]]
264+
247265 See also
248266 --------
249267 minmax_scale: Equivalent function without the estimator API.
@@ -504,6 +522,24 @@ class StandardScaler(BaseEstimator, TransformerMixin):
504522 The number of samples processed by the estimator. Will be reset on
505523 new calls to fit, but increments across ``partial_fit`` calls.
506524
525+ Examples
526+ --------
527+ >>> from sklearn.preprocessing import StandardScaler
528+ >>>
529+ >>> data = [[0, 0], [0, 0], [1, 1], [1, 1]]
530+ >>> scaler = StandardScaler()
531+ >>> print(scaler.fit(data))
532+ StandardScaler(copy=True, with_mean=True, with_std=True)
533+ >>> print(scaler.mean_)
534+ [ 0.5 0.5]
535+ >>> print(scaler.transform(data))
536+ [[-1. -1.]
537+ [-1. -1.]
538+ [ 1. 1.]
539+ [ 1. 1.]]
540+ >>> print(scaler.transform([[2, 2]]))
541+ [[ 3. 3.]]
542+
507543 See also
508544 --------
509545 scale: Equivalent function without the estimator API.
0 commit comments