Package ai.libs.jaicore.ml.tsc.util
Class SimplifiedTimeSeriesLoader
- java.lang.Object
-
- ai.libs.jaicore.ml.tsc.util.SimplifiedTimeSeriesLoader
-
public class SimplifiedTimeSeriesLoader extends java.lang.ObjectTime series loader class which provides functionality to read datasets from files storing into simplified, more efficient time series datasets.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_CHARSETDefault charset used when extracting from files.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcountFileLines(java.io.File file)Counts the lines of the given File object in a very efficient way (thanks to https://stackoverflow.com/a/453067).static ai.libs.jaicore.basic.sets.Pair<TimeSeriesDataset,ClassMapper>loadArff(java.io.File arffFile)Loads a univariate time series dataset from the given arff file.static ai.libs.jaicore.basic.sets.Pair<TimeSeriesDataset,ClassMapper>loadArffs(java.io.File... arffFiles)Loads a multivariate time series dataset from multiple arff files (each for one series).
-
-
-
Field Detail
-
DEFAULT_CHARSET
public static final java.lang.String DEFAULT_CHARSET
Default charset used when extracting from files.- See Also:
- Constant Field Values
-
-
Method Detail
-
loadArff
public static ai.libs.jaicore.basic.sets.Pair<TimeSeriesDataset,ClassMapper> loadArff(java.io.File arffFile) throws TimeSeriesLoadingException
Loads a univariate time series dataset from the given arff file. Assumes the class attribute to be the last among the declared attributes in the file.- Parameters:
arffFile- The arff file which is read- Returns:
- Returns a pair consisting of an univariate TimeSeriesDataset object and a list of String objects containing the class values.
- Throws:
TimeSeriesLoadingException- Throws an exception when the TimeSeriesDataset could not be created from the given file.
-
loadArffs
public static ai.libs.jaicore.basic.sets.Pair<TimeSeriesDataset,ClassMapper> loadArffs(java.io.File... arffFiles) throws TimeSeriesLoadingException
Loads a multivariate time series dataset from multiple arff files (each for one series). The arff files must share the same targets among all series. Assumes the class attribute to be the last among the declared attributes in the file.- Parameters:
arffFiles- A sequence of arff files each containing one time series per instance- Returns:
- Returns a multivariate TimeSeriesDataset object
- Throws:
TimeSeriesLoadingException- Throws an exception when the TimeSeriesDataset could not be created from the given files.
-
countFileLines
public static int countFileLines(java.io.File file) throws java.io.IOExceptionCounts the lines of the given File object in a very efficient way (thanks to https://stackoverflow.com/a/453067).- Parameters:
filename- File which lines of code are counted- Returns:
- Returns the number of file lines
- Throws:
java.io.IOException- Throws exception when the given file could not be read
-
-