Changeset 15064 for branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/AugmentedExpectedImprovement.cs
- Timestamp:
- 06/26/17 09:10:56 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/AugmentedExpectedImprovement.cs
r14818 r15064 35 35 [StorableClass] 36 36 [Item("AugmentedExpectedImprovement", "Noisy InfillCriterion, Extension of the Expected Improvement as described in\n Global optimization of stochastic black-box systems via sequential kriging meta-models.\r\nHuang, D., Allen, T., Notz, W., Zeng, N.")] 37 public class AugmentedExpectedImprovement : ExpectedImprovement { 38 39 37 public class AugmentedExpectedImprovement : ExpectedImprovementBase { 40 38 41 39 #region Parameternames 42 43 40 public const string AlphaParameterName = "Alpha"; 44 45 41 #endregion 46 42 47 43 #region Parameters 48 49 44 public IValueParameter<DoubleValue> AlphaParameter => Parameters[AlphaParameterName] as IValueParameter<DoubleValue>; 50 51 45 #endregion 52 46 53 47 #region Properties 54 55 48 public double Alpha => AlphaParameter.Value.Value; 56 49 [Storable] 57 50 private double Tau; 58 59 51 #endregion 60 52 61 62 #region HL-Constructors, Serialization and Cloning 53 #region Constructors, Serialization and Cloning 63 54 [StorableConstructor] 64 private AugmentedExpectedImprovement(bool deserializing) : base(deserializing) { } 65 66 private AugmentedExpectedImprovement(AugmentedExpectedImprovement original, Cloner cloner) : base(original, cloner) { 55 protected AugmentedExpectedImprovement(bool deserializing) : base(deserializing) { } 56 protected AugmentedExpectedImprovement(AugmentedExpectedImprovement original, Cloner cloner) : base(original, cloner) { 67 57 Tau = original.Tau; 68 58 } 69 70 59 public AugmentedExpectedImprovement() { 71 60 Parameters.Add(new ValueParameter<DoubleValue>(AlphaParameterName, "The Alpha value specifiying the robustness of the \"effective best solution\". Recommended value is 1", new DoubleValue(1.0))); 72 73 61 } 74 62 public override IDeepCloneable Clone(Cloner cloner) { … … 82 70 } 83 71 84 protected override void Initialize() {85 if (ExpensiveMaximization) throw new NotImplementedException("AugmentedExpectedImprovement for maximization not yet implemented");86 var solution = RegressionSolution as IConfidenceRegressionSolution;87 if (solution == null) throw new ArgumentException("can not calculate Augmented EI without a regression solution providing confidence values");72 protected override double Evaluate(RealVector vector, double estimatedFitness, double estimatedStandardDeviation) { 73 var d = GetEstimatedImprovement(BestFitness, estimatedFitness, estimatedStandardDeviation, ExploitationWeight, ExpensiveMaximization); 74 return d * (1 - Tau / Math.Sqrt(estimatedStandardDeviation * estimatedStandardDeviation + Tau * Tau)); 75 } 88 76 77 protected override double FindBestFitness(IConfidenceRegressionSolution solution) { 89 78 Tau = RegressionSolution.EstimatedTrainingValues.Zip(RegressionSolution.ProblemData.TargetVariableTrainingValues, (d, d1) => Math.Abs(d - d1)).Average(); 90 var xss= new RealVector(Encoding.Length);79 var bestSolution = new RealVector(Encoding.Length); 91 80 var xssIndex = solution.EstimatedTrainingValues.Zip(solution.EstimatedTrainingValues, (m, s2) => m + Alpha * Math.Sqrt(s2)).ArgMin(x => x); 92 81 var i = solution.ProblemData.TrainingIndices.ToArray()[xssIndex]; 93 for (var j = 0; j < Encoding.Length; j++) xss[j] = solution.ProblemData.Dataset.GetDoubleValue(i, j); 94 95 YMin = RegressionSolution.Model.GetEstimation(xss); 82 for (var j = 0; j < Encoding.Length; j++) bestSolution[j] = solution.ProblemData.Dataset.GetDoubleValue(i, j); 83 return RegressionSolution.Model.GetEstimation(bestSolution); 96 84 } 97 85 }
Note: See TracChangeset
for help on using the changeset viewer.