public void BayesianOptimizer_OptimizeBest_MultipleParameters(bool runParallel) { var parameters = new MinMaxParameterSpec[] { new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear), new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear), new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear), }; var sut = new BayesianOptimizer(parameters, iterations: 100, randomStartingPointCount: 5, functionEvaluationsPerIterationCount: 1, randomSearchPointCount: 1000, seed: 42, runParallel: runParallel); var actual = sut.OptimizeBest(Minimize); Assert.AreEqual(-0.76070603822760785, actual.Error, Delta); Assert.AreEqual(3, actual.ParameterSet.Length); Assert.AreEqual(1.6078245041928358, actual.ParameterSet[0], Delta); Assert.AreEqual(-8.9735394990879769, actual.ParameterSet[1], Delta); Assert.AreEqual(-0.18217921731163855, actual.ParameterSet[2], Delta); }
public void BayesianOptimizer_OptimizeBest() { var parameters = new double[][] { new double[] { -10.0, 10.0 }, new double[] { -10.0, 10.0 }, new double[] { -10.0, 10.0 } }; var sut = new BayesianOptimizer(parameters, 100, 5, 1); var actual = sut.OptimizeBest(Minimize); Assert.AreEqual(actual.Error, -0.92327107866106661, 0.0001); Assert.AreEqual(actual.ParameterSet.Length, 3); Assert.AreEqual(actual.ParameterSet[0], 8.1239613509382878, 0.0001); Assert.AreEqual(actual.ParameterSet[1], -9.2896384835660637, 0.0001); Assert.AreEqual(actual.ParameterSet[2], -0.03435398919245003, 0.0001); }
public void BayesianOptimizer_OptimizeBest() { var parameters = new ParameterBounds[] { new ParameterBounds(-10.0, 10.0, Transform.Linear), new ParameterBounds(-10.0, 10.0, Transform.Linear), new ParameterBounds(-10.0, 10.0, Transform.Linear), }; var sut = new BayesianOptimizer(parameters, 100, 5, 1); var actual = sut.OptimizeBest(Minimize); Assert.AreEqual(actual.Error, -0.74765422244251278, 0.0001); Assert.AreEqual(actual.ParameterSet.Length, 3); Assert.AreEqual(actual.ParameterSet[0], -5.0065683270835173, m_delta); Assert.AreEqual(actual.ParameterSet[1], -9.67008227467075, m_delta); Assert.AreEqual(actual.ParameterSet[2], -0.24173704452893574, m_delta); }
public void BayesianOptimizer_OptimizeBest() { var parameters = new MinMaxParameterSpec[] { new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear), new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear), new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear), }; var sut = new BayesianOptimizer(parameters, 100, 5, 1, maxDegreeOfParallelism: 1); var actual = sut.OptimizeBest(Minimize); Assert.AreEqual(-0.74765422244251278, actual.Error, 0.0001); Assert.AreEqual(3, actual.ParameterSet.Length); Assert.AreEqual(-5.00656832708352, actual.ParameterSet[0], Delta); Assert.AreEqual(-9.67008227467075, actual.ParameterSet[1], Delta); Assert.AreEqual(-0.241737044528936, actual.ParameterSet[2], Delta); }
public void BayesianOptimizer_OptimizeBestInParallel() { var parameters = new MinMaxParameterSpec[] { new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear), new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear), new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear), }; //high variance without fixed seed var sut = new BayesianOptimizer(parameters, 100, 5, 2, seed: Seed); var actual = sut.OptimizeBest(Minimize); Assert.AreEqual(-0.736123479387088, actual.Error, Delta); Assert.AreEqual(3, actual.ParameterSet.Length); Assert.AreEqual(-4.37019084318084, actual.ParameterSet[0], Delta); Assert.AreEqual(-3.05224638108734, actual.ParameterSet[1], Delta); Assert.AreEqual(0.274598500819224, actual.ParameterSet[2], Delta); }
public void BayesianOptimizer_OptimizeBest_SingleParameter(bool runParallel) { var parameters = new MinMaxParameterSpec[] { new MinMaxParameterSpec(0.0, 100.0, Transform.Linear) }; var sut = new BayesianOptimizer(parameters, iterations: 80, randomStartingPointCount: 20, functionEvaluationsPerIterationCount: 1, randomSearchPointCount: 1000, seed: 42, runParallel: runParallel); var actual = sut.OptimizeBest(MinimizeWeightFromHeight); Assert.AreEqual(126.50056735005998, actual.Error, Delta); Assert.AreEqual(38.359608938153649, actual.ParameterSet.Single(), Delta); }