Skip to main content

BeHappy

BeHappy is a small Python package that runs a collection of classic machine learning and statistics experiments with a single function call:

from BeHappy import code

code()

Calling code() runs eight experiments in order and prints (and plots) their results:

Exp What it covers
1 NumPy arrays, linear algebra, clip / select / where, SciPy statistics and optimisation, statsmodels OLS, K-Means clustering
2 Simple linear regression on Boston Housing (RM → price) with scikit-learn and statsmodels
3 Multiple linear regression on Boston Housing (OpenML) with scikit-learn and statsmodels
4 Polynomial regression (degrees 1-3) on LSTAT, with a plot
5 Binary and multinomial logistic regression on Iris (scikit-learn and statsmodels)
6 Dow Jones Index: predicting next week's close price with linear regression, with a plot
7 One-vs-rest classification with linear regression on Iris
8 One-vs-rest classification with linear regression on KDD Cup 99 (10% sample)

Nothing runs when you import the package. The experiments only run when you call code().

Note: code() needs an internet connection. Experiments 2, 3, 4, 6 and 8 download public datasets. Experiment 6 creates a dji/ folder and Experiment 8 creates kddcup.data_10_percent(.gz) (about 75 MB) in the current working directory. A full run takes a few minutes.

Installation

pip install behappy

The project is called behappy on PyPI, and you import it as BeHappy. pip treats the name case-insensitively, so pip install BeHappy works too.

To install from a local copy of the source:

pip install .

Usage

Python (script or terminal)

from BeHappy import code

code()

Save that as run.py and run python run.py. Each plot opens in a window, and the script continues after you close it.

Jupyter Notebook

In a cell:

%pip install behappy

Then, in a new cell:

from BeHappy import code

code()

Plots appear inline below the cell.

Google Colab

!pip install behappy
from BeHappy import code

code()

Colab may ask you to restart the runtime after installing (for example if numpy was upgraded). If it does, restart and run the second cell again.

Requirements

Python 3.9 or newer. These dependencies are installed automatically: numpy, pandas, scipy, scikit-learn, statsmodels, matplotlib and requests.

Development

pip install -e ".[dev]"
pytest

License

MIT. See LICENSE.

Metadata

Release files for behappy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for behappy 0.1.0
File Size Uploaded Provenance
behappy-0.1.0.tar.gz 12.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for behappy 0.1.0
File Interpreter ABI Platform
behappy-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / behappy-0.1.0.tar.gz

Download URL behappy-0.1.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
60b90e49614354d0c57c7b8a7946bd06ddeb10b78636bdd984bcdfc866aa40a3
BLAKE2b-256 checksum
How to use checksums
35b8159c8d3322bd3ec37a828473ad61c1a178ff29d853340537de2aefef8fb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.7

Release files / behappy-0.1.0-py3-none-any.whl

Download URL behappy-0.1.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a61c25c0da514893f99b1874440f19364bbaa89807ef0eee9c9576108a79f42f
BLAKE2b-256 checksum
How to use checksums
e8211e5e35dae566bbe68f4c271396a6bb19804d95c17ad8866fa5d4dc3a13d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.7

Security for behappy 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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