java.lang.Object
es.upm.fi.cig.multictbnc.data.representation.Sequence
Represents a sequence of multivariate data, i.e., a set of data points with multiple variables where the order is
 relevant. In this case, a sequence represents a time series since the data is ordered by a time variable.
- 
Constructor SummaryConstructorsConstructorDescriptionSequence(State stateClassVariables, List<State> observations, String nameTimeVariable, List<Double> timestamps) Constructs aSequence.Sequence(String nameTimeVariable, List<String> nameFeatureVariables, List<String> nameClassVariables, double[] timeValues, String[][] featureVariablesValues, String[] classVariablesValues, Map<String, Integer> idxFeatureVariables) Constructs aSequence.Sequence(List<String> nameVariables, String nameTimeVariable, List<String> nameClassVariables, List<String[]> dataObservations) Constructs aSequence.Sequence(List<String> nameVariables, String nameTimeVariable, List<String> nameClassVariables, List<String> nameFeatureVariables, List<String[]> dataObservations) Constructs aSequence.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaddFeatureVariable(String nameFeatureVariable, Sequence sequence) Adds a new feature variable to the sequence by copying the values from another sequence with the same number of observations.Returns a Map object with the class variables' names and values.Returns the path of the file from which the sequence was extracted.Retrieves the mapping of feature variable names to their indexes within the sequence.Returns the name of all the variables, including the time variable.Returns the names of the class variables.Returns the names of the feature variables.Returns the name of the time variable.intReturns the total number of class and feature variables in the sequence.intReturns the number of observations that the sequence contains.String[]Gets all the possible states of a specific variable.doublegetTimeValue(int idxObservation) Returns the value of the time variable in a given observation.double[]Returns the values of the time variable in the sequence.getValueClassVariable(String nameClassVariable) Returns the values of the specified class variable.getValueFeatureVariable(int idxObservation, String nameVariable) Returns the value of a certain feature variable for a given observation.String[]getValuesFeatureVariables(int idxObservation) Returns the values of all feature variables for a given observation.getValueVariable(int idxObservation, String nameVariable) Returns the value of a certain variable for a given observation.String[][]Retrieves the array of values for all variables (excluding the time variable) for each observation in the sequence.voidremoveFeatureVariable(String nameFeature) Removes a feature from the sequence.voidsetFilePath(String filePath) Sets the path of the file from which the sequence was extracted.toString()
- 
Constructor Details- 
Sequencepublic Sequence(List<String> nameVariables, String nameTimeVariable, List<String> nameClassVariables, List<String[]> dataObservations) throws ErroneousSequenceException Constructs aSequence. It receives the names of all the variables and those that are time and class variables, and the observations of the sequence.- Parameters:
- nameVariables- names of all the variables in the sequence. It is assumed that they are presented in the same order as they appear in the data of the observations
- nameTimeVariable- name of the time variable
- nameClassVariables- name of the class variables
- dataObservations- list of arrays with the values of the observations
- Throws:
- ErroneousSequenceException- if a valid sequence cannot be created with the provided data
 
- 
Sequencepublic Sequence(String nameTimeVariable, List<String> nameFeatureVariables, List<String> nameClassVariables, double[] timeValues, String[][] featureVariablesValues, String[] classVariablesValues, Map<String, Integer> idxFeatureVariables) Constructs aSequence. It receives the names of the time, feature and class variables and their observations.- Parameters:
- nameTimeVariable- name of the time variable
- nameFeatureVariables- name of the feature variables
- nameClassVariables- name of the class variables
- timeValues- array of time values for the sequence
- featureVariablesValues- array of feature variable values for the sequence
- classVariablesValues- array of class variable values for the sequence
- idxFeatureVariables- mapping of feature variable names to their indexes
 
- 
Sequencepublic Sequence(List<String> nameVariables, String nameTimeVariable, List<String> nameClassVariables, List<String> nameFeatureVariables, List<String[]> dataObservations) throws ErroneousSequenceException Constructs aSequence. It receives the names of all the variables and the observations of the sequence.- Parameters:
- nameVariables- names of all the variables in the sequence. It is assumed that they are presented in the same order as they appear in the data of the observations
- nameTimeVariable- name of the time variable
- nameClassVariables- names of the class variables
- nameFeatureVariables- names of the feature variables
- dataObservations- list of arrays with the values of the observations
- Throws:
- ErroneousSequenceException- if a valid sequence cannot be created with the provided data
 
- 
Sequencepublic Sequence(State stateClassVariables, List<State> observations, String nameTimeVariable, List<Double> timestamps) throws ErroneousSequenceException Constructs aSequence. This constructor is used by the models to sample sequences.- Parameters:
- stateClassVariables- class configuration of the class variables
- observations- list of- Staterepresenting the observations of the sequence
- nameTimeVariable- name of the time variable
- timestamps- list of- Doublerepresenting the timestamps when each observation of the sequence was obtained
- Throws:
- ErroneousSequenceException- if a valid sequence cannot be created with the provided data
 
 
- 
- 
Method Details- 
addFeatureVariableAdds a new feature variable to the sequence by copying the values from another sequence with the same number of observations.- Parameters:
- nameFeatureVariable- name of the new feature variable to be added
- sequence- sequence containing the values of the new feature variable for each observation
- Returns:
- trueif the addition was successful,- falseotherwise
 
- 
getNumObservationspublic int getNumObservations()Returns the number of observations that the sequence contains.- Returns:
- number of observations
 
- 
getNumClassAndFeatureVariablespublic int getNumClassAndFeatureVariables()Returns the total number of class and feature variables in the sequence.- Returns:
- total number of class and feature variables in the sequence
 
- 
getValueFeatureVariableReturns the value of a certain feature variable for a given observation.- Parameters:
- idxObservation- observation index
- nameVariable- name of the variable
- Returns:
- value of the feature variable in the observation
 
- 
getNameClassVariablesReturns the names of the class variables.- Returns:
- names of the class variables
 
- 
getNameFeatureVariablesReturns the names of the feature variables.- Returns:
- names of the feature variables.
 
- 
getClassVariablesReturns a Map object with the class variables' names and values.- Returns:
- Map with names and values of the class variables
 
- 
getFilePathReturns the path of the file from which the sequence was extracted.- Returns:
- path of the file from which the sequence was extracted
 
- 
setFilePathSets the path of the file from which the sequence was extracted.- Parameters:
- filePath- path of the file
 
- 
getIdxFeatureVariablesRetrieves the mapping of feature variable names to their indexes within the sequence.- Returns:
- Mapwhere keys are the names of the feature variables and values are their corresponding indexes in the observations.
 
- 
getNameAllVariablesReturns the name of all the variables, including the time variable.- Returns:
- name of all the variables
 
- 
getNameTimeVariableReturns the name of the time variable.- Returns:
- name of the time variable
 
- 
getStatesGets all the possible states of a specific variable. Returns null if the variable does not exist or was ignored.- Parameters:
- nameVariable- name of the variable whose possible states we want to know
- Returns:
- Array with the states of the variable
 
- 
getTimeValuespublic double[] getTimeValues()Returns the values of the time variable in the sequence.- Returns:
- values of the time variable in the sequence
 
- 
getValueVariableReturns the value of a certain variable for a given observation.- Parameters:
- idxObservation- observation index
- nameVariable- name of the variable
- Returns:
- value of the variable in the observation
 
- 
getValueClassVariableReturns the values of the specified class variable.- Parameters:
- nameClassVariable- name of the class variable
- Returns:
- values of the class variable
 
- 
getVariablesValuesRetrieves the array of values for all variables (excluding the time variable) for each observation in the sequence.- Returns:
- array of Stringwhere each row represents an observation and each column represents a variable's value at that observation
 
- 
removeFeatureVariableRemoves a feature from the sequence.- Parameters:
- nameFeature- name of the feature variable
 
- 
toString
- 
getTimeValuepublic double getTimeValue(int idxObservation) Returns the value of the time variable in a given observation.- Parameters:
- idxObservation- observation index
- Returns:
- value of the time variable
 
- 
getValuesFeatureVariablesReturns the values of all feature variables for a given observation.- Parameters:
- idxObservation- observation index
- Returns:
- values of the feature variables in the observation
 
 
-