Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/30/18 17:28:46 (7 years ago)
Author:
fholzing
Message:

#2883: Removed backwardscompatibility and changed the level of the decision if surrogate or not into the algorithm (so one level up)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs

    r15678 r15679  
    3636    // BackwardsCompatibility3.4 for allowing deserialization & serialization of old models
    3737    #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 format
    39     internal bool IsCompatibilityLoaded { get { return this.isCompatibilityLoaded; } set { this.isCompatibilityLoaded = value; } }
    4038
    4139    [Storable(Name = "models")]
    42     private IList<IRegressionModel> __persistedModels {
    43       set {
    44         this.isCompatibilityLoaded = true;
     40    private IList<IRegressionModel> __persistedModels
     41    {
     42      set
     43      {
    4544        this.models.Clear();
    4645        foreach (var m in value) this.models.Add(m);
    4746      }
    48       get { if (this.isCompatibilityLoaded) return models; else return null; }
     47      get { return models; }
    4948    }
    5049    [Storable(Name = "weights")]
    51     private IList<double> __persistedWeights {
    52       set {
    53         this.isCompatibilityLoaded = true;
     50    private IList<double> __persistedWeights
     51    {
     52      set
     53      {
    5454        this.weights.Clear();
    5555        foreach (var w in value) this.weights.Add(w);
    5656      }
    57       get { if (this.isCompatibilityLoaded) return weights; else return null; }
     57      get { return weights; }
    5858    }
    5959    #endregion
    6060
    61     public override IEnumerable<string> VariablesUsedForPrediction {
     61    public override IEnumerable<string> VariablesUsedForPrediction
     62    {
    6263      get { return models.SelectMany(x => x.VariablesUsedForPrediction).Distinct().OrderBy(x => x); }
    6364    }
     
    7980      this.weights = new List<double>(original.weights);
    8081      this.models = new List<IRegressionModel>(original.models.Select(m => cloner.Clone(m)));
    81       this.isCompatibilityLoaded = original.isCompatibilityLoaded;
    8282    }
    8383    [Obsolete("The constructor of GBTModel should not be used directly anymore (use GBTModelSurrogate instead)")]
Note: See TracChangeset for help on using the changeset viewer.