Changeset 13157 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs
- Timestamp:
- 11/14/15 08:10:18 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs
r13066 r13157 33 33 // recalculate the actual GBT model on demand 34 34 [Item("Gradient boosted tree model", "")] 35 public sealed class GradientBoostedTreesModelSurrogate : NamedItem, I RegressionModel {35 public sealed class GradientBoostedTreesModelSurrogate : NamedItem, IGradientBoostedTreesModel { 36 36 // don't store the actual model! 37 private IRegressionModel actualModel; // the actual model is only recalculated when necessary 38 public IRegressionModel Model { get { return actualModel; } } 37 private IGradientBoostedTreesModel actualModel; // the actual model is only recalculated when necessary 39 38 40 39 [Storable] … … 87 86 88 87 // wrap an actual model in a surrograte 89 public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed, ILossFunction lossFunction, int iterations, int maxSize, double r, double m, double nu, I RegressionModel model)88 public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed, ILossFunction lossFunction, int iterations, int maxSize, double r, double m, double nu, IGradientBoostedTreesModel model) 90 89 : this(trainingProblemData, seed, lossFunction, iterations, maxSize, r, m, nu) { 91 90 this.actualModel = model; … … 107 106 108 107 109 private I RegressionModel RecalculateModel() {108 private IGradientBoostedTreesModel RecalculateModel() { 110 109 return GradientBoostedTreesAlgorithmStatic.TrainGbm(trainingProblemData, lossFunction, maxSize, nu, r, m, iterations, seed).Model; 110 } 111 112 public IEnumerable<IRegressionModel> Models { 113 get { 114 if (actualModel == null) actualModel = RecalculateModel(); 115 return actualModel.Models; 116 } 117 } 118 119 public IEnumerable<double> Weights { 120 get { 121 if (actualModel == null) actualModel = RecalculateModel(); 122 return actualModel.Weights; 123 } 111 124 } 112 125 }
Note: See TracChangeset
for help on using the changeset viewer.