Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/15/19 22:04:10 (6 years ago)
Author:
gkronber
Message:

#2925: fixed a problem with solutions for latent variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs

    r16785 r16786  
    773773
    774774        #region produce classical solutions to allow visualization with PDP
    775         for (int treeIdx = 0; treeIdx < trees.Length; treeIdx++) {
     775        for (int treeIdx = 0; treeIdx < targetVars.Length; treeIdx++) {
    776776          var t = (ISymbolicExpressionTree)trees[treeIdx].Clone();
    777777          var name = targetVars.Concat(latentVariables).ElementAt(treeIdx); // whatever
    778778          var model = new SymbolicRegressionModel(name + "_diff", t, new SymbolicDataAnalysisExpressionTreeLinearInterpreter());
    779779          var solutionDataset = ((Dataset)problemData.Dataset).ToModifiable();
    780           if (treeIdx < targetVars.Length) {
    781             var absValues = solutionDataset.GetDoubleValues(name).ToArray();
    782             solutionDataset.AddVariable(name + "_diff", absValues.Skip(1).Zip(absValues, (v1, v0) => v1 - v0).Concat(new double[] { 0.0 }).ToList());
    783           }
     780          var absValues = solutionDataset.GetDoubleValues(name).ToArray();
     781          solutionDataset.AddVariable(name + "_diff", absValues.Skip(1).Zip(absValues, (v1, v0) => v1 - v0).Concat(new double[] { 0.0 }).ToList());
    784782          var solutionProblemData = new RegressionProblemData(solutionDataset, problemData.AllowedInputVariables, name + "_diff");
    785783          var solution = model.CreateRegressionSolution(solutionProblemData);
Note: See TracChangeset for help on using the changeset viewer.