public void readHeader() throws Exception { String line = readLine(); while (line != null && !line.startsWith("@data")) { if (line.startsWith("@attribute")) { String[] tok = line.split("\\s"); Class<?> clazz = Object.class; if ("numeric".equalsIgnoreCase(tok[2].trim())) clazz = Double.class; String app = ""; int i = 0; while (attributes.containsKey(tok[1] + app)) app = "_" + (i++); attributes.put(tok[1] + app, clazz); } line = readLine(); } log.info("Attributes of Arff-Stream: {}", attributes); }
public void readHeader() throws Exception { String line = readLine(); while (line != null && !line.startsWith("@data")) { if (line.startsWith("@attribute")) { String[] tok = line.split("\\s"); Class<?> clazz = Object.class; if ("numeric".equalsIgnoreCase(tok[2].trim())) clazz = Double.class; String app = ""; int i = 0; while (attributes.containsKey(tok[1] + app)) app = "_" + (i++); attributes.put(tok[1] + app, clazz); } line = readLine(); } log.info("Attributes of Arff-Stream: {}", attributes); }
public void readHeader() throws Exception { String line = readLine(); while (line != null && !line.startsWith("@data")) { if (line.startsWith("@attribute")) { String[] tok = line.split("\\s"); Class<?> clazz = Object.class; if ("numeric".equalsIgnoreCase(tok[2].trim())) clazz = Double.class; String app = ""; int i = 0; while (attributes.containsKey(tok[1] + app)) app = "_" + (i++); attributes.put(tok[1] + app, clazz); } line = readLine(); } log.info("Attributes of Arff-Stream: {}", attributes); }
/** * @see stream.io.AbstractStream#readNext(stream.Data) */ @Override public Data readNext() throws Exception { Data datum = DataFactory.create(); String line = readLine(); while (line != null && line.trim().isEmpty()) line = readLine(); if (line != null && !line.trim().equals("")) { String[] tok = line.split(","); int i = 0; for (String name : attributes.keySet()) { if (i < tok.length) { if (Double.class.equals(attributes.get(name))) { datum.put(name, new Double(tok[i])); } else datum.put(name, tok[i]); i++; } else break; } } return datum; }
/** * @see stream.io.AbstractStream#readNext(stream.Data) */ @Override public Data readNext() throws Exception { Data datum = DataFactory.create(); String line = readLine(); while (line != null && line.trim().isEmpty()) line = readLine(); if (line != null && !line.trim().equals("")) { String[] tok = line.split(","); int i = 0; for (String name : attributes.keySet()) { if (i < tok.length) { if (Double.class.equals(attributes.get(name))) { datum.put(name, new Double(tok[i])); } else datum.put(name, tok[i]); i++; } else break; } } return datum; }
/** * @see stream.io.AbstractStream#readNext(stream.Data) */ @Override public Data readNext() throws Exception { Data datum = DataFactory.create(); String line = readLine(); while (line != null && line.trim().isEmpty()) line = readLine(); if (line != null && !line.trim().equals("")) { String[] tok = line.split(","); int i = 0; for (String name : attributes.keySet()) { if (i < tok.length) { if (Double.class.equals(attributes.get(name))) { datum.put(name, new Double(tok[i])); } else datum.put(name, tok[i]); i++; } else break; } } return datum; }