- Timestamp:
- 10/22/15 19:28:06 (9 years ago)
- Location:
- stable
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 12794-12795,12797
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.DataAnalysis merged: 12797
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessBase.cs
r12009 r13053 108 108 Parameters[ApproximateGradientsParameterName].Hidden = true; // should not be changed 109 109 110 // necessary for BFGS 111 Parameters.Add(new ValueParameter<BoolValue>("Maximization", new BoolValue(false))); 112 Parameters["Maximization"].Hidden = true; 113 110 114 var randomCreator = new HeuristicLab.Random.RandomCreator(); 111 115 var gpInitializer = new GaussianProcessHyperparameterInitializer(); … … 181 185 [StorableHook(HookType.AfterDeserialization)] 182 186 private void AfterDeserialization() { 187 // BackwardsCompatibility3.4 188 #region Backwards compatible code, remove with 3.5 189 if (!Parameters.ContainsKey("Maximization")) { 190 Parameters.Add(new ValueParameter<BoolValue>("Maximization", new BoolValue(false))); 191 Parameters["Maximization"].Hidden = true; 192 } 193 #endregion 183 194 } 184 195 } -
stable/HeuristicLab.Algorithms.GradientDescent/3.3/Lbfgs.cs
r12708 r13053 200 200 RegisterEvents(); 201 201 solutionCreator.OperatorParameter.ActualName = Problem.SolutionCreatorParameter.Name; 202 solutionCreator.OperatorParameter.Hidden = true; 202 203 evaluator.OperatorParameter.ActualName = Problem.EvaluatorParameter.Name; 204 evaluator.OperatorParameter.Hidden = true; 203 205 UpdateAnalyzers(); 204 206 ParameterizeOperators(); … … 220 222 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 221 223 base.Problem_OperatorsChanged(sender, e); 224 RegisterEvents(); 225 solutionCreator.OperatorParameter.ActualName = Problem.SolutionCreatorParameter.Name; 226 solutionCreator.OperatorParameter.Hidden = true; 227 evaluator.OperatorParameter.ActualName = Problem.EvaluatorParameter.Name; 228 evaluator.OperatorParameter.Hidden = true; 222 229 UpdateAnalyzers(); 230 ParameterizeOperators(); 223 231 } 224 232 … … 266 274 var realVectorParameterName = realVectorCreator.RealVectorParameter.ActualName; 267 275 initializer.PointParameter.ActualName = realVectorParameterName; 276 initializer.PointParameter.Hidden = true; 268 277 makeStep.PointParameter.ActualName = realVectorParameterName; 278 makeStep.PointParameter.Hidden = true; 269 279 analyzer.PointParameter.ActualName = realVectorParameterName; 280 analyzer.PointParameter.Hidden = true; 270 281 } 271 282 272 283 var qualityParameterName = Problem.Evaluator.QualityParameter.ActualName; 273 284 updateResults.QualityParameter.ActualName = qualityParameterName; 285 updateResults.QualityParameter.Hidden = true; 274 286 analyzer.QualityParameter.ActualName = qualityParameterName; 287 analyzer.QualityParameter.Hidden = true; 275 288 } 276 289 } -
stable/HeuristicLab.Algorithms.GradientDescent/3.3/LbfgsUpdateResults.cs
r12009 r13053 37 37 private const string StateParameterName = "State"; 38 38 private const string ApproximateGradientsParameterName = "ApproximateGradients"; 39 private const string MaximizationParameterName = "Maximization"; 39 40 40 41 #region Parameter Properties … … 51 52 get { return (ILookupParameter<LbfgsState>)Parameters[StateParameterName]; } 52 53 } 54 public ILookupParameter<BoolValue> MaximizationParameter { 55 get { return (ILookupParameter<BoolValue>)Parameters[MaximizationParameterName]; } 56 } 53 57 #endregion 54 58 … … 58 62 private DoubleValue Quality { get { return QualityParameter.ActualValue; } } 59 63 private LbfgsState State { get { return StateParameter.ActualValue; } } 64 65 private BoolValue Maximization { 66 get { 67 // BackwardsCompatibility3.3 68 #region Backwards compatible code, remove with 3.4 69 // the parameter is new, previously we assumed minimization problems 70 if (MaximizationParameter.ActualValue == null) return new BoolValue(false); 71 #endregion 72 return MaximizationParameter.ActualValue; 73 } 74 } 75 60 76 #endregion 61 77 … … 70 86 Parameters.Add(new LookupParameter<BoolValue>(ApproximateGradientsParameterName, 71 87 "Flag that indicates if gradients should be approximated.")); 88 Parameters.Add(new LookupParameter<BoolValue>(MaximizationParameterName, "Flag that indicates if we solve a maximization problem.")); 72 89 // in & out 73 90 Parameters.Add(new LookupParameter<LbfgsState>(StateParameterName, "The state of the LM-BFGS algorithm.")); 91 } 92 93 [StorableHook(HookType.AfterDeserialization)] 94 private void AfterDeserialization() { 95 // BackwardsCompatibility3.3 96 97 #region Backwards compatible code, remove with 3.4 98 if (!Parameters.ContainsKey(MaximizationParameterName)) { 99 // previous behaviour defaulted to minimization 100 Parameters.Add(new LookupParameter<BoolValue>(MaximizationParameterName, "Flag that indicates if we solve a maximization problem.")); 101 } 102 #endregion 74 103 } 75 104 … … 80 109 public override IOperation Apply() { 81 110 var state = State; 82 var f = Quality.Value; 111 var sign = Maximization.Value ? -1.0 : 1.0; 112 var f = sign * Quality.Value; 83 113 state.State.f = f; 84 114 if (!ApproximateGradients.Value) { 85 var g = QualityGradients. ToArray();115 var g = QualityGradients.Select(gi => sign * gi).ToArray(); 86 116 state.State.g = g; 87 117 }
Note: See TracChangeset
for help on using the changeset viewer.