예제 #1
0
        public void NoisedSlopeAndIntercept()
        {
            var timeSeries = Helper.CreateTimeSeries(Intercept, Slope, true);

            var solver = new SimpleLinearRegression();
            var model  = solver.Run(timeSeries);

            Assert.That(model.Intercept, Is.EqualTo(Intercept).Within(0.01), "Incorrect intercept");
            Assert.That(model.Slope, Is.EqualTo(Slope).Within(0.01), "Incorrect slope");
        }
예제 #2
0
        public void ExactSlopeAndIntercept()
        {
            var timeSeries = Helper.CreateTimeSeries(Intercept, Slope);

            var regression = new SimpleLinearRegression();
            var model      = regression.Run(timeSeries);

            Assert.That(model.Intercept, Is.EqualTo(Intercept), "Incorrect intercept");
            Assert.That(model.Slope, Is.EqualTo(Slope), "Incorrect slope");
        }