Skip to main content

chola-coreloss

A smooth, tunable robust-regression loss function, founded by Gautam Ramesh. Built from two pieces chosen so both have gradients that saturate (bound) for large residuals -- the actual property that gives outlier robustness, not just "grows slower than x^2":

L(r) = ln(r^2 + 1) + huberized_power(r; p, delta)
  • ln(r^2 + 1) -- a Cauchy/Lorentzian-style term. Its gradient fades toward zero for large residuals.
  • huberized_power(r; p, delta) -- behaves like |r|^p near zero (curvature controlled by p) but continues as a straight line past delta, capping its gradient at a constant -- the same mechanism Huber loss uses, generalized to any p.

Install

pip install chola-coreloss

Usage

import numpy as np
from chola_coreloss import chola_coreloss_grad, chola_coreloss_adaptive_grad

r = pred - target  # residuals

# fixed delta (tune per-dataset via a validation set, like Huber's delta)
grad = chola_coreloss_grad(r, p=2.2, delta=0.7)

# recommended: adaptive delta, re-estimated from the residuals' own
# robust spread (MAD) -- no per-dataset retuning needed
grad = chola_coreloss_adaptive_grad(r, p=2.2, c=1.0)

Why adaptive delta

A fixed delta doesn't transfer between datasets -- it needs to track the scale of your model's actual residuals, which differs per problem. chola_coreloss_adaptive_grad re-estimates delta periodically from the residuals' own robust spread (Median Absolute Deviation), the same technique used in classical M-estimation / IRLS. Tested with c=1.0 on real data (sklearn's diabetes dataset) and synthetic nonlinear data (Friedman #1), clean and with injected label corruption, with no per-dataset retuning:

  • Matched or beat plain MSE on every clean-data run.
  • Beat fixed-delta Huber loss by 5-7x (RMSE) on corrupted-label data.

Related work

This loss is in the same family as Barron's "A General and Adaptive Robust Loss Function" (CVPR 2019), which also combines a tunable shape parameter with an adaptive scale. chola-coreloss differs in its specific algebraic form (a sum of a Cauchy-style term and a Huberized power term, rather than one continuous interpolating expression) and in how the scale adapts (classical MAD-based re-estimation rather than a learned parameter). If you're citing or building on this work, read Barron's paper too.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chola_coreloss-0.2.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chola_coreloss-0.2.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file chola_coreloss-0.2.0.tar.gz.

File metadata

  • Download URL: chola_coreloss-0.2.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for chola_coreloss-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fe4d4b16009de4ecce8e9d8c9a817c0b14caae89077d75a83793bb455ef2a8fb
MD5 71628026f4f175a910ca771545a4fb0a
BLAKE2b-256 f64dc870df066fca1a28dd426e648fb82c6787328f49a9d299821838142d8c0f

See more details on using hashes here.

File details

Details for the file chola_coreloss-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: chola_coreloss-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for chola_coreloss-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66fcb2eebbf8ba6fd603a276ab9e174747432aba8befe8f9e9517a15f356bd34
MD5 0ca519fba3938a534a3c55e4ecad4239
BLAKE2b-256 d4fd1d64bd8ee83e778aeb3bc04f1886cf55c294278bae3718943fee1c5ea266

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page