dataset_ag_news: AG's News Topic Classification Dataset

Description Usage Arguments Details Value Source See Also Examples

View source: R/dataset_ag_news.R

Description

The AG's news topic classification dataset is constructed by choosing 4 largest classes from the original corpus. Each class contains 30,000 training samples and 1,900 testing samples. The total number of training samples is 120,000 and testing 7,600. Version 3, Updated 09/09/2015

Usage

1
2
3
4
5
6
7
8
dataset_ag_news(
  dir = NULL,
  split = c("train", "test"),
  delete = FALSE,
  return_path = FALSE,
  clean = FALSE,
  manual_download = FALSE
)

Arguments

dir

Character, path to directory where data will be stored. If NULL, user_cache_dir will be used to determine path.

split

Character. Return training ("train") data or testing ("test") data. Defaults to "train".

delete

Logical, set TRUE to delete dataset.

return_path

Logical, set TRUE to return the path of the dataset.

clean

Logical, set TRUE to remove intermediate files. This can greatly reduce the size. Defaults to FALSE.

manual_download

Logical, set TRUE if you have manually downloaded the file and placed it in the folder designated by running this function with return_path = TRUE.

Details

The classes in this dataset are

Value

A tibble with 120,000 or 30,000 rows for "train" and "test" respectively and 3 variables:

class

Character, denoting new class

title

Character, title of article

description

Character, description of article

Source

http://www.di.unipi.it/~gulli/AG_corpus_of_news_articles.html

https://github.com/mhjabreel/CharCnn_Keras/tree/master/data/ag_news_csv

See Also

Other topic: dataset_dbpedia(), dataset_trec()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
dataset_ag_news()

# Custom directory
dataset_ag_news(dir = "data/")

# Deleting dataset
dataset_ag_news(delete = TRUE)

# Returning filepath of data
dataset_ag_news(return_path = TRUE)

# Access both training and testing dataset
train <- dataset_ag_news(split = "train")
test <- dataset_ag_news(split = "test")

textdata documentation built on May 4, 2020, 9:05 a.m.