8000 DOC Fix some new sphinx warnings. by cmarmo · Pull Request #15560 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions doc/modules/compose.rst
Original file line number Diff line number Diff line change
Expand Up @@ -467,19 +467,19 @@ with a :func:`~sklearn.compose.make_column_selector`. The
:func:`~sklea 10000 rn.compose.make_column_selector` is used to select columns based
on data type or column name::

>>> from sklearn.preprocessing import StandardScaler
>>> from sklearn.compose import make_column_selector
>>> ct = ColumnTransformer([
... ('scale', StandardScaler(),
... make_column_selector(dtype_include=np.number)),
... ('onehot',
... OneHotEncoder(),
... make_column_selector(pattern='city', dtype_include=object))])
>>> ct.fit_transform(X)
array([[ 0.904..., 0. , 1. , 0. , 0. ],
[-1.507..., 1.414..., 1. , 0. , 0. ],
[-0.301..., 0. , 0. , 1. , 0. ],
[ 0.904..., -1.414..., 0. , 0. , 1. ]])
>>> from sklearn.preprocessing import StandardScaler
>>> from sklearn.compose import make_column_selector
>>> ct = ColumnTransformer([
... ('scale', StandardScaler(),
... make_column_selector(dtype_include=np.number)),
... ('onehot',
... OneHotEncoder(),
... make_column_selector(pattern='city', dtype_include=object))])
>>> ct.fit_transform(X)
array([[ 0.904..., 0. , 1. , 0. , 0. ],
[-1.507..., 1.414..., 1. , 0. , 0. ],
[-0.301..., 0. , 0. , 1. , 0. ],
[ 0.904..., -1.414..., 0. , 0. , 1. ]])

Strings can reference columns if the input is a DataFrame, integers are always
interpreted as the positional columns.
Expand Down
3 changes: 1 addition & 2 deletions doc/whats_new/v0.22.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,12 @@ Changelog
`affinity='cosine'` and `X` has samples that are all-zeros. :pr:`7943` by
:user:`mthorrell`.


:mod:`sklearn.compose`
......................

- |Feature| Adds :func:`compose.make_column_selector` which is used with
:class:`compose.ColumnTransformer` to select DataFrame columns on the basis
of name and dtype. :pr:`12303` by `Thomas Fan `_.
of name and dtype. :pr:`12303` by `Thomas Fan`_.

- |Fix| Fixed a bug in :class:`compose.ColumnTransformer` which failed to
select the proper columns when using a boolean list, with NumPy older than
Expand Down
4 changes: 2 additions & 2 deletions sklearn/mixture/_bayesian_mixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ class BayesianGaussianMixture(BaseMixture):
The precision prior on the mean distribution (Gaussian).
Controls the extent of where means can be placed.
Larger values concentrate the cluster means around `mean_prior`.
If mean_precision_prior is set to None, mean_precision_prior_ is set to
1.
If mean_precision_prior is set to None, `mean_precision_prior_` is set
to 1.

mean_precision_ : array-like, shape (n_components,)
The precision of each components on the mean distribution (Gaussian).
Expand Down
0