Changeset 13157 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 11/14/15 08:10:18 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithmStatic.cs
r13100 r13157 130 130 131 131 // simple interface 132 public static IRegressionSolution TrainGbm(IRegressionProblemData problemData, ILossFunction lossFunction, int maxSize, double nu, double r, double m, int maxIterations, uint randSeed = 31415) {132 public static GradientBoostedTreesSolution TrainGbm(IRegressionProblemData problemData, ILossFunction lossFunction, int maxSize, double nu, double r, double m, int maxIterations, uint randSeed = 31415) { 133 133 Contract.Assert(r > 0); 134 134 Contract.Assert(r <= 1.0); … … 143 143 144 144 var model = state.GetModel(); 145 return new RegressionSolution(model, (IRegressionProblemData)problemData.Clone());145 return new GradientBoostedTreesSolution(model, (IRegressionProblemData)problemData.Clone()); 146 146 } 147 147 -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs
r13065 r13157 33 33 [Item("Gradient boosted tree model", "")] 34 34 // this is essentially a collection of weighted regression models 35 public sealed class GradientBoostedTreesModel : NamedItem, I RegressionModel {35 public sealed class GradientBoostedTreesModel : NamedItem, IGradientBoostedTreesModel { 36 36 // BackwardsCompatibility3.4 for allowing deserialization & serialization of old models 37 37 #region Backwards compatible code, remove with 3.5 -
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 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
r13120 r13157 201 201 <Compile Include="GaussianProcess\GaussianProcessRegressionSolution.cs" /> 202 202 <Compile Include="GaussianProcess\ICovarianceFunction.cs" /> 203 <Compile Include="GradientBoostedTrees\IGradientBoostedTreesModel.cs" /> 203 204 <Compile Include="GradientBoostedTrees\GradientBoostedTreesModelSurrogate.cs" /> 204 205 <Compile Include="GradientBoostedTrees\GradientBoostedTreesAlgorithm.cs" /> … … 211 212 <Compile Include="GradientBoostedTrees\LossFunctions\RelativeErrorLoss.cs" /> 212 213 <Compile Include="GradientBoostedTrees\LossFunctions\SquaredErrorLoss.cs" /> 214 <Compile Include="GradientBoostedTrees\GradientBoostedTreesSolution.cs" /> 213 215 <Compile Include="GradientBoostedTrees\RegressionTreeBuilder.cs" /> 214 216 <Compile Include="GradientBoostedTrees\RegressionTreeModel.cs" />
Note: See TracChangeset
for help on using the changeset viewer.