Metadata-Version: 2.4
Name: behappy
Version: 0.1.0
Summary: Run a collection of classic ML and statistics experiments with a single call: from BeHappy import code; code()
Author: BeHappy Authors
License-Expression: MIT
Keywords: machine-learning,statistics,scikit-learn,statsmodels,education,jupyter,colab
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Framework :: Jupyter
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: pandas>=1.5
Requires-Dist: scipy>=1.9
Requires-Dist: scikit-learn>=1.2
Requires-Dist: statsmodels>=0.14
Requires-Dist: matplotlib>=3.5
Requires-Dist: requests>=2.25
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Dynamic: license-file

# BeHappy

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

```python
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

```bash
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:

```bash
pip install .
```

## Usage

### Python (script or terminal)

```python
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:

```python
%pip install behappy
```

Then, in a new cell:

```python
from BeHappy import code

code()
```

Plots appear inline below the cell.

### Google Colab

```python
!pip install behappy
```

```python
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

```bash
pip install -e ".[dev]"
pytest
```

## License

MIT. See [LICENSE](LICENSE).
