Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8174


Ignore:
Timestamp:
07/02/12 10:04:18 (12 years ago)
Author:
sforsten
Message:

#1720: added some small memory allocation improvements. The caches are initialized with the correct size, so no reallocation for the caches is necessary.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs

    r8167 r8174  
    8888      }
    8989
     90      trainingEvaluationCache = new Dictionary<int, double>(original.ProblemData.TrainingIndices.Count());
     91      testEvaluationCache = new Dictionary<int, double>(original.ProblemData.TestIndices.Count());
     92
    9093      classificationSolutions = cloner.Clone(original.classificationSolutions);
    9194      RegisterClassificationSolutionsEventHandler();
     
    130133        throw new ArgumentException();
    131134      }
     135
     136      trainingEvaluationCache = new Dictionary<int, double>(problemData.TrainingIndices.Count());
     137      testEvaluationCache = new Dictionary<int, double>(problemData.TestIndices.Count());
    132138
    133139      RegisterClassificationSolutionsEventHandler();
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolution.cs

    r8139 r8174  
    4444    public ClassificationSolution(IClassificationModel model, IClassificationProblemData problemData)
    4545      : base(model, problemData) {
    46       evaluationCache = new Dictionary<int, double>();
     46      evaluationCache = new Dictionary<int, double>(problemData.Dataset.Rows);
    4747    }
    4848
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs

    r8167 r8174  
    8989      }
    9090
     91      trainingEvaluationCache = new Dictionary<int, double>(original.ProblemData.TrainingIndices.Count());
     92      testEvaluationCache = new Dictionary<int, double>(original.ProblemData.TestIndices.Count());
     93
    9194      regressionSolutions = cloner.Clone(original.regressionSolutions);
    9295      RegisterRegressionSolutionsEventHandler();
     
    135138        throw new ArgumentException();
    136139      }
     140
     141      trainingEvaluationCache = new Dictionary<int, double>(problemData.TrainingIndices.Count());
     142      testEvaluationCache = new Dictionary<int, double>(problemData.TestIndices.Count());
    137143
    138144      RegisterRegressionSolutionsEventHandler();
Note: See TracChangeset for help on using the changeset viewer.