java.lang.Object
es.upm.fi.cig.multictbnc.data.reader.AbstractCSVReader
es.upm.fi.cig.multictbnc.data.reader.SingleCSVReader
- All Implemented Interfaces:
DatasetReader
Reads time series data contained in a single CSV. It divides the dataset into several sequences depending on the
selected strategy.
-
Constructor Summary
ConstructorDescriptionSingleCSVReader
(String datasetFolder, int sizeSequence) Constructs aSingleCSVReader
that extracts a CSV file from the specified folder. -
Method Summary
Modifier and TypeMethodDescriptionvoid
extractFixedSequences
(Dataset dataset, List<String[]> dataCSV) Extracts sequences that have the same maximum length and add them to the specified dataset.void
extractFixedSequencesSameCC
(Dataset dataset, List<String[]> dataCSV) Extracts sequences that have the same maximum length and add them to the specified dataset.Returns a dataset.Methods inherited from class es.upm.fi.cig.multictbnc.data.reader.AbstractCSVReader
extractVariableNames, getNameClassVariables, getNameFeatureVariables, getNameTimeVariable, getNameVariables, isDatasetOutdated, readCSV, readDataset, removeZeroVarianceVariables, setDatasetAsOutdated, setTimeAndClassVariables, setTimeAndFeatureVariables, setTimeVariable, setVariables
-
Constructor Details
-
SingleCSVReader
public SingleCSVReader(String datasetFolder, int sizeSequence) throws FileNotFoundException, UnreadDatasetException Constructs aSingleCSVReader
that extracts a CSV file from the specified folder.- Parameters:
datasetFolder
- folder path where the CSV file is storedsizeSequence
- maximum size of the sequences- Throws:
FileNotFoundException
- if the CSV file was not foundUnreadDatasetException
- if a dataset could not be read from the specified folder
-
-
Method Details
-
extractFixedSequences
Extracts sequences that have the same maximum length and add them to the specified dataset. It is assumed that the names of the variables are in the first array of "dataCSV".- Parameters:
dataset
- aDataset
where sequences are storeddataCSV
- list of String arrays with the data extracted from the CSV file. The first array in the list must contain the name of the variables
-
extractFixedSequencesSameCC
Extracts sequences that have the same maximum length and add them to the specified dataset. Observations of a sequence must belong to the same class configuration. Therefore, sequences could contain less observation if a transition of a class variable occurs before reaching the maximum sequence size. It is assumed that the names of the variables are in the first array of "dataCSV".- Parameters:
dataset
- aDataset
where sequences are storeddataCSV
- list of String arrays with the data extracted from the CSV file. The first array in the list must contain the name of the variables
-
readDataset
Description copied from interface:DatasetReader
Returns a dataset.- Returns:
- a
Dataset
- Throws:
UnreadDatasetException
- if the provided dataset could not be read
-