/// <summary> /// Add a new example to the set. /// </summary> /// <param name="example">A new example</param> public void AddExample(Example example) { examples.Add(example); }
/// <summary> /// Constructs and example set from data read in as key, value pairs. takes an /// array of input keys and ouptut keys to divide the raw data into a set of /// inputs and expected values. /// </summary> /// <param name="data">A list of name value pairs of raw data</param> /// <param name="inputs">A list of names of input values</param> /// <param name="outputs">A list of names of output values</param> /// <returns>A constructed example set</returns> public static ExampleSet MakeExamples(List<Dictionary<String, double> > data, List<String> inputs, List<String> outputs) { ExampleSet result = new ExampleSet(); foreach(Dictionary<String, double> datum in data) { Example ex = new Example(); foreach(String name in inputs) { ex.Inputs[name] = datum[name]; } foreach(String name in outputs) { ex.Expected[name] = datum[name]; } result.AddExample(ex); } return result; }