MultiLabelBinarizer | R Documentation |
A class for encoding labels as a multiple binary numeric matrix.
deepANN::Encoder
-> MultiLabelBinarizer
categories
('NULL' | character vector)
Holds the labels for the input.
new()
Creates a new instance of this R6 class.
MultiLabelBinarizer$new(categories = NULL)
categories
Desired categories of the input data. If NULL
(default), the categories are automatically determined from the input data.
fit()
Extract labels from input.
MultiLabelBinarizer$fit(x)
x
The input, usually a list
consisting of vectors.
The instance self
itself.
transform()
Encode input to numeric values between 0 and n_labels-1.
MultiLabelBinarizer$transform(x)
x
The input that will be encoded.
The encoded x
.
fit_transform()
Run fit()
and transform()
.
MultiLabelBinarizer$fit_transform(x)
x
The input that will be encoded.
The encoded x
.
inverse_transform()
Transform labels back to original encoding.
MultiLabelBinarizer$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.
MultiLabelBinarizer$clone(deep = FALSE)
deep
Whether to make a deep clone.
x <- list(
c("sci-fi", "thriller"),
c("comedy"),
c("comedy", "horror"),
c("horror"),
c("western", "comedy"),
c("thriller", "comedy", "sci-fi")
)
mlb <- MultiLabelBinarizer$new()
bm <- mlb$fit_transform(x)
mlb$inverse_transform(bm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.