| OneHotEncoder | R Documentation |
A class for encoding labels as a one-hot numeric array.
deepANN::Encoder -> OneHotEncoder
categories('NULL' | character vector)
Holds the labels for the input.
new()Creates a new instance of this R6 class.
OneHotEncoder$new(categories = NULL)
categoriesDesired categories of the input data. If NULL (default), the categories are automatically determined from the input data.
fit()Extract labels from input.
OneHotEncoder$fit(x)
xThe input, usually a factor.
The instance self itself.
transform()Encode input to numeric values between 0 and n_labels-1.
OneHotEncoder$transform(x)
xThe input that will be encoded.
The encoded x.
fit_transform()Run fit() and transform().
OneHotEncoder$fit_transform(x)
xThe input that will be encoded.
The encoded x.
inverse_transform()Transform labels back to original encoding.
OneHotEncoder$inverse_transform(x)
xThe data that will be transformed back.
The original encoded x.
clone()The objects of this class are cloneable with this method.
OneHotEncoder$clone(deep = FALSE)
deepWhether to make a deep clone.
x <- factor(c("small", "small", "medium", "large", "large", "medium", "small"), levels = c("small", "medium", "large"))
ohe <- OneHotEncoder$new()
xt <- ohe$fit_transform(x)
ohe$inverse_transform(xt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.