Skip to content

feat: add regression fit functions (Spearman, RMSE, MI) - #59

Merged
eprifti merged 1 commit into
mainfrom
feat/regression
Mar 24, 2026
Merged

eprifti merged 1 commit into
mainfrom
feat/regression

Conversation

@eprifti

@eprifti eprifti commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Add three regression fitness functions: Spearman rank correlation, RMSE, and Mutual Information.

This validates the ClassificationMetrics refactor (#45) — regression models use fit but leave cls fields at their defaults.

New fit functions

Function Range Higher = Use case
spearman [-1, 1] Better correlation Rank-based regression
rmse (-∞, 0] Less error Continuous prediction
mutual_information [0, ∞) More information Non-linear relationships

Usage

general:
  fit: spearman  # or rmse, mutual_information

Test plan

  • 764 lib tests pass (8 new regression tests)
  • Spearman: perfect positive/negative, ties, no correlation
  • RMSE: zero error, nonzero
  • MI: identical vectors, non-negative

Closes #15

New FitFunction variants:
- spearman: Spearman rank correlation (regression mode)
- rmse: negated RMSE (higher = better, for consistency)
- mutual_information: histogram-based MI between predictions and targets

Implementation:
- Spearman with average-rank tie handling
- Neg-RMSE for optimization (higher = better)
- MI with 10-bin discretization
- Regression fitness path in population.rs skips classification metrics
- Bias penalty skipped for regression fit functions

Tests: 8 new tests (perfect correlation, negative, ties, RMSE zero/nonzero, MI)

Closes #15
@eprifti
eprifti merged commit 33b92ff into main Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add regressions

1 participant