Changeset 12873 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs
- Timestamp:
- 08/17/15 18:35:05 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs
r12868 r12873 45 45 private readonly uint seed; 46 46 [Storable] 47 private string lossFunctionName;47 private ILossFunction lossFunction; 48 48 [Storable] 49 49 private double r; … … 66 66 67 67 this.trainingProblemData = cloner.Clone(original.trainingProblemData); 68 this.lossFunction = cloner.Clone(original.lossFunction); 68 69 this.seed = original.seed; 69 this.lossFunctionName = original.lossFunctionName;70 70 this.iterations = original.iterations; 71 71 this.maxSize = original.maxSize; … … 76 76 77 77 // create only the surrogate model without an actual model 78 public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed, string lossFunctionName, int iterations, int maxSize, double r, double m, double nu)78 public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed, ILossFunction lossFunction, int iterations, int maxSize, double r, double m, double nu) 79 79 : base("Gradient boosted tree model", string.Empty) { 80 80 this.trainingProblemData = trainingProblemData; 81 81 this.seed = seed; 82 this.lossFunction Name = lossFunctionName;82 this.lossFunction = lossFunction; 83 83 this.iterations = iterations; 84 84 this.maxSize = maxSize; … … 89 89 90 90 // wrap an actual model in a surrograte 91 public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed, string lossFunctionName, int iterations, int maxSize, double r, double m, double nu, IRegressionModel model)92 : this(trainingProblemData, seed, lossFunction Name, iterations, maxSize, r, m, nu) {91 public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed, ILossFunction lossFunction, int iterations, int maxSize, double r, double m, double nu, IRegressionModel model) 92 : this(trainingProblemData, seed, lossFunction, iterations, maxSize, r, m, nu) { 93 93 this.actualModel = model; 94 94 } … … 110 110 111 111 private IRegressionModel RecalculateModel() { 112 var lossFunction = ApplicationManager.Manager.GetInstances<ILossFunction>().Single(l => l.ToString() == lossFunctionName);113 112 return GradientBoostedTreesAlgorithmStatic.TrainGbm(trainingProblemData, lossFunction, maxSize, nu, r, m, iterations, seed).Model; 114 113 }
Note: See TracChangeset
for help on using the changeset viewer.