Opened 5 years ago
Last modified 5 years ago
#3030 closed defect
RF/GBT SurrogateModel triggers unnecessary recalculation — at Initial Version
Reported by: | pfleck | Owned by: | |
---|---|---|---|
Priority: | medium | Milestone: | HeuristicLab 3.3.17 |
Component: | Algorithms.DataAnalysis | Version: | trunk |
Keywords: | Cc: |
Description
When the surrogate-storage mechanism is used for RFs and GBTs, the full model is still created after a run and passed to the surrogate model for immediate use. It currently is stored as a Lazy object: actualModel = new Lazy<IRandomForestModel>(() => model);
When a surrogate model is cloned, it checks whether the Lazy object is initialized and clones the full model if it is available:
IRandomForestModel clonedModel = null; if (original.actualModel.IsValueCreated) clonedModel = cloner.Clone(original.ActualModel); actualModel = new Lazy<IRandomForestModel>(CreateLazyInitFunc(clonedModel));
In case the cloning constructor is called immediately after creation of the surrogate Model, IsValueCreated is actually returning false since the Lazy object itself has not yet accessed its Value property. Thus the full model gets lost, and an unnecessary recalculation of the model is required later.