Skip to content

ENH: Add DoubleQuadratic datafit for asymmetric loss (#272) #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Aishwarya0811
Copy link

@Aishwarya0811 Aishwarya0811 commented Aug 12, 2025

Context of the PR

Summary

Implements DoubleQuadratic datafit for asymmetric quadratic loss as requested in issue #272.

Changes

  • New DoubleQuadratic class in skglm/datafits/_double_quadratic.py
  • Support for both dense and sparse matrices
  • Integration with existing penalties and solvers
  • Comprehensive test suite
  • Updated package imports

Mathematical Details

Implements asymmetric loss function:
L(ε,α) = (1/2n) * Σᵢ weights(εᵢ) * εᵢ²
where weights(εᵢ) = 2α + 2(1-2α) * 1[εᵢ>0]

  • α < 0.5: penalizes positive residuals (overestimation) more heavily
  • α = 0.5: equivalent to standard Quadratic loss
  • α > 0.5: penalizes negative residuals (underestimation) more heavily

Testing

  • Unit tests for all methods
  • Verification that α=0.5 matches Quadratic exactly
  • Integration tests with L1 penalty and AndersonCD solver
  • Asymmetric behavior validation

Contributions of the PR

  • Adds new asymmetric loss datafit requested by the community
  • Enables modeling scenarios where overestimation and underestimation have different costs
  • Maintains full compatibility with existing skglm infrastructure
  • Provides foundation for asymmetric regression applications

Checks before merging PR

  • added documentation for any new feature
  • added unit tests
  • edited the [what's new](- |Feature| Add :class:DoubleQuadratic datafit for asymmetric loss functions)

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.

1 participant