| dataset_bert | R Documentation |
Prepare a dataset for BERT-like models.
dataset_bert(x, y = NULL, tokenizer = tokenize_bert, n_tokens = 128L)
x |
A data.frame with one or more character predictor columns. |
y |
A factor of outcomes, or a data.frame with a single factor column. Can be NULL (default). |
tokenizer |
A tokenization function (signature compatible with
|
n_tokens |
Integer scalar; the number of tokens expected for each example. |
An initialized torch::dataset().
initializeInitialize this dataset. This method is called when the dataset is first created.
.getitemFetch an individual predictor (and, if available, the
associated outcome). This function is called automatically by {luz}
during the fitting process.
.lengthDetermine the length of the dataset (the number of rows of
predictors). Generally superseded by instead calling length().
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.