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