Class Arff
- All Implemented Interfaces:
AutoCloseable
A dataset is firstly described, beginning with the name of the dataset (or the relation in ARFF terminology). Each of the variables (or attribute in ARFF terminology) used to describe the observations is then identified, together with their data type, each definition on a single line. The actual observations are then listed, each on a single line, with fields separated by commas, much like a CSV file.
Missing values in an ARFF dataset are identified using the question mark '?'.
Comments can be included in the file, introduced at the beginning of a line with a '%', whereby the remainder of the line is ignored.
A significant advantage of the ARFF data file over the CSV data file is the metadata information.
Also, the ability to include comments ensure we can record extra information about the data set, including how it was derived, where it came from, and how it might be cited.
-
Constructor Details
-
Arff
Constructor.- Parameters:
path
- the input file path.- Throws:
IOException
- when fails to read the file.ParseException
- when fails to parse the file.URISyntaxException
- when the file path syntax is wrong.
-
Arff
Constructor.- Parameters:
path
- the input file path.charset
- the charset of file.- Throws:
IOException
- when fails to read the file.ParseException
- when fails to parse the file.URISyntaxException
- when the file path syntax is wrong.
-
Arff
Constructor.- Parameters:
path
- the input file path.- Throws:
IOException
- when fails to read the file.ParseException
- when fails to parse the file.
-
Arff
Constructor.- Parameters:
path
- the input file path.charset
- the charset of file.- Throws:
IOException
- when fails to read the file.ParseException
- when fails to parse the file.
-
Arff
Constructor.- Parameters:
reader
- the file reader.- Throws:
IOException
- when fails to read the file.ParseException
- when fails to parse the file.
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-
name
Returns the name of relation.- Returns:
- the name of relation.
-
schema
Returns the data schema.- Returns:
- the data schema.
-
read
Reads all the records.- Returns:
- the data frame.
- Throws:
IOException
- when fails to read the file.ParseException
- when fails to parse the file.
-
read
Reads a limited number of records.- Parameters:
limit
- the number of records to read.- Returns:
- the data frame.
- Throws:
IOException
- when fails to read the file.ParseException
- when fails to parse the file.
-
write
Writes the data frame to an ARFF file.- Parameters:
data
- the data frame.path
- the output file path.relation
- the relation name of ARFF.- Throws:
IOException
- when fails to write the file.
-