spam_dataset: Spam Dataset Loader

spam_datasetR Documentation

Spam Dataset Loader

Description

Defines the spam dataset commonly used in machine learning.

Usage

spam_dataset(
  url = "https://hastie.su.domains/ElemStatLearn/datasets/spam.data",
  download = FALSE,
  transform = NULL,
  target_transform = NULL
)

Arguments

url

A character string representing the URL of the dataset.

download

Logical; whether to download the dataset. Defaults to FALSE.

transform

Function to apply transformations to the features. Defaults to NULL.

target_transform

Function to apply transformations to the labels. Defaults to NULL.

Value

A torch::dataset object for the spam dataset.

Examples

## Not run: 
# Simple usage:
ds <- spam_dataset(download = TRUE)
loader <- dataloader(ds, batch_size = 32, shuffle = TRUE)
batch <- dataloader_make_iter(loader) %>% dataloader_next()
dim(batch$x)
length(batch$y)

## End(Not run)

dfalbel/extradatasets documentation built on April 12, 2025, 9:36 a.m.