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
12 changes: 10 additions & 2 deletions docs/templates/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,18 @@
- items:
- name: Overview
uid: bigframes.ml.preprocessing
- name: OneHotEncoder
uid: bigframes.ml.preprocessing.OneHotEncoder
- name: KBinsDiscretizer
uid: bigframes.ml.preprocessing.KBinsDiscretizer
- name: LabelEncoder
uid: bigframes.ml.preprocessing.LabelEncoder
- name: MaxAbsScaler
uid: bigframes.ml.preprocessing.MaxAbsScaler
- name: MinMaxScaler
uid: bigframes.ml.preprocessing.MinMaxScaler
- name: StandardScaler
uid: bigframes.ml.preprocessing.StandardScaler
- name: OneHotEncoder
uid: bigframes.ml.preprocessing.OneHotEncoder
name: preprocessing
name: bigframes.ml
name: BigQuery DataFrames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class StandardScaler(BaseEstimator, TransformerMixin):
individual features do not more or less look like standard normally
distributed data (e.g. Gaussian with 0 mean and unit variance).

Examples:
**Examples:**

.. code-block::

Expand Down
30 changes: 15 additions & 15 deletions third_party/bigframes_vendored/sklearn/preprocessing/_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ class OneHotEncoder(BaseEstimator):
Note that this method deviates from Scikit-Learn; instead of producing sparse
binary columns, the encoding is a single column of `STRUCT<index INT64, value DOUBLE>`.

**Examples:**

Given a dataset with two features, we let the encoder find the unique
values per feature and transform the data to a binary one-hot encoding.

.. code-block::

from bigframes.ml.preprocessing import OneHotEncoder
import bigframes.pandas as bpd

enc = OneHotEncoder()
X = bpd.DataFrame({"a": ["Male", "Female", "Female"], "b": ["1", "3", "2"]})
enc.fit(X)
print(enc.transform(bpd.DataFrame({"a": ["Female", "Male"], "b": ["1", "4"]})))

Args:
drop (Optional[Literal["most_frequent"]], default None):
Specifies a methodology to use to drop one of the categories per feature.
Expand All @@ -37,21 +52,6 @@ class OneHotEncoder(BaseEstimator):
when considering infrequent categories. If there are infrequent categories,
max_categories includes the category representing the infrequent categories along with the frequent categories.
Default None, set limit to 1,000,000.

Examples:

Given a dataset with two features, we let the encoder find the unique
values per feature and transform the data to a binary one-hot encoding.

.. code-block::

from bigframes.ml.preprocessing import OneHotEncoder
import bigframes.pandas as bpd

enc = OneHotEncoder()
X = bpd.DataFrame({"a": ["Male", "Female", "Female"], "b": ["1", "3", "2"]})
enc.fit(X)
print(enc.transform(bpd.DataFrame({"a": ["Female", "Male"], "b": ["1", "4"]})))
"""

def fit(self, X, y=None):
Expand Down