/// <summary> /// turns a simple arff instance into the complex Library and Story related ArffInstance Type /// </summary> /// <returns></returns> public ArffInstance ToComplexInstance() { ArffInstance ai = new ArffInstance(); ai.Headers = new Library(); ai.Datasets = new Library(); ai.Headers.Data = new List <Story>(); ai.Datasets.Data = new List <Story>(); ai.Relation = Relation; Story st = null; foreach (KeyValuePair <string, List <string> > story in this.Attributes) { st = new Story(story.Key, story.Value.ToArray <string>(), EArffTypes.ATTRIBUTE); ai.Headers.Data.Add(st); } foreach (List <string> set in this.Datasets) { st = new Story(null, set.ToArray <string>(), EArffTypes.DATA); ai.Datasets.Data.Add(st); } return(ai); }
/// <summary> /// turns a complex Library and Story related ArffInstance into a way simpler Data Structure, /// which is easier to understand, and requires less memory space /// </summary> /// <param name="ai"></param> public SimpleArffInstance(ArffInstance ai) { this.Attributes = new Dictionary<string, List<string>>(); this.Datasets = new List<List<string>>(); this.Relation = ai.Relation; foreach (Story st in ai.Headers.Data) { this.Attributes.Add(st.Name, st.Data.ToList<string>()); } foreach (Story st in ai.Datasets.Data) { this.Datasets.Add(st.Data.ToList<string>()); } }
/// <summary> /// turns a complex Library and Story related ArffInstance into a way simpler Data Structure, /// which is easier to understand, and requires less memory space /// </summary> /// <param name="ai"></param> public SimpleArffInstance(ArffInstance ai) { this.Attributes = new Dictionary <string, List <string> >(); this.Datasets = new List <List <string> >(); this.Relation = ai.Relation; foreach (Story st in ai.Headers.Data) { this.Attributes.Add(st.Name, st.Data.ToList <string>()); } foreach (Story st in ai.Datasets.Data) { this.Datasets.Add(st.Data.ToList <string>()); } }
private void loadArffFile() { loader = new ArffLoader(options.InFile); loader.loadArff(); instance = loader.getInstance(); }
/// <summary> /// turns a simple arff instance into the complex Library and Story related ArffInstance Type /// </summary> /// <returns></returns> public ArffInstance ToComplexInstance() { ArffInstance ai = new ArffInstance(); ai.Headers = new Library(); ai.Datasets = new Library(); ai.Headers.Data = new List<Story>(); ai.Datasets.Data = new List<Story>(); ai.Relation = Relation; Story st = null; foreach (KeyValuePair<string, List<string>> story in this.Attributes) { st = new Story(story.Key, story.Value.ToArray<string>(), EArffTypes.ATTRIBUTE); ai.Headers.Data.Add(st); } foreach (List<string> set in this.Datasets) { st = new Story(null, set.ToArray<string>(), EArffTypes.DATA); ai.Datasets.Data.Add(st); } return ai; }