Changeset 15975 for branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/GrammarEnumerationAlgorithm.cs
- Timestamp:
- 06/28/18 16:56:41 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/GrammarEnumerationAlgorithm.cs
r15974 r15975 52 52 } 53 53 54 p rotecteddouble VariableImportanceWeight {54 public double VariableImportanceWeight { 55 55 get { return VariableImportanceWeightParameter.Value.Value; } 56 set { VariableImportanceWeightParameter.Value.Value = value; } 56 57 } 57 58 … … 133 134 } 134 135 136 [Storable] 135 137 public SymbolString BestTrainingSentence { get; set; } // Currently set in RSquaredEvaluator: quite hacky, but makes testing much easier for now... 136 138 #endregion … … 144 146 [Storable] 145 147 internal SearchDataStore OpenPhrases { get; private set; } // Stack/Queue/etc. for fetching the next node in the search tree. 146 147 [StorableHook(HookType.AfterDeserialization)]148 private void AfterDeserialization() {149 variableImportance = CalculateVariableImportances();150 }151 148 152 149 #region execution stats … … 162 159 #endregion 163 160 161 [Storable] 164 162 public Grammar Grammar { get; private set; } 165 163 … … 168 166 return new GrammarEnumerationAlgorithm(this, cloner); 169 167 } 168 169 [StorableConstructor] 170 protected GrammarEnumerationAlgorithm(bool deserializing) : base(deserializing) { } 170 171 171 172 public GrammarEnumerationAlgorithm() { … … 237 238 #endregion 238 239 240 [Storable] 239 241 private Dictionary<VariableTerminalSymbol, double> variableImportance; 240 242 … … 250 252 OpenPhrases = new SearchDataStore(SearchDataStructure, SearchDataStructureSize, SearchCacheSize); // Select search strategy 251 253 254 CalculateVariableImportances(); 255 252 256 base.Prepare(); // this actually clears the results which will get reinitialized on Run() 253 257 } 254 258 255 private Dictionary<VariableTerminalSymbol, double>CalculateVariableImportances() {259 private void CalculateVariableImportances() { 256 260 variableImportance = new Dictionary<VariableTerminalSymbol, double>(); 257 261 … … 271 275 variableImportance[varSym] = rfImpact.Item2 / sum; 272 276 } 273 return variableImportance;274 277 } 275 278 … … 277 280 // do not reinitialize the algorithm if we're resuming from pause 278 281 if (previousExecutionState != ExecutionState.Paused) { 279 CalculateVariableImportances();280 282 InitResults(); 281 283 var phrase0 = new SymbolString(new[] { Grammar.StartSymbol });
Note: See TracChangeset
for help on using the changeset viewer.