Changeset 15481
- Timestamp:
- 11/21/17 15:40:19 (7 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r15480 r15481 213 213 if (applyLinearScaling) { 214 214 c = new double[initialConstants.Length + 2]; 215 { 216 Array.Copy(initialConstants, 0, c, 0, initialConstants.Length); 217 c[c.Length - 2] = 0.0; 218 c[c.Length - 1] = 1.0; 219 } 215 c[0] = 0.0; 216 c[1] = 1.0; 217 Array.Copy(initialConstants, 0, c, 2, initialConstants.Length); 220 218 } else { 221 219 c = (double[])initialConstants.Clone(); … … 273 271 //retVal == -7 => constant optimization failed due to wrong gradient 274 272 if (retVal != -7) { 275 if (applyLinearScaling) UpdateConstants(tree, c, updateVariableWeights); 276 else UpdateConstants(tree, c, updateVariableWeights); 273 if (applyLinearScaling) { 274 var tmp = new double[c.Length - 2]; 275 Array.Copy(c, 2, tmp, 0, tmp.Length); 276 UpdateConstants(tree, tmp, updateVariableWeights); 277 } else UpdateConstants(tree, c, updateVariableWeights); 277 278 } 278 279 var quality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, tree, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs
r15480 r15481 251 251 if (node.Symbol is StartSymbol) { 252 252 if (addLinearScalingTerms) { 253 var t = ConvertToAutoDiff(node.GetSubtree(0)); 254 // scaling variables α, β are given at the end of the parameter vector 253 // scaling variables α, β are given at the beginning of the parameter vector 255 254 var alpha = new AutoDiff.Variable(); 256 255 var beta = new AutoDiff.Variable(); 257 256 variables.Add(beta); 258 257 variables.Add(alpha); 258 var t = ConvertToAutoDiff(node.GetSubtree(0)); 259 259 return t * alpha + beta; 260 260 } else return ConvertToAutoDiff(node.GetSubtree(0));
Note: See TracChangeset
for help on using the changeset viewer.