EMReport
A lightweight Python utility for generating clean, readable evaluation reports for Regression, Classification, and Clustering machine learning models. All in one place.
Features
- Regression Report: MAE, MSE, RMSE, and R²
- Classification Report: Accuracy, Precision, Recall, F1 Score, and Confusion Matrix
- Clustering Report: Silhouette Score, Davies-Bouldin Index, and Calinski-Harabasz Index
Install & Requirements
- Python 3.7+
numpyscikit-learn
Install repository:
git clone https://github.com/Alkiviadisss/EMReport
Install dependencies with:
pip install requirements.txt
Usage
Import the functions you need directly from EMReport.py:
from EMReport import EMReport_Regression, EMReport_Classification, EMReport_Clustering
Regression
from EMReport import EMReport_Regression
y_true = [3.0, 5.0, 2.5, 7.0]
y_pred = [2.8, 4.9, 2.7, 6.8]
EMReport_Regression(y_true, y_pred)
Output:
--------------------------------------------------
REGRESSION EVALUATION REPORT
--------------------------------------------------
Mean Absolute Error (MAE): 0.1500
Mean Squared Error (MSE): 0.0250
Root Mean Squared Error (RMSE): 0.1581
R-squared (R2): 0.9921
--------------------------------------------------
Classification
from EMReport import EMReport_Classification
y_true = [0, 1, 2, 1, 0]
y_pred = [0, 1, 1, 1, 0]
EMReport_Classification(y_true, y_pred)
Output:
--------------------------------------------------
CLASSIFICATION EVALUATION REPORT
--------------------------------------------------
Accuracy: 0.8000
Precision: 0.8000
Recall: 0.8000
F1 Score: 0.8000
--------------------------------------------------
Confusion Matrix:
[[2 0 0]
[0 2 0]
[0 1 0]]
--------------------------------------------------
Clustering
from EMReport import EMReport_Clustering
import numpy as np
X = np.array([[1, 2], [1, 4], [1, 0],
[10, 2], [10, 4], [10, 0]])
labels = [0, 0, 0, 1, 1, 1]
EMReport_Clustering(X, labels)
Output:
--------------------------------------------------
CLUSTERING EVALUATION REPORT
--------------------------------------------------
Number of Clusters: 2
Silhouette Score: 0.8571 (Closer to 1 is better)
Davies-Bouldin Index: 0.2041 (Lower is better)
Calinski-Harabasz Index: 90.0000 (Higher is better)
--------------------------------------------------
Note: The clustering report requires at least 2 distinct clusters and fewer clusters than total samples. An error message will be shown if this condition is not met.
API Reference
EMReport_Regression(y_true, y_pred)
| Parameter | Type | Description |
|---|---|---|
y_true |
array-like | Ground truth target values |
y_pred |
array-like | Estimated target values from the model |
EMReport_Classification(y_true, y_pred)
| Parameter | Type | Description |
|---|---|---|
y_true |
array-like | Ground truth class labels |
y_pred |
array-like | Predicted class labels from the model |
Uses
weightedaveraging for Precision, Recall, and F1 Score to handle class imbalance.
EMReport_Clustering(X, labels)
| Parameter | Type | Description |
|---|---|---|
X |
array-like of shape (n_samples, n_features) |
Input feature matrix used for clustering |
labels |
array-like | Cluster labels assigned to each sample |
Metrics Explained
| Metric | Task | Interpretation |
|---|---|---|
| MAE | Regression | Average absolute difference between predictions and actuals |
| MSE | Regression | Average squared difference, penalises large errors more |
| RMSE | Regression | Square root of MSE, same unit as target variable |
| R² | Regression | Proportion of variance explained (1.0 = perfect fit) |
| Accuracy | Classification | Fraction of correctly classified samples |
| Precision | Classification | Of all positive predictions, how many were correct |
| Recall | Classification | Of all actual positives, how many were found |
| F1 Score | Classification | Harmonic mean of Precision and Recall |
| Silhouette Score | Clustering | Measures how similar a point is to its own cluster vs. others (-1 to 1) |
| Davies-Bouldin Index | Clustering | Average similarity between clusters, lower = better separation |
| Calinski-Harabasz Index | Clustering | Ratio of between-cluster to within-cluster dispersion, higher = better |
License
This project is open-source and available under the MIT License.
Metadata
Release files for EMReport 0.1.3
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 |
|---|---|---|---|---|
| emreport-0.1.3.tar.gz | 3.5 kB | Without provenance | Details for emreport-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| emreport-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for emreport-0.1.3-py3-none-any.whl |
Total release size: 6.5 kB
Release files / emreport-0.1.3.tar.gz
| Download URL | emreport-0.1.3.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b91b894e4df16bb666695422de92ddde866cf8726f9aeb3bf9b855af44597df
|
|
BLAKE2b-256 checksum How to use checksums |
5f1290979c7ee207a07ef407c7fce6e490fc66f508a115285b55548fe928f3be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / emreport-0.1.3-py3-none-any.whl
| Download URL | emreport-0.1.3-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4f2c7792a2030fd3595adc423ba48ec10aa13759cdad7f1267ae8ede8359a4e
|
|
BLAKE2b-256 checksum How to use checksums |
743ffffc216c4e24d693286dde993e39e5a50dc972df8c7a2011a9e929f7753a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for EMReport 0.1.3
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.