17426
1
sklearn.preprocessing._encoders.OneHotEncoder
sklearn.OneHotEncoder
sklearn.preprocessing._encoders.OneHotEncoder
17
openml==0.10.2,sklearn==0.21.3
Encode categorical integer features as a one-hot numeric array.
The input to this transformer should be an array-like of integers or
strings, denoting the values taken on by categorical (discrete) features.
The features are encoded using a one-hot (aka 'one-of-K' or 'dummy')
encoding scheme. This creates a binary column for each category and
returns a sparse matrix or dense array.
By default, the encoder derives the categories based on the unique values
in each feature. Alternatively, you can also specify the `categories`
manually.
The OneHotEncoder previously assumed that the input features take on
values in the range [0, max(values)). This behaviour is deprecated.
This encoding is needed for feeding categorical data to many scikit-learn
estimators, notably linear models and SVMs with the standard kernels.
Note: a one-hot encoding of y labels should use a LabelBinarizer
instead.
2019-11-22T02:17:02
English
sklearn==0.21.3
numpy>=1.6.1
scipy>=0.9
categorical_features
'all' or array of indices or mask
null
Specify what features are treated as categorical
- 'all': All features are treated as categorical
- array of indices: Array of categorical feature indices
- mask: Array of length n_features and with dtype=bool
Non-categorical features are always stacked to the right of the matrix
.. deprecated:: 0.20
The `categorical_features` keyword was deprecated in version
0.20 and will be removed in 0.22
You can use the ``ColumnTransformer`` instead.
categories
'auto' or a list of lists
null
Categories (unique values) per feature:
- 'auto' : Determine categories automatically from the training data
- list : ``categories[i]`` holds the categories expected in the ith
column. The passed categories should not mix strings and numeric
values within a single feature, and should be sorted in case of
numeric values
The used categories can be found in the ``categories_`` attribute
drop
'first' or a list
null
Specifies a methodology to use to drop one of the categories per
feature. This is useful in situations where perfectly collinear
features cause problems, such as when feeding the resulting data
into a neural network or an unregularized regression
dtype
number type
{"oml-python:serialized_object": "type", "value": "np.float64"}
Desired dtype of output
handle_unknown
'error' or
"ignore"
Whether to raise an error or ignore if an unknown categorical feature
is present during transform (default is to raise). When this parameter
is set to 'ignore' and an unknown category is encountered during
transform, the resulting one-hot encoded columns for this feature
will be all zeros. In the inverse transform, an unknown category
will be denoted as None
n_values
'auto'
null
Number of values per feature
- 'auto' : determine value range from training data
sparse
boolean
true
Will return sparse matrix if set True else will return an array
openml-python
python
scikit-learn
sklearn
sklearn_0.21.3