Changeset 14251 for branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Timestamp:
- 08/10/16 20:10:25 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r14249 r14251 194 194 terminalNodes = tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTerminalNode>().ToList(); 195 195 else 196 terminalNodes = new List<SymbolicExpressionTreeTerminalNode>(tree.Root.IterateNodesPrefix().OfType<ConstantTreeNode>()); 196 terminalNodes = new List<SymbolicExpressionTreeTerminalNode> 197 (tree.Root.IterateNodesPrefix() 198 .OfType<SymbolicExpressionTreeTerminalNode>() 199 .Where(node => node is ConstantTreeNode || node is FactorVariableTreeNode)); 197 200 198 201 //extract inital constants … … 214 217 c[i++] = binFactorVarTreeNode.Weight; 215 218 else if (factorVarTreeNode != null) { 219 // gkronber: a factorVariableTreeNode holds a category-specific constant therefore we can consider factors to be the same as constants 216 220 foreach (var w in factorVarTreeNode.Weights) c[i++] = w; 217 221 } … … 252 256 alglib.lsfitfit(state, function_cx_1_func, function_cx_1_grad, null, null); 253 257 alglib.lsfitresults(state, out info, out c, out rep); 254 } catch (ArithmeticException) { 258 } 259 catch (ArithmeticException) { 255 260 return originalQuality; 256 } catch (alglib.alglibexception) { 261 } 262 catch (alglib.alglibexception) { 257 263 return originalQuality; 258 264 } … … 284 290 binFactorVarTreeNode.Weight = constants[i++]; 285 291 else if (factorVarTreeNode != null) { 286 foreach (var w in factorVarTreeNode.Weights) constants[i++] = w; 292 for (int j = 0; j < factorVarTreeNode.Weights.Length; j++) 293 factorVarTreeNode.Weights[j] = constants[i++]; 287 294 } 288 295 }
Note: See TracChangeset
for help on using the changeset viewer.