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.4.tar.gz (53.5 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.4-py3-none-any.whl (991.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hea-0.1.4.tar.gz
  • Upload date:
  • Size: 53.5 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.4.tar.gz
Algorithm Hash digest
SHA256 a73ed7b7e942ecaead2c3469c643c1f1b017bba42a5d7c313bafa18275ce54f4
MD5 9f198bac0a7e9c462df5f79768ef0707
BLAKE2b-256 086ca7da8c8318954535baf4bdba1d80d8173fed3dc3bb7bb1fda6509b186fbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for hea-0.1.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: hea-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 991.3 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 74804bd87dc74e44b384b383aa3c7a4e60dd498b474878aad965068a91560aa6
MD5 63fbf58e28ea1d7e026a90311e7c6a9f
BLAKE2b-256 5eb2c0512334df4ed48942c45ca00959e500ea06b9f9c423249533fd156cd509

See more details on using hashes here.

Provenance

The following attestation bundles were made for hea-0.1.4-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