Skip to main content

Educational toolkit for interactive exploration, explanation, visualization, and reporting of machine learning methods.

Project description

ml-method-reports

ml-method-reports is an educational Python toolkit for interactive exploration, explanation, visualization, and reporting of machine learning methods.

Open In Colab

What Problem It Solves

Students often run machine learning scripts and see only final metrics. This toolkit exposes the intermediate artifacts that explain how a model behaves: etalons, distances, nearest neighbors, voting, tree rules, coefficients, feature importance, support vectors, cluster centers, errors, and metrics.

Features

  • Custom EtalonClassifier for method-of-etalons experiments.
  • sklearn-based educational explanations for common classifiers and clustering models.
  • HTML and PDF export for reports that can be shared outside Python.
  • Jupyter Notebook and Google Colab display with inline HTML rendering.
  • Progressive report detail depending on the data you provide.
  • Report builders for custom educational narratives.
  • Extensible adapter/builder structure for future model reports.

Installation and Import Options

There is more than one way to use ml-method-reports: install the package from PyPI, install it directly from GitHub, or run it from a local editable checkout during development.

Install the package:

pip install ml-method-reports

Install with notebook support:

pip install "ml-method-reports[notebook]"

Install directly from GitHub:

pip install "git+https://github.com/Just-dll/ml-method-reports.git"

For development:

git clone https://github.com/Just-dll/ml-method-reports.git
cd ml-method-reports
pip install -e ".[dev,notebook]"

All installation methods expose the same Python import package:

from ml_method_reports import EtalonClassifier, report_for
from ml_method_reports.reporting import ExperimentReport, ReportSection

Quick Start

from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier

from ml_method_reports import report_for

X, y = make_classification(n_samples=200, n_features=4, random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)

model = KNeighborsClassifier(n_neighbors=5)
model.fit(X_train, y_train)

feature_names = ["f1", "f2", "f3", "f4"]

report_for(model) 
    .with_training_data(
        X_train=X_train,
        y_train=y_train,
        feature_names=feature_names,
    ) 
    .with_test_data(
        X_test=X_test,
        y_test=y_test,
        feature_names=feature_names,
    ) 
    .save("runtime/reports/knn_example")

Notebook / Colab Usage

report_for(model) 
    .with_training_data(
        X_train=X_train,
        y_train=y_train,
        feature_names=feature_names,
    ) 
    .with_test_data(
        X_test=X_test,
        y_test=y_test,
        feature_names=feature_names,
    ) 
    .display()

.with_training_data(...) and .with_test_data(...) are the preferred way to make report context explicit. .with_data(...) is available as a compact shortcut when you already have all arrays together.

.display() renders inline in a notebook, .build() returns an ExperimentReport, .save(...) exports the HTML/PDF bundle, and single-format exports are available when you only need one file:

request = report_for(model) 
    .with_training_data(X_train=X_train, y_train=y_train, feature_names=feature_names) 
    .with_test_data(X_test=X_test, y_test=y_test, feature_names=feature_names)

request.save_html("runtime/reports/example.html")
request.save_pdf("runtime/reports/example.pdf")

Progressive Report Detail

Input provided What the toolkit can show
model only model type, parameters, available artifacts
model + training data training summary, class distribution, training artifacts
model + X_test predictions, scores/probabilities, selected sample explanation
model + X_test + y_test metrics, confusion matrix, error analysis
full train/test data full educational report with visualizations

Supported Reports

Report Backend What it explains
EtalonClassifier custom implementation class etalons, distances, selected prediction
KNN scikit-learn nearest neighbors, distances, voting
Logistic Regression scikit-learn coefficients, probabilities, feature influence
Decision Tree scikit-learn rules, decision path, feature importance
Random Forest scikit-learn ensemble summary, feature importance, errors
SVC scikit-learn support vectors, decision scores
KMeans scikit-learn cluster centers, distances, inertia
Agglomerative scikit-learn merge tree, cluster sizes, PCA projection

Only EtalonClassifier is custom implemented. sklearn models are used as computational backends; the project's value is artifact extraction, explanation, visualization, notebook display, and report generation.

Examples and Notebooks

examples/
notebooks/
docs/

Generate a local demo catalog:

python examples/generate_all_reports.py

Documentation

See docs/ for installation, quickstart, Colab, API, builder, supported model, and publishing notes. These Markdown pages are also suitable for GitHub Wiki pages.

License

MIT. See 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

ml_method_reports-0.1.1.tar.gz (48.4 kB view details)

Uploaded Source

Built Distribution

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

ml_method_reports-0.1.1-py3-none-any.whl (59.5 kB view details)

Uploaded Python 3

File details

Details for the file ml_method_reports-0.1.1.tar.gz.

File metadata

  • Download URL: ml_method_reports-0.1.1.tar.gz
  • Upload date:
  • Size: 48.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ml_method_reports-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3d8076d95b2bcef81ceac15ac7a2339cfa1fc9a2c17956a2a8fe42578f2a18c8
MD5 19baa48db1d77640af4fcd034f914b1b
BLAKE2b-256 799610f9dff616efb0463a58aeb3fb0a610896a9c232b7293df38dadbe5b159b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml_method_reports-0.1.1.tar.gz:

Publisher: publish.yml on Just-dll/ml-method-reports

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ml_method_reports-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ml_method_reports-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a80832b0574946bf62c81096939f19e627dadbfc1ee25d700ce326336f040ab
MD5 91b99278da681406450e59f1e0bc4e0c
BLAKE2b-256 bf12965a4663f3b73ff028177c65454f666de5a73b957e81cf6d708c13720756

See more details on using hashes here.

Provenance

The following attestation bundles were made for ml_method_reports-0.1.1-py3-none-any.whl:

Publisher: publish.yml on Just-dll/ml-method-reports

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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