Loading the data

In the first step, we'll need to load the data from text files to a Java object. The files are stored in a folder, and each file contains one time series, with values per line. We'll load them into a Double list, as follows:

String filePath = "chap07/ydata/A1Benchmark/real"; 
List<List<Double>> rawData = new ArrayList<List<Double>>(); 

We will need the min and max value for histogram normalization; so, let's collect them in this data pass:

double max = Double.MIN_VALUE; 
double min = Double.MAX_VALUE; 
 
for(int i = 1; i<= 67; i++){ 
  List<Double> sample = new ArrayList<Double>(); 
  BufferedReader reader = new BufferedReader(new 
FileReader(filePath+i+".csv")); boolean isAnomaly = false; reader.readLine(); while(reader.ready()){ String line[] = reader.readLine().split(","); double value = Double.parseDouble(line[1]); sample.add(value); max = Math.max(max, value); min = Double.min(min, value); if(line[2] == "1") isAnomaly = true; } System.out.println(isAnomaly); reader.close(); rawData.add(sample); }

The data has been loaded. Next, let's move on to histograms.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.20.20