Class SingleCSVReader

java.lang.Object
es.upm.fi.cig.multictbnc.data.reader.AbstractCSVReader
es.upm.fi.cig.multictbnc.data.reader.SingleCSVReader
All Implemented Interfaces:
DatasetReader

public class SingleCSVReader extends AbstractCSVReader
Reads time series data contained in a single CSV. It divides the dataset into several sequences depending on the selected strategy.
  • Constructor Details

    • SingleCSVReader

      public SingleCSVReader(String datasetFolder, int sizeSequence) throws FileNotFoundException, UnreadDatasetException
      Constructs a SingleCSVReader that extracts a CSV file from the specified folder.
      Parameters:
      datasetFolder - folder path where the CSV file is stored
      sizeSequence - maximum size of the sequences
      Throws:
      FileNotFoundException - if the CSV file was not found
      UnreadDatasetException - if a dataset could not be read from the specified folder
  • Method Details

    • extractFixedSequences

      public void extractFixedSequences(Dataset dataset, List<String[]> dataCSV)
      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 - a Dataset where sequences are stored
      dataCSV - 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

      public void extractFixedSequencesSameCC(Dataset dataset, List<String[]> dataCSV)
      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 - a Dataset where sequences are stored
      dataCSV - 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

      public Dataset readDataset() throws UnreadDatasetException
      Description copied from interface: DatasetReader
      Returns a dataset.
      Returns:
      a Dataset
      Throws:
      UnreadDatasetException - if the provided dataset could not be read