Changeset 17226 for branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs
- Timestamp:
- 08/29/19 15:57:35 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs
r16723 r17226 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2019Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * and the BEACON Center for the Study of Evolution in Action. 5 5 * … … 34 34 // this is essentially a collection of weighted regression models 35 35 public sealed class GradientBoostedTreesModel : RegressionModel, IGradientBoostedTreesModel { 36 // BackwardsCompatibility3.4 for allowing deserialization & serialization of old models37 #region Backwards compatible code, remove with 3.538 private bool isCompatibilityLoaded = false; // only set to true if the model is deserialized from the old format, needed to make sure that information is serialized again if it was loaded from the old format39 40 36 [Storable(Name = "models")] 41 37 private IList<IRegressionModel> __persistedModels { 42 38 set { 43 this.isCompatibilityLoaded = true;44 39 this.models.Clear(); 45 40 foreach (var m in value) this.models.Add(m); 46 41 } 47 get { if (this.isCompatibilityLoaded) return models; else return null; }42 get { return models; } 48 43 } 49 44 [Storable(Name = "weights")] 50 45 private IList<double> __persistedWeights { 51 46 set { 52 this.isCompatibilityLoaded = true;53 47 this.weights.Clear(); 54 48 foreach (var w in value) this.weights.Add(w); 55 49 } 56 get { if (this.isCompatibilityLoaded) return weights; else return null; }50 get { return weights; } 57 51 } 58 #endregion59 52 60 53 public override IEnumerable<string> VariablesUsedForPrediction { … … 77 70 this.weights = new List<double>(original.weights); 78 71 this.models = new List<IRegressionModel>(original.models.Select(m => cloner.Clone(m))); 79 this.isCompatibilityLoaded = original.isCompatibilityLoaded;80 72 } 81 [Obsolete("The constructor of GBTModel should not be used directly anymore (use GBTModelSurrogate instead)")] 73 82 74 internal GradientBoostedTreesModel(IEnumerable<IRegressionModel> models, IEnumerable<double> weights) 83 75 : base(string.Empty, "Gradient boosted tree model", string.Empty) {
Note: See TracChangeset
for help on using the changeset viewer.