Skip to main content

Coffee productivity analysis with statistical modeling

Project description

PKoffee - Coffee Productivity Analysis

A Conda package implemented in python for analyzing the relationship between coffee consumption and productivity through statistical modeling and visualization.

Project inspired by Le Café - Oldelaf for the S3 School 2026.

Le Café - Oldelaf - on YouTube

Features

  • Data Analysis: Load and analyze coffee consumption vs productivity datasets
  • Multiple Models: Fit various mathematical models (quadratic, Michaelis-Menten, logistic, peak functions)
  • Visualization: Beautiful violin plots with model overlays using Seaborn
  • Model Comparison: Automatic R² scoring and ranking of models
  • Type-Safe: Full type hints for better IDE support and code quality

Installation

pixi install

Quick Start

from pathlib import Path
from pkoffee.data import load_csv
from pkoffee.productivity_analysis import fit_all_models
from pkoffee.visualization import plot_models

# Load your data
data = load_csv(Path("coffee_productivity.csv"))

# Fit models
fitted_models = fit_all_models(data)

# Create visualization
plot_models(data, fitted_models, output_path=Path("results.png"))

Command Line Interface

# Analyze
cd analysis && pixi shell
# fit models and save to toml
pkoffee analyze --data-file coffee_productivity.csv --output fitted_models.toml --show-rankings
# plot models predictions
pkoffee plot --data-file coffee_productivity.csv --models fitted_models.toml --output analysis.png --y-max 7

Project Structure

pkoffee-sol/
├── src/pkoffee/
│   ├── __init__.py               # Python package
│   ├── cli.py                    # Command line interface
│   ├── data.py                   # Data loading utilities
│   ├── fit_model.py              # Model definition and fitting
│   ├── fit_model_io.py           # Model writing/reading to file
│   ├── log.py                    # Logging utilities
│   ├── metrics.py                # Model evaluation metrics
│   ├── parametric_function.py    # Mathematical models as parametric functions
│   ├── productivity_analysis.py  # Coffee analysis
│   └── visualization.py          # Plotting functions
├── tests/
│   ├── test_data.py
│   ├── test_fit_model.py
│   ├── test_fit_model_io.py
│   ├── test_metrics.py
│   └── test_parametric_function.py
├── README.md
├── pixi.toml
├── pixi.lock
└── pyproject.toml

Models Implemented

  1. Quadratic: f(x) = a₀ + a₁x + a₂x²
  2. Michaelis-Menten (Saturating): f(x) = y₀ + Vₘₐₓ·x/(K + x)
  3. Logistic: f(x) = y₀ + L/(1 + e^(-k(x - x₀)))
  4. Peak: f(x) = a·x·e^(-x/b)
  5. Peak2: f(x) = a·x²·e^(-x/b)

Development

# Activate the environment
pixi shell
# use development dependencies like jupyter notebooks/ipython
jupyterlab

Tests

# Run tests
pixi run test

Linting

# Linting
pixi run lint
pixi run format

License

MIT License

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

pkoffee-0.1.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

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

pkoffee-0.1.0-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file pkoffee-0.1.0.tar.gz.

File metadata

  • Download URL: pkoffee-0.1.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pkoffee-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe55754e651302b4c146625980d295a2520803bc3cb48e4f3f28148681a43d19
MD5 4cb8fbc03cf1a41a2598e60368ae8ce0
BLAKE2b-256 e002d800239f7515f84609be2b0e2d29dc6a87dfa1522cd91b2d7a71f5ba6f6f

See more details on using hashes here.

File details

Details for the file pkoffee-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pkoffee-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pkoffee-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 367f106e5870934eeb78653c21fe1ac2ae8f4fdfff2a437764bdc27cfcd518e7
MD5 60b1fb0d2a6132dd4bfcca4012cc14f0
BLAKE2b-256 640e8052e28bfbf743cec9988d7648cde8adf17162ebefbb895b74079d4efcb5

See more details on using hashes here.

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