public void RNNPredictsWell() { QuqeUtil.Random = new Random(42); var data = NNTestUtils.GetData("2004-01-01", "2004-07-01"); var trainResult = Train(data, 8, 4, 1000); var trainingFitness = Functions.ComputeFitness(new PredictorWithInputs(new RNN(trainResult.RNNSpec), data.Input), data); Trace.WriteLine("Training fitness: " + trainingFitness); trainingFitness.ShouldEqual(0.968); }
public void RBFTrainingIsReproducible() { var data = NNTestUtils.GetData("2004-01-01", "2004-05-01"); var fitnesses = Lists.Repeat(5, i => { var rbfNet = RBFNet.Train(data.Input, data.Output, 0.1, 1); rbfNet.IsDegenerate.ShouldBeFalse(); return(Functions.ComputeFitness(new PredictorWithInputs(rbfNet, data.Input), data)); }); fitnesses.Distinct().Count().ShouldEqual(1); }
public void RNNTrainsQuickly() { var sw = new Stopwatch(); sw.Start(); var trainingData = NNTestUtils.GetData("2004-01-01", "2005-01-01"); Train(trainingData, 32, 16, 1000); sw.Stop(); sw.ElapsedMilliseconds.ShouldBeGreaterThan(2000).ShouldBeLessThan(17000); }
public void RNNTrainingIsReproducible() { var data = NNTestUtils.GetData("2004-01-01", "2004-05-01"); var checksums = Lists.Repeat(5, i => { QuqeUtil.Random = new Random(42); var trainResult = Train(data, 8, 4, 1000); return(NNTestUtils.Checksum(trainResult.RNNSpec.Weights)); }); checksums.Distinct().Count().ShouldEqual(1); }
public void RBFPredictsWell() { var data = NNTestUtils.GetData("2004-01-01", "2004-05-01"); Func <double, double> fitnessForTolerance = tolerance => { var rbfNet = RBFNet.Train(data.Input, data.Output, tolerance, 1); rbfNet.IsDegenerate.ShouldBeFalse(); var fitness = Functions.ComputeFitness(new PredictorWithInputs(rbfNet, data.Input), data); Trace.WriteLine("RBF fitness: " + fitness); return(fitness); }; fitnessForTolerance(0.2).ShouldBeGreaterThan(0.9); fitnessForTolerance(0.01).ShouldEqual(1.0); }