public DataSet removeExample(Example e) { DataSet ds = new DataSet(specification); foreach (Example eg in examples) { if (!(e.Equals(eg))) { ds.add(eg); } } return ds; }
public DataSet fromFile(string filename,DataSetSpecification spec,string separator) { // assumed file in data directory and ends in .csv DataSet ds = new DataSet(spec); // BufferedReader reader = new BufferedReader(new InputStreamReader( // this.getClass().getResourceAsStream("../data/" + filename + ".csv"))); // string line; // while ((line = reader.readLine()) != null) // { // ds.add(exampleFromString(line,spec,separator)); // } return ds; }
public Hashtable splitByAttribute(string attributeName) { Hashtable results = new Hashtable(); foreach (Example e in examples) { string val = e.getAttributeValueAsString(attributeName); if (results.Contains(val)) { //results.get(val).add(e); ((DataSet)results[val]).add(e); } else { DataSet ds = new DataSet(specification); ds.add(e); //results.put(val, ds); results.Add(val,ds); } } return results; }
public DataSet matchingDataSet(string attributeName, string attributeValue) { DataSet ds = new DataSet(specification); foreach (Example e in examples) { if (e.getAttributeValueAsString(attributeName).Equals(attributeValue)) { ds.add(e); } } return ds; }
public DataSet copy() { DataSet ds = new DataSet(specification); foreach (Example e in examples) { ds.add(e); } return ds; }