/// <summary> /// Run the example. /// </summary> public void Process() { // read the iris data from the resources Assembly assembly = Assembly.GetExecutingAssembly(); var res = assembly.GetManifestResourceStream("AIFH_Vol1.Resources.iris.csv"); // did we fail to read the resouce if (res == null) { Console.WriteLine("Can't read iris data from embedded resources."); return; } // load the data var istream = new StreamReader(res); DataSet ds = DataSet.Load(istream); istream.Close(); // The following ranges are setup for the Iris data set. If you wish to normalize other files you will // need to modify the below function calls other files. ds.NormalizeRange(0, 0, 1); ds.NormalizeRange(1, 0, 1); ds.NormalizeRange(2, 0, 1); ds.NormalizeRange(3, 0, 1); IDictionary<String, int> species = ds.EncodeEquilateral(4); IList<BasicData> trainingData = ds.ExtractSupervised(0, 4, 4, 2); var network = new RBFNetwork(4, 4, 2); IScoreFunction score = new ScoreRegressionData(trainingData); var train = new TrainGreedyRandom(true, network, score); PerformIterations(train, 100000, 0.01, true); QueryEquilateral(network, trainingData, species, 0, 1); }
/// <summary> /// Perform the example. /// </summary> public void Process() { var trainingData = BasicData.ConvertArrays(XorInput, XorIdeal); var network = new RBFNetwork(2, 5, 1); var score = new ScoreRegressionData(trainingData); var train = new TrainGreedyRandom(true, network, score); PerformIterations(train, 1000000, 0.01, true); Query(network, trainingData); }
public void TestGreedyRandom() { var train = new TrainGreedyRandom(true, new TrialAlgo(), new TrialScore()) {LowRange = 0, HighRange = 10}; Assert.AreEqual(0, train.LowRange, AIFH.DefaultPrecision); Assert.AreEqual(10, train.HighRange, AIFH.DefaultPrecision); PerformTest(train); }
/// <summary> /// Run the example. /// </summary> public void Process() { IList<BasicData> trainingData = GenerateTrainingData(); var poly = new PolynomialFn(3); IScoreFunction score = new ScoreRegressionData(trainingData); var train = new TrainGreedyRandom(true, poly, score); PerformIterations(train, 1000000, 0.01, true); Console.WriteLine(poly.ToString()); }