Changeset 16275 for branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3
- Timestamp:
- 11/05/18 13:19:38 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs
r16268 r16275 259 259 } 260 260 // init params randomly from Unif(-1e-5, 1e-5) 261 var theta = paramNodes.Select(_ => random.NextDouble() * 2.0e- 5 - 1.0e-5).ToArray();261 var theta = paramNodes.Select(_ => random.NextDouble() * 2.0e-2 - 1.0e-2).ToArray(); 262 262 263 263 optTheta = new double[0]; … … 267 267 alglib.minlbfgscreate(Math.Min(theta.Length, 5), theta, out state); 268 268 alglib.minlbfgssetcond(state, 0.0, 0.0, 0.0, MaximumParameterOptimizationIterations); 269 alglib.minlbfgssetgradientcheck(state, 1e-6);269 //alglib.minlbfgssetgradientcheck(state, 1e-6); 270 270 alglib.minlbfgsoptimize(state, EvaluateObjectiveAndGradient, null, 271 271 new object[] { trees, targetVars, problemData, targetValues, episodes.ToArray(), NumericIntegrationSteps, latentVariables, OdeSolver }); //TODO: create a type … … 491 491 var models = new VariableCollection(); // to store target var names and original version of tree 492 492 493 int nextParIdx = 0; 493 494 foreach (var tup in targetVars.Zip(trees, Tuple.Create)) { 494 495 var targetVarName = tup.Item1; … … 496 497 497 498 // when we reference HeuristicLab.Problems.DataAnalysis.Symbolic we can translate symbols 498 int nextParIdx = 0;499 499 var shownTree = new SymbolicExpressionTree(TranslateTreeNode(tree.Root, optTheta, ref nextParIdx)); 500 500 … … 579 579 prevT = t; 580 580 581 if (variableValues.Count == targetVariables.Length) { 582 // only return the target variables for calculation of errors 583 var res = targetVariables 584 .Select(targetVar => variableValues[targetVar]) 585 .ToArray(); 586 if (res.Any(ri => double.IsNaN(ri.Item1) || double.IsInfinity(ri.Item1))) yield break; 587 yield return res; 588 } else { 589 yield break; // stop early on problems 590 } 581 // This check doesn't work with the HeuristicLab integrator if there are input variables 582 //if (variableValues.Count == targetVariables.Length) { 583 // only return the target variables for calculation of errors 584 var res = targetVariables 585 .Select(targetVar => variableValues[targetVar]) 586 .ToArray(); 587 if (res.Any(ri => double.IsNaN(ri.Item1) || double.IsInfinity(ri.Item1))) yield break; 588 yield return res; 589 //} else { 590 // yield break; // stop early on problems 591 //} 591 592 592 593
Note: See TracChangeset
for help on using the changeset viewer.