Changeset 15678
- Timestamp:
- 01/30/18 16:39:01 (7 years ago)
- 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 21 21 #endregion 22 22 23 using System; 23 24 using System.Linq; 24 25 using System.Threading; … … 284 285 285 286 // 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 } 288 297 289 298 // for logistic regression we produce a classification solution … … 307 316 Results.Add(new Result("Solution", new GradientBoostedTreesSolution(model, problemData))); 308 317 } 318 } else if (CreateSolution == ModelStorage.Quality) { 319 //Do nothing 320 } else { 321 throw new NotImplementedException("Selected parameter for CreateSolution isn't implemented yet"); 309 322 } 310 323 } -
branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithmStatic.cs
r15583 r15678 33 33 34 34 public interface IGbmState { 35 IRegressionModel GetModel( );35 IRegressionModel GetModel(bool shallow = true); 36 36 double GetTrainLoss(); 37 37 double GetTestLoss(); … … 100 100 } 101 101 102 public IRegressionModel GetModel( ) {102 public IRegressionModel GetModel(bool shallow = true) { 103 103 #pragma warning disable 618 104 104 var model = new GradientBoostedTreesModel(models, weights); … … 107 107 // to the number of iterations + 1 (for the constant model) 108 108 // 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 } 110 114 } 111 115 public IEnumerable<KeyValuePair<string, double>> GetVariableRelevance() { -
branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs
r15583 r15678 37 37 #region Backwards compatible code, remove with 3.5 38 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; } } 39 40 40 41 [Storable(Name = "models")] -
branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs
r15675 r15678 26 26 /// Plugin class for HeuristicLab.Algorithms.DataAnalysis plugin. 27 27 /// </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.1567 0")]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")] 29 29 [PluginFile("HeuristicLab.Algorithms.DataAnalysis-3.4.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
Note: See TracChangeset
for help on using the changeset viewer.