SimplifiedTimeSeriesLoader { @SuppressWarnings("unchecked") public static Pair<TimeSeriesDataset2, ClassMapper> loadArff(final File arffFile) throws TimeSeriesLoadingException { if (arffFile == null) { throw new IllegalArgumentException("Parameter 'arffFile' must not be null!"); } Object[] tsTargetClassNames = loadTimeSeriesWithTargetFromArffFile(arffFile); ArrayList<double[][]> matrices = new ArrayList<>(); matrices.add((double[][]) tsTargetClassNames[0]); ClassMapper cm = null; if (tsTargetClassNames[2] != null) { cm = new ClassMapper((List<String>) tsTargetClassNames[2]); } return new Pair<>(new TimeSeriesDataset2(matrices, new ArrayList<double[][]>(), (int[]) tsTargetClassNames[1]), cm); } private  SimplifiedTimeSeriesLoader(); @SuppressWarnings("unchecked") static Pair<TimeSeriesDataset2, ClassMapper> loadArff(final File arffFile); @SuppressWarnings("unchecked") static Pair<TimeSeriesDataset2, ClassMapper> loadArffs(final File... arffFiles); static int countFileLines(final File file); static final String DEFAULT_CHARSET; }
@Test public void testUnivariateArffFileLoading() throws TimeSeriesLoadingException { final File datasetFile = new File( TSC_DATASET_PATH_PREFIX + "univariate" + File.separator + "Car" + File.separator + "Car_TRAIN.arff"); final Pair<TimeSeriesDataset2, ClassMapper> pairResult = SimplifiedTimeSeriesLoader.loadArff(datasetFile); TimeSeriesDataset2 result = pairResult.getX(); final int expectedNumInstances = 60; final int expectedNumSteps = 577; final int expectedNumVariables = 1; final int expectedNumTargets = 60; assertEquals(expectedNumInstances, result.getNumberOfInstances()); assertEquals(expectedNumSteps, result.getValues(0)[0].length); assertEquals(expectedNumVariables, result.getNumberOfVariables()); assertEquals(expectedNumTargets, result.getTargets().length); }