mldr: Creates an object representing a multilabel dataset

Description Usage Arguments Value See Also Examples

View source: R/mldr.R

Description

Reads a multilabel dataset from a file and returns an mldr object containing the data and additional measures. The file has to be in ARFF format. The label information could be in a separate XML file (MULAN style) or in the the arff header (MEKA style)

Usage

1
2
3
4
mldr(filename, use_xml = TRUE, auto_extension = TRUE, xml_file,
  label_indices, label_names, label_amount,
  force_read_from_file = !all(c(missing(xml_file), missing(label_indices),
  missing(label_names), missing(label_amount), use_xml, auto_extension)), ...)

Arguments

filename

Name of the dataset

use_xml

Specifies whether to use an associated XML file to identify the labels. Defaults to TRUE

auto_extension

Specifies whether to add the '.arff' and '.xml' extensions to the filename where appropriate. Defaults to TRUE

xml_file

Path to the XML file. If not provided, the filename ending in ".xml" will be assumed

label_indices

Optional vector containing the indices of the attributes that should be read as labels

label_names

Optional vector containing the names of the attributes that should be read as labels

label_amount

Optional parameter indicating the number of labels in the dataset, which will be taken from the last attributes of the dataset

force_read_from_file

Set this parameter to TRUE to always read from a local file, or set it to FALSE to look for the dataset within the 'mldr.datasets' package

...

Extra parameters to be passed to 'read_arff'

Value

An mldr object containing the multilabel dataset

See Also

mldr_from_dataframe, read.arff, summary.mldr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(mldr)
## Not run: 
# Read "yeast.arff" and labels from "yeast.xml"
mymld <- mldr("yeast")

# Read "yeast.arff" and labels from "yeast.xml", converting categorical
# attributes to factors
mymld <- mldr("yeast", stringsAsFactors = TRUE)

# Read "yeast-tra.arff" and labels from "yeast.xml"
mymld <- mldr("yeast-tra", xml_file = "yeast.xml")

# Read "yeast.arff" specifying the amount of attributes to be used as labels
mymld <- mldr("yeast", label_amount = 14)

# Read MEKA style dataset, without XML file and giving extension
mymld <- mldr("IMDB.arff", use_xml = FALSE, auto_extension = FALSE)

## End(Not run)

mldr documentation built on Feb. 5, 2018, 1:01 a.m.