Opened 3 months ago

Last modified 3 days ago

## #2974 new enhancement

# Refactor Constants Optimization

Reported by: | mkommend | Owned by: | mkommend |
---|---|---|---|

Priority: | medium | Milestone: | HeuristicLab 3.3.16 |

Component: | Problems.DataAnalysis.Symbolic.Regression | Version: | branch |

Keywords: | Cc: |

### Description

The code for constants optimization has grown over the years and all new functionality has been directly added in the evaluator. This should be refactored into separate classes and improvements to its functionality should be implemented. In detail the following changes should be realized:

- Optimizing constants should be separated from evaluation
- Constant optimization should use the MSE instead of the R²
- Add interfaces and static utility methods
- ...

### Attachments (1)

### Change History (23)

### comment:1 Changed 3 months ago by mkommend

### comment:2 Changed 3 months ago by mkommend

r16456: Added HL.Problems.DataAnalysis.Symbolic to the branch.

### comment:3 Changed 3 months ago by mkommend

### comment:4 Changed 3 months ago by mkommend

### comment:5 Changed 3 months ago by mkommend

r16461: Added unit tests and refactoring.

### comment:6 Changed 3 months ago by mkommend

### comment:7 Changed 2 months ago by mkommend

r16500: Added intermediate version of new constants optimization for profiling.

### comment:8 Changed 2 months ago by mkommend

### comment:9 Changed 2 months ago by mkommend

r16509: Added new evaluator with constants optimization.

### comment:10 Changed 2 months ago by mkommend

r16514: Updated CoOp to handle negative R² values approprietly.

### comment:11 Changed 2 months ago by mkommend

r16522: Fixed bug in constants extraction when adding linear scaling coefficients.

### comment:12 Changed 2 months ago by bburlacu

r16525: Add benchmarks solution for testing constant optimization performance.

### comment:13 Changed 7 days ago by gkronber

r16676: merged r16478:16672 from trunk:HeuristicLab.Problems.DataAnalysis.Symbolic to branch:HeuristicLab.Problems.DataAnalysis.Symbolic

### comment:14 Changed 7 days ago by gkronber

r16677: merged r16499:16658 from trunk:HeuristicLab.Problems.DataAnalysis.Symbolic.Regression to branch:HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

### comment:15 Changed 7 days ago by gkronber

r16678: removed project references again after merging changes from trunk

### comment:16 Changed 7 days ago by gkronber

r16679: changed .NET framework version of UnitTests project for compatibility with HL trunk (4.6.1)

### comment:17 Changed 7 days ago by gkronber

r16680: necessary changes for compatibility with new persistence

### comment:18 Changed 3 days ago by gkronber

r16689: changed LMConstantsOptimizer to use minlm interface of alglib instead of lsfit interface.

### comment:19 Changed 3 days ago by gkronber

r16690: added code in the unit tests to make behaviour of new and old ConstOpt consistent to allow direct comparison of results (+fixed a small bug in the unit tests)

### comment:20 Changed 3 days ago by gkronber

Currently, one unit test fails because of code in OnlinePearsonRCalculator.

It would work if we would replace it with

public double R { get { double xVar = sxCalculator.PopulationVariance; double yVar = syCalculator.PopulationVariance; var r = covCalculator.Covariance / (Math.Sqrt(xVar) * Math.Sqrt(yVar)); if (double.IsNaN(r)) return 0.0; if (r < -1.0) r = -1.0; else if (r > 1.0) r = 1.0; return r; } }

### comment:21 Changed 3 days ago by gkronber

r16691: improved code for benchmarking (previous code failed to account for update of trees after call of Optimize as well as early stopping in Optimize for trees with invalid outputs)

### comment:22 Changed 3 days ago by gkronber

### Changed 3 days ago by gkronber

**Note:**See TracTickets for help on using tickets.

r16455: Created branch and added adapted project HL.Problems.DataAnalysis.Symbolic.Regression.