Skip to main content

Linear Models with Python

Project description

hea: Linear Models with Python

hea v. (Cantonese)

  1. to kill time; to hang around
  2. to do something without putting much care or effort into it.
  3. to go through the motions; to give a carefree response; to beat around the bush; to treat someone lightly
  4. to place things casually; to disperse (with an outward motion) (from wikitionary)

This project started as a laid-back exercise of implementing R's lmin Python many years ago. It was called lmpy at the time. I wanted to add lme and gam too, but didn't manage to go very far, mostly because the Python ecosystem back then still lacked general supports for generating the needed design matrices to fit such models. I come back to it from time to time, check community progress, tinker with it a bit myself, and slowly, try to do it with many generations of LLMs as they came along. It's kind of becoming my private benchmark for LLMs, and see at which point they can crack code porting from R to Python without too much hand holding. Until recently, they still couldn't. But since Claude Code with Opus 4.6, things started to change.

BTW, the name lmpy is blocked on PyPI due to the name is "too similar to some existing projects", so I asked Claude to brainstorm some other names and one of them is "hea, v., to measure" in Hawaiian, which is likely a hallucination. But I like it a lot, as it means something completely different in Cantonese and fit the vibe of this project nicely. :)

Install

pip install hea

for sparse matrix speed-up in lme, you might want to use scikit-sparse, but you need to install some system deps first:

# mac
brew install suite-sparse

# debian
sudo apt-get install libsuitesparse-dev

then

pip install "hea[fast]"

Usage

from hea import data
from hea.models import lm

gala = data('gala', package='faraway')
m = lm('Species ~ Area + Adjacent + Elevation + Nearest + Scruz', gala)
m.summary()

See more examples.

Project details


Download files

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

Source Distribution

hea-0.1.3.tar.gz (53.3 MB view details)

Uploaded Source

Built Distribution

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

hea-0.1.3-py3-none-any.whl (907.5 kB view details)

Uploaded Python 3

File details

Details for the file hea-0.1.3.tar.gz.

File metadata

  • Download URL: hea-0.1.3.tar.gz
  • Upload date:
  • Size: 53.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hea-0.1.3.tar.gz
Algorithm Hash digest
SHA256 71b1f510d551286a0c6df1eea49423c040f7b7ea67958eec6cc0344ebf71c311
MD5 c15e3730c450618fe9538e3e60b579f5
BLAKE2b-256 0b115816951948471359480ba36fa9767a391515e2f9517ccc0a9432bd923c11

See more details on using hashes here.

Provenance

The following attestation bundles were made for hea-0.1.3.tar.gz:

Publisher: python-publish.yml on huangziwei/hea

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hea-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: hea-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 907.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hea-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1859c7e25896685aec0b41c2bdc57f1b1534f98c8d32dc80619fd312695f790a
MD5 9b4f03dc2933f53092b792d83e997ab2
BLAKE2b-256 737e57c2e6ccb220665f08c2ce5374416e868afd8bea061250f03bc4afb5e87c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hea-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on huangziwei/hea

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page