Пример #1
0
        public double GetNextQueryPoint()
        {
            if (!Gp.Data.Any())
            {
                return(GetRandomQueryPoint());
            }

            var best = Gp
                       .EstimateAtRange(Xs)
                       .Max(q => GetAquistionValue(q));

            return(best.X);
        }
Пример #2
0
        public void EstimateAtRangeTest()
        {
            var actual   = _gp.EstimateAtRange(new double[] { 1.02, 1.775, 2.530, 3.285, 4.04 });
            var expected = new double[5, 4]
            {
                { 0.790, 0.790, 0.790, 1.02 },
                { 0.939, 0.950, 0.962, 1.775 },
                { 0.711, 0.848, 0.984, 2.530 },
                { 0.447, 0.728, 1.010, 3.285 },
                { 0.650, 0.650, 0.650, 4.04 }
            };

            Assert.AreEqual(expected.GetLength(0), actual.Count);

            actual.ToArray().ForEach((i, q) =>
            {
                Assert.AreEqual(expected[i, 0], q.LowerBound, _delta);
                Assert.AreEqual(expected[i, 1], q.Mean, _delta);
                Assert.AreEqual(expected[i, 2], q.UpperBound, _delta);
                Assert.AreEqual(expected[i, 3], q.X, _delta);
            });
        }