ml-vizkit

Reusable visualizations for inspecting, comparing, and explaining trained machine-learning models.


Keywords
data, science, explainable, AI, machine, learning, model, interpretability, visualization
License
MIT
Install
pip install ml-vizkit==0.1.0

Documentation

ML VizKit

PyPI Docs Site Python uv License: MIT

CI Docs Links Dependabot

profile logo

Reusable visualizations for inspecting, comparing, and explaining trained machine-learning models.

ML VizKit provides high-level Python functions for common machine-learning visualizations. It works with trained models, predictions, and experiment results produced by libraries such as scikit-learn.

The package does not train models, select features, choose algorithms, or make analytical decisions.

Design

  • Accept already-trained models, predictions, or completed experiment results.
  • Reuse established visualization primitives from scikit-learn when they exist.
  • Add small higher-level visualizations where the underlying libraries do not.
  • Return Matplotlib Axes objects.
  • Never call plt.show().
  • Keep analytical choices visible to the caller.
  • Keep the implementation readable and replaceable.

Install

uv add ml-vizkit

Example

from ml_vizkit import show_confusion_matrix

ax = show_confusion_matrix(y_test, y_pred)
ax.set_title("Penguin Species Classification")

The caller controls display and composition. In a script, for example:

import matplotlib.pyplot as plt

ax = show_confusion_matrix(y_test, y_pred)
plt.show()

Initial API

Classification:

  • show_decision_boundary()
  • show_confusion_matrix()
  • show_prediction_errors()
  • show_class_distribution()

Regression:

  • show_actual_vs_predicted()
  • show_residuals()

Model inspection:

  • show_feature_importance()

Experiment inspection:

  • show_train_test_split()
  • compare_splits()
  • compare_models()

Output:

  • save_chart()

Example: Classification

from ml_vizkit import show_confusion_matrix

ax = show_confusion_matrix(
    y_test,
    y_pred,
)

Example: Regression

from ml_vizkit import show_actual_vs_predicted

ax = show_actual_vs_predicted(
    y_test,
    y_pred,
)

Example: Model Inspection

from ml_vizkit import show_feature_importance

ax = show_feature_importance(
    model,
    feature_names,
)

Example: Save Chart

from ml_vizkit import save_chart, show_confusion_matrix

ax = show_confusion_matrix(
    y_test,
    y_pred,
)

save_chart(
    ax,
    "docs/images/confusion-matrix.png",
)

Example: Show Chart

import matplotlib.pyplot as plt

plt.show()

Developer Command Reference

Show command reference

In a machine terminal

Open a machine terminal where you want the project:

git clone https://github.com/analytics-toolworks/ml-vizkit

cd ml-vizkit
code .

In a VS Code terminal

uv self update
uv python pin 3.14
uv python install
uv lock --upgrade
uv sync

uv run pre-commit install
uv run pre-commit autoupdate

git add -A
uv run pre-commit run --all-files
# repeat if changes were made
uv run pre-commit run --all-files

# types, tests, docs
uv run ty check
uv run python -m pytest
uv run python -m zensical build

# save progress
git add -A
git commit -m "update"
git push -u origin main

Documentation

Annotations

.annotations/annotations.md

Citation

CITATION.cff

License

MIT