Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/05/16 17:40:11 (8 years ago)
Author:
gkronber
Message:

#2650: merged r14234:14236 from trunk to branch

Location:
branches/symbreg-factors-2650
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/symbreg-factors-2650

  • branches/symbreg-factors-2650/HeuristicLab.Algorithms.DataAnalysis

  • branches/symbreg-factors-2650/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs

    r14185 r14239  
    5757
    5858    public override IEnumerable<string> VariablesUsedForPrediction {
    59       get { return actualModel.Models.SelectMany(x => x.VariablesUsedForPrediction).Distinct().OrderBy(x => x); }
     59      get
     60      {
     61        lock (actualModel) { if (actualModel == null) actualModel = RecalculateModel(); }
     62        return actualModel.Models.SelectMany(x => x.VariablesUsedForPrediction).Distinct().OrderBy(x => x);
     63      }
    6064    }
    6165
     
    105109    // forward message to actual model (recalculate model first if necessary)
    106110    public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
    107       if (actualModel == null) actualModel = RecalculateModel();
     111      lock (actualModel) { if (actualModel == null) actualModel = RecalculateModel(); }
    108112      return actualModel.GetEstimatedValues(dataset, rows);
    109113    }
     
    119123    public IEnumerable<IRegressionModel> Models {
    120124      get {
    121         if (actualModel == null) actualModel = RecalculateModel();
     125        lock(actualModel) { if (actualModel == null) actualModel = RecalculateModel();}
    122126        return actualModel.Models;
    123127      }
     
    126130    public IEnumerable<double> Weights {
    127131      get {
    128         if (actualModel == null) actualModel = RecalculateModel();
     132        lock(actualModel) { if (actualModel == null) actualModel = RecalculateModel();}
    129133        return actualModel.Weights;
    130134      }
Note: See TracChangeset for help on using the changeset viewer.