Compute the mean and std to be used for later scaling. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) The data used to compute the mean and standard deviation used for later scaling along the features axis.
(self, X, y=None, sample_weight=None)
| 901 | del self.var_ |
| 902 | |
| 903 | def fit(self, X, y=None, sample_weight=None): |
| 904 | """Compute the mean and std to be used for later scaling. |
| 905 | |
| 906 | Parameters |
| 907 | ---------- |
| 908 | X : {array-like, sparse matrix} of shape (n_samples, n_features) |
| 909 | The data used to compute the mean and standard deviation |
| 910 | used for later scaling along the features axis. |
| 911 | |
| 912 | y : None |
| 913 | Ignored. |
| 914 | |
| 915 | sample_weight : array-like of shape (n_samples,), default=None |
| 916 | Individual weights for each sample. |
| 917 | |
| 918 | .. versionadded:: 0.24 |
| 919 | parameter *sample_weight* support to StandardScaler. |
| 920 | |
| 921 | Returns |
| 922 | ------- |
| 923 | self : object |
| 924 | Fitted scaler. |
| 925 | """ |
| 926 | # Reset internal state before fitting |
| 927 | self._reset() |
| 928 | return self.partial_fit(X, y, sample_weight) |
| 929 | |
| 930 | @_fit_context(prefer_skip_nested_validation=True) |
| 931 | def partial_fit(self, X, y=None, sample_weight=None): |