Changeset 15679 for branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs
- Timestamp:
- 01/30/18 17:28:46 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs
r15678 r15679 36 36 // BackwardsCompatibility3.4 for allowing deserialization & serialization of old models 37 37 #region Backwards compatible code, remove with 3.5 38 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 internal bool IsCompatibilityLoaded { get { return this.isCompatibilityLoaded; } set { this.isCompatibilityLoaded = value; } }40 38 41 39 [Storable(Name = "models")] 42 private IList<IRegressionModel> __persistedModels { 43 set { 44 this.isCompatibilityLoaded = true; 40 private IList<IRegressionModel> __persistedModels 41 { 42 set 43 { 45 44 this.models.Clear(); 46 45 foreach (var m in value) this.models.Add(m); 47 46 } 48 get { if (this.isCompatibilityLoaded) return models; else return null; }47 get { return models; } 49 48 } 50 49 [Storable(Name = "weights")] 51 private IList<double> __persistedWeights { 52 set { 53 this.isCompatibilityLoaded = true; 50 private IList<double> __persistedWeights 51 { 52 set 53 { 54 54 this.weights.Clear(); 55 55 foreach (var w in value) this.weights.Add(w); 56 56 } 57 get { if (this.isCompatibilityLoaded) return weights; else return null; }57 get { return weights; } 58 58 } 59 59 #endregion 60 60 61 public override IEnumerable<string> VariablesUsedForPrediction { 61 public override IEnumerable<string> VariablesUsedForPrediction 62 { 62 63 get { return models.SelectMany(x => x.VariablesUsedForPrediction).Distinct().OrderBy(x => x); } 63 64 } … … 79 80 this.weights = new List<double>(original.weights); 80 81 this.models = new List<IRegressionModel>(original.models.Select(m => cloner.Clone(m))); 81 this.isCompatibilityLoaded = original.isCompatibilityLoaded;82 82 } 83 83 [Obsolete("The constructor of GBTModel should not be used directly anymore (use GBTModelSurrogate instead)")]
Note: See TracChangeset
for help on using the changeset viewer.