Class: OneHotEncoder

eclairjs/ml/feature.OneHotEncoder

A one-hot encoder that maps a column of category indices to a column of binary vectors, with at most a single one-value per row that indicates the input category index. For example with 5 categories, an input value of 2.0 would map to an output vector of `[0.0, 0.0, 1.0, 0.0]`. The last category is not included by default (configurable via OneHotEncoder!.dropLast because it makes the vector entries sum up to one, and hence linearly dependent. So an input value of 4.0 maps to `[0.0, 0.0, 0.0, 0.0]`. Note that this is different from scikit-learn's OneHotEncoder, which keeps all categories. The output vectors are sparse.

Constructor

new OneHotEncoder(uidopt)

Parameters:
Name Type Attributes Description
uid string <optional>
Source:
See:

Extends

Methods

(static) load(path) → {module:eclairjs/ml/feature.OneHotEncoder}

Parameters:
Name Type Description
path string
Source:
Returns:
Type
module:eclairjs/ml/feature.OneHotEncoder

copy(extra) → {module:eclairjs/ml/feature.OneHotEncoder}

Parameters:
Name Type Description
extra module:eclairjs/ml/param.ParamMap
Overrides:
Source:
Returns:
Type
module:eclairjs/ml/feature.OneHotEncoder

dropLast() → {module:eclairjs/ml/param.BooleanParam}

Source:
Returns:
Type
module:eclairjs/ml/param.BooleanParam

getDropLast() → {Promise.<boolean>}

Source:
Returns:
Type
Promise.<boolean>

setDropLast(value) → {module:eclairjs/ml/feature.OneHotEncoder}

Parameters:
Name Type Description
value boolean
Source:
Returns:
Type
module:eclairjs/ml/feature.OneHotEncoder

setInputCol(value) → {module:eclairjs/ml/feature.OneHotEncoder}

Parameters:
Name Type Description
value string
Source:
Returns:
Type
module:eclairjs/ml/feature.OneHotEncoder

setOutputCol(value) → {module:eclairjs/ml/feature.OneHotEncoder}

Parameters:
Name Type Description
value string
Source:
Returns:
Type
module:eclairjs/ml/feature.OneHotEncoder

transform(dataset, paramsopt, …otherParamPairsopt) → {module:eclairjs/sql.Dataset}

Transforms the dataset with optional parameters
Parameters:
Name Type Attributes Description
dataset module:eclairjs/sql.Dataset input dataset
params module:eclairjs/ml/param.ParamMap | module:eclairjs/ml/param.ParamPair <optional>
additional parameters, overwrite embedded params, overwrite embedded params
otherParamPairs module:eclairjs/ml/param.ParamPair <optional>
<repeatable>
other param pairs, Only used if argument two is module:eclairjs/ml/param.ParamPair. Overwrite embedded params
Inherited From:
Source:
Returns:
transformed dataset
Type
module:eclairjs/sql.Dataset

uid() → {Promise.<string>}

An immutable unique ID for the object and its derivatives.
Source:
Returns:
Type
Promise.<string>