Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15678


Ignore:
Timestamp:
01/30/18 16:39:01 (7 years ago)
Author:
fholzing
Message:

#2883: Implemented third option for complete storage

Location:
branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4
Files:
4 edited

Legend:

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

    r15675 r15678  
    2121#endregion
    2222
     23using System;
    2324using System.Linq;
    2425using System.Threading;
     
    284285
    285286      // produce solution
    286       if (CreateSolution == ModelStorage.Parameter) {
    287         var model = state.GetModel();
     287      if (CreateSolution == ModelStorage.Parameter || CreateSolution == ModelStorage.Complete) {
     288        IRegressionModel model = null;
     289
     290        if (CreateSolution == ModelStorage.Parameter) {
     291          model = state.GetModel();
     292        } else if (CreateSolution == ModelStorage.Complete) {
     293          //If "Complete", a deep-copy is required, so no lazy lists
     294          model = state.GetModel(false);
     295          (model as GradientBoostedTreesModel).IsCompatibilityLoaded = true;
     296        }
    288297
    289298        // for logistic regression we produce a classification solution
     
    307316          Results.Add(new Result("Solution", new GradientBoostedTreesSolution(model, problemData)));
    308317        }
     318      } else if (CreateSolution == ModelStorage.Quality) {
     319        //Do nothing
     320      } else {
     321        throw new NotImplementedException("Selected parameter for CreateSolution isn't implemented yet");
    309322      }
    310323    }
  • branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithmStatic.cs

    r15583 r15678  
    3333
    3434    public interface IGbmState {
    35       IRegressionModel GetModel();
     35      IRegressionModel GetModel(bool shallow = true);
    3636      double GetTrainLoss();
    3737      double GetTestLoss();
     
    100100      }
    101101
    102       public IRegressionModel GetModel() {
     102      public IRegressionModel GetModel(bool shallow = true) {
    103103#pragma warning disable 618
    104104        var model = new GradientBoostedTreesModel(models, weights);
     
    107107        // to the number of iterations + 1 (for the constant model)
    108108        // wrap the actual model in a surrogate that enables persistence and lazy recalculation of the model if necessary
    109         return new GradientBoostedTreesModelSurrogate(problemData, randSeed, lossFunction, weights.Count - 1, maxSize, r, m, nu, model);
     109        if (shallow) {
     110          return new GradientBoostedTreesModelSurrogate(problemData, randSeed, lossFunction, weights.Count - 1, maxSize, r, m, nu, model);
     111        } else {
     112          return model;
     113        }
    110114      }
    111115      public IEnumerable<KeyValuePair<string, double>> GetVariableRelevance() {
  • branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs

    r15583 r15678  
    3737    #region Backwards compatible code, remove with 3.5
    3838    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; } }
    3940
    4041    [Storable(Name = "models")]
  • branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs

    r15675 r15678  
    2626  /// Plugin class for HeuristicLab.Algorithms.DataAnalysis plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Algorithms.DataAnalysis", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.11.15670")]
     28  [Plugin("HeuristicLab.Algorithms.DataAnalysis", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.11.15675")]
    2929  [PluginFile("HeuristicLab.Algorithms.DataAnalysis-3.4.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
Note: See TracChangeset for help on using the changeset viewer.