MELBA
MELBA (Mathematical Economics Learning-Based Algorithm) is an independent Python library for regression on business data. Version 0.1.0 gives users a small NumPy-based model with an estimator API for fitting, prediction, and evaluation.
Purpose
MELBA provides an inspectable starting point for studying relationships among business variables such as price, promotion spend, operating cost, and sales. Its first implementation uses familiar regression methods. It does not claim a new machine-learning method or established scientific novelty.
Version 0.1.0
MELBA.fit(X, y)validates data and trains the model.MELBA.predict(X)predicts numeric targets after training.MELBA.evaluate(X, y)returns MAE, MSE, RMSE, and R-squared.- Training uses quadratic feature terms by default, Huber loss, L2 regularization, and full-batch gradient descent.
- Inputs may be NumPy arrays or Pandas objects. Features must be finite numeric values.
- A reproducible synthetic sales example and a Colab-ready demonstration notebook are included.
Install
From a checkout of this project:
python -m pip install -e .
For optional plotting and tests:
python -m pip install -e ".[plot,test]"
Quick start
import numpy as np
from melba import MELBA
X_train = np.array([[20, 100], [25, 140], [30, 180], [35, 210]], dtype=float)
y_train = np.array([120, 155, 190, 215], dtype=float)
X_test = np.array([[28, 165]], dtype=float)
model = MELBA(learning_rate=0.5, epochs=1000, random_state=42)
model.fit(X_train, y_train)
predictions = model.predict(X_test)
results = model.evaluate(X_test, [175])
print(predictions)
print(results)
The example's values are illustrative. They are not company data.
Examples and tests
Run an end-to-end NumPy example:
python examples/basic_usage.py
Run the synthetic sales example:
python examples/business_sales.py
Run the test suite:
python -m pytest
Open notebooks/MELBA_demo.ipynb in Google Colab or Jupyter for a synthetic dataset walkthrough. The notebook contains a source snapshot so it can bootstrap its own MELBA import when opened without a project checkout. The notebook code was exercised locally, but this project has not been run in a live Colab session.
Project layout
melba/ public estimator, validation, optimization, metrics, preprocessing
examples/ basic NumPy and synthetic business-sales examples
tests/ model, prediction, validation, and metric tests
notebooks/ self-contained demonstration notebook
docs/ architecture and algorithm notes
Algorithm and limitations
MELBA standardizes input columns, adds each standardized feature's square and pairwise products by default, then standardizes the expanded columns. It standardizes the target for optimization, minimizes Huber loss plus an L2 penalty on non-intercept coefficients, and converts predictions back to the target's original scale.
This is a quadratic feature regression model trained with a standard robust loss and gradient descent. The expanded design can grow quadratically with the number of input columns. The model assumes numeric tabular inputs and does not provide categorical encoding, missing-value imputation, feature selection, time-series handling, uncertainty intervals, or causal estimates. R-squared on a constant target is defined as 1 for exact predictions and 0 otherwise.
See the algorithm documentation for the objective and training details. See the framework documentation for package boundaries and API behavior.
Development status
Version 0.1.0 is an initial regression foundation for experimentation. It is not a validated domain model and should be assessed on held-out data before use in business decisions. No claim of algorithmic novelty is made.
Metadata
Release files for melba 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| melba-0.1.0.tar.gz | 11.9 kB | Without provenance | Details for melba-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| melba-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for melba-0.1.0-py3-none-any.whl |
Total release size: 24.2 kB
Release files / melba-0.1.0.tar.gz
| Download URL | melba-0.1.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42650ce89dd8bb6f8aa17f88c9a75803db5abad4e78c7484b52d45fe14cd281f
|
|
BLAKE2b-256 checksum How to use checksums |
9e5d31205b15f43018af578c6ca3ee1f7ff0de4f315d65c0021698cb15339845
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / melba-0.1.0-py3-none-any.whl
| Download URL | melba-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec9328945f02dec93f99fb591733e7fb472ebd23c17e857a06d2978aa7c57660
|
|
BLAKE2b-256 checksum How to use checksums |
7f1bb6eafc4430db181c5d09ecff86bd3d0bd0fcb37d68f5c20b3164b4cc528c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for melba 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.