Skip to content

SyntaxWarning: Invalid escape sequences in calibration.py docstrings #1142

Description

@rbalachandar

Bug Report

Location: pyhealth/metrics/calibration.py

Issue:
When running tests, Python emits SyntaxWarnings about invalid escape sequences in the docstrings of:

  • ece_confidence_multiclass() (line 102)
  • ece_confidence_binary() (line 135)

Warning message:
SyntaxWarning: invalid escape sequence "\c"

Root cause:
The docstrings contain LaTeX math notation with backslashes (e.g., \frac, \cdot) but use regular strings instead of raw strings r"""", causing Python to interpret \c as an invalid escape sequence.

Suggested fix:
Change docstrings to raw strings by prefixing with r

Testing:
python -W error::SyntaxWarning -c "import pyhealth.metrics.calibration"

Labels: bug, documentation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions