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

sklearn.preprocessing._encoders.OneHotEncoder

Visibility: public Uploaded 11-01-2023 by Ann sklearn==0.21.0 numpy>=1.11.0 scipy>=0.17.0 joblib>=0.11 0 runs
0 likes downloaded by 0 people 0 issues 0 downvotes , 0 total downloads
  • openml-python python scikit-learn sklearn sklearn_0.21.0
Issue #Downvotes for this reason By


Loading wiki
Help us complete this description Edit
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.

Parameters

categorical_featuresSpecify 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.default: null
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_`` attributedefault: null
dropSpecifies 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 regressiondefault: null
dtypeDesired dtype of outputdefault: {"oml-python:serialized_object": "type", "value": "np.float64"}
handle_unknownWhether 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 Nonedefault: "ignore"
n_valuesNumber of values per feature - 'auto' : determine value range from training datadefault: null
sparseWill return sparse matrix if set True else will return an arraydefault: true

0
Runs

List all runs
Parameter:
Rendering chart
Rendering table