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.1.0.tar.gz (4.5 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.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chola_coreloss-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 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.1.0.tar.gz
Algorithm Hash digest
SHA256 1ab17f30c0b7dbc833243194aca24ac63e02366cb142888f89f5819bbaa24286
MD5 64b045d34c450acb2db942436d389a7b
BLAKE2b-256 aac1c3adad6424e490fe5d26bedfcd8c2bace25e2699e8b3dfa4cbc8634a1be3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chola_coreloss-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 525c813dd2c1673b3132ce4e3b243b67888b7501ef834926abe5968622ed1175
MD5 0173bd23f2d283b9e5be92b6ac81a94b
BLAKE2b-256 15cb6f87b489564133cbc3e603c4b90a7fc90aa3889a0a2b38807719ee5f2b7b

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

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