Titanic EDA and models
The starting point: data cleaning, feature engineering and eight classifiers compared by accuracy.
Docs and guides
A ten-minute quickstart, five runnable notebooks that take one dataset all the way to production, and the reference for every call.
Quickstart
km_live_… and cannot create other keys.kaimei[models] to upload fitted estimators from your training stack.KAIMEI_API_KEY in your environment, or pass it to the client, then explain any input. The same call is POST /v1/explanations.# the client
pip install kaimei
# plus NumPy and your training stack, to upload fitted estimators
pip install "kaimei[models]"
# optional: charts in the dashboard's colours, image helpers
pip install matplotlib "kaimei[images]"
# your key, read automatically by the client
export KAIMEI_API_KEY=km_live_...from kaimei import Kaimei
from kaimei.tabular import explanation_summary, plot_explanation
client = Kaimei() # KAIMEI_API_KEY from the environment
model = client.models.retrieve("titanic-forest")
explanation = client.explanations.create(
model=model.slug, input=passenger, method="shap",
options={"counterfactual": True, "frozen_features": ["Sex", "Age"]},
)
print(explanation_summary(explanation, model=model))
# The model predicts died: P(survived) = 7.4%, against 41.1% on average.
# Pulling P(survived) down: Sex = male (−12.1 pts), Title = Mr (−11.0 pts) ...
plot_explanation(explanation, model=model)from kaimei import Kaimei
client = Kaimei()
model = client.models.upload(
clf, # a fitted estimator
name="Churn net",
feature_names=["tenure", "spend", "tickets"],
X=X_train, y=y_train, # reference rows, capped at 5,000
)
# a model Kaimei cannot run itself: point it at your endpoint
client.models.upload(
large_forest,
name="Churn forest",
inference={"type": "remote", "url": "https://scoring.example.com/predict"},
)Guides
Five notebooks take the Titanic passenger list from a Kaggle starting point to monitored, versioned models. Each runs in about a minute. Notebooks 01 to 04 need a free Kaimei account; 00 needs nothing.
The starting point: data cleaning, feature engineering and eight classifiers compared by accuracy.
Why one passenger died, which ticket would have saved him, two models that disagree, and what the forest learned overall.
Two weeks of traffic with a shadow model, then a feed that sends fares in pence, caught by drift detection and named by an explanation.
Error analysis with explanations, better features, then v2 shipped as a new version and compared with v1.
XGBoost, explained with its own TreeSHAP values and through a scoring endpoint that Kaimei calls.
A MobileNetV2 classifier uploaded with its photos attached, then asked why on new pictures. Each answer is drawn exactly as the dashboard draws it.
Reference
The Python client mirrors the REST API one for one. Errors raise typed KaimeiError subclasses with a code, a type and a status. 429 responses are retried with the server's Retry-After, and GET requests also retry on 502, 503 and 504.
| Client | Endpoint | Does |
|---|---|---|
client.models | /v1/models | Register, upload, version and list models |
client.predictions | /v1/predictions | Log predictions, or have Kaimei predict |
client.explanations | /v1/explanations | Explain one input by any method |
client.analyses | /v1/analyses | Study a whole model |
client.insights | /v1/insights | Read what an analysis found |
client.projects | /v1/projects | Group models, with summaries |
client.api_keys | /v1/api-keys | Manage keys |
client.organization | /v1/organization | Your organisation and its limits |
client.health() | /health | Is the API up |
Open an issue on GitHub and we will read it. The notebooks' README also has a troubleshooting section for the common cases.