- Timestamp:
- 08/05/16 11:58:52 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs
r14185 r14236 57 57 58 58 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 } 60 64 } 61 65 … … 105 109 // forward message to actual model (recalculate model first if necessary) 106 110 public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) { 107 if (actualModel == null) actualModel = RecalculateModel();111 lock (actualModel) { if (actualModel == null) actualModel = RecalculateModel(); } 108 112 return actualModel.GetEstimatedValues(dataset, rows); 109 113 } … … 119 123 public IEnumerable<IRegressionModel> Models { 120 124 get { 121 if (actualModel == null) actualModel = RecalculateModel();125 lock(actualModel) { if (actualModel == null) actualModel = RecalculateModel();} 122 126 return actualModel.Models; 123 127 } … … 126 130 public IEnumerable<double> Weights { 127 131 get { 128 if (actualModel == null) actualModel = RecalculateModel();132 lock(actualModel) { if (actualModel == null) actualModel = RecalculateModel();} 129 133 return actualModel.Weights; 130 134 }
Note: See TracChangeset
for help on using the changeset viewer.