DEVELOPMENT... OpenML
Flow
sklearn.preprocessing._encoders.OneHotEncoder

sklearn.preprocessing._encoders.OneHotEncoder

Visibility: public Uploaded 26-08-2021 by Arnold sklearn==0.24.2 numpy>=1.13.3 scipy>=0.19.1 joblib>=0.11 threadpoolctl>=2.0.0 0 runs
0 likes downloaded by 0 people 0 issues 0 downvotes , 0 total downloads
  • openml-python python scikit-learn sklearn sklearn_0.24.2
Issue #Downvotes for this reason By


Loading wiki
Help us complete this description Edit
Encode categorical 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 (depending on the ``sparse`` parameter) By default, the encoder derives the categories based on the unique values in each feature. Alternatively, you can also specify the `categories` manually. 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.

Parameters

categoriesCategories (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 .. versionadded:: 0.20 drop : {'first', 'if_binary'} or a array-like of shape (n_features,), default=None 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 However, dropping one category breaks the symmetry of the original representation and can therefore induce a bias in downstream models, for instance for penalized linear classification or regression modelsdefault: "auto"
dropdefault: null
dtypeDesired dtype of output handle_unknown : {'error', 'ignore'}, default='error' 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.default: {"oml-python:serialized_object": "type", "value": "np.float64"}
handle_unknowndefault: "ignore"
sparseWill return sparse matrix if set True else will return an arraydefault: true

0
Runs

List all runs
Parameter:
Rendering chart
Rendering table