Changeset 14237 for branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Timestamp:
- 08/05/16 14:25:28 (8 years ago)
- Location:
- branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r14232 r14237 205 205 ConstantTreeNode constantTreeNode = node as ConstantTreeNode; 206 206 VariableTreeNode variableTreeNode = node as VariableTreeNode; 207 FactorVariableTreeNode factorVariableTreeNode = node as FactorVariableTreeNode; 207 208 if (constantTreeNode != null) 208 209 c[i++] = constantTreeNode.Value; 209 210 else if (updateVariableWeights && variableTreeNode != null) 210 211 c[i++] = variableTreeNode.Weight; 212 else if (updateVariableWeights && factorVariableTreeNode != null) 213 c[i++] = factorVariableTreeNode.Weight; 211 214 } 212 215 } … … 270 273 ConstantTreeNode constantTreeNode = node as ConstantTreeNode; 271 274 VariableTreeNode variableTreeNode = node as VariableTreeNode; 275 FactorVariableTreeNode factorVarTreeNode = node as FactorVariableTreeNode; 272 276 if (constantTreeNode != null) 273 277 constantTreeNode.Value = constants[i++]; 274 278 else if (updateVariableWeights && variableTreeNode != null) 275 279 variableTreeNode.Weight = constants[i++]; 280 else if (updateVariableWeights && factorVarTreeNode != null) 281 factorVarTreeNode.Weight = constants[i++]; 276 282 } 277 283 } … … 299 305 return true; 300 306 } 301 if (node.Symbol is Variable) { 302 var varNode = node as VariableTreeNode; 307 if (node.Symbol is Variable || node.Symbol is FactorVariable) { 308 var varNode = node as VariableTreeNodeBase; 309 var factorVarNode = node as FactorVariableTreeNode; 310 // factor variable values are only 0 or 1 and set in x accordingly 303 311 var par = new AutoDiff.Variable(); 304 312 parameters.Add(par); 305 313 variableNames.Add(varNode.VariableName); 306 categoricalVariableValues.Add( string.Empty); // as a value as placeholder (variableNames.Length == catVariableValues.Length)314 categoricalVariableValues.Add(factorVarNode != null ? factorVarNode.VariableValue : string.Empty); 307 315 308 316 if (updateVariableWeights) { … … 313 321 term = par; 314 322 } 315 return true;316 }317 if (node.Symbol is FactorVariable) {318 // nothing to update in this case (like a variable without a weight)319 // values are only 0 or 1 and set in x accordingly320 var factorNode = node as FactorVariableTreeNode;321 var par = new AutoDiff.Variable();322 parameters.Add(par);323 variableNames.Add(factorNode.VariableName);324 categoricalVariableValues.Add(factorNode.VariableValue);325 term = par;326 323 return true; 327 324 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs
r14232 r14237 62 62 63 63 double bestReplacementValue = 0.0; 64 double bestImpactValue = double. NegativeInfinity;64 double bestImpactValue = double.PositiveInfinity; 65 65 newQualityForImpactsCalculation = qualityForImpactsCalculation; // initialize 66 66 // try the potentially reasonable replacement values and use the best one … … 80 80 81 81 impactValue = qualityForImpactsCalculation - newQualityForImpactsCalculation; 82 if (impactValue >bestImpactValue) {82 if (impactValue < bestImpactValue) { 83 83 bestImpactValue = impactValue; 84 84 bestReplacementValue = repValue;
Note: See TracChangeset
for help on using the changeset viewer.