Changeset 13234
- Timestamp:
- 11/17/15 19:04:45 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessCovarianceOptimizationProblem.cs
r13209 r13234 192 192 } 193 193 194 // Does not produce the same result for the same seed when using parallel engine (see below)! 194 195 public override double Evaluate(ISymbolicExpressionTree tree, IRandom random) { 195 196 var meanFunction = new MeanConst(); … … 220 221 hyperParameters[0] = ds.GetDoubleValues(targetVariable).Average(); // mean const 221 222 222 for (int i = 0; i < covarianceFunction.GetNumberOfParameters(nVars); i++) { 223 hyperParameters[1 + i] = random.NextDouble() * 2.0 - 1.0; 223 // Evaluate might be called concurrently therefore access to random has to be synchronized. 224 // However, results of multiple runs with the same seed will be different when using the parallel engine. 225 lock (random) { 226 for (int i = 0; i < covarianceFunction.GetNumberOfParameters(nVars); i++) { 227 hyperParameters[1 + i] = random.NextDouble() * 2.0 - 1.0; 228 } 224 229 } 225 230 hyperParameters[hyperParameters.Length - 1] = 1.0; // s² = exp(2), TODO: other inits better?
Note: See TracChangeset
for help on using the changeset viewer.