{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Quickstart\n", "This notebook demonstrates the simplest workflow: load models, create an ExplainToolkit, compute an explanation, and plot it." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import skexplain" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "estimators = skexplain.load_models()\n", "X, y = skexplain.load_data()\n", "\n", "print(estimators)\n", "print(f'X Shape : {X.shape}')\n", "print(f'y Skew : {y.mean()*100:.1f}%')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "explainer = skexplain.ExplainToolkit(estimators=estimators, X=X, y=y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Compute Permutation Importance\n", "The simplest explanation method — how much does model performance drop when a feature is shuffled?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "perm_imp = explainer.permutation_importance(n_vars=10, evaluation_fn='norm_aupdc')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "explainer.plot_importance(data=perm_imp, panels=[('multipass', 'Random Forest')])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Compute ALE Curves\n", "Accumulated Local Effects show how each feature affects predictions." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ale = explainer.ale(features=['sfc_temp', 'temp2m', 'dwpt2m', 'sat_irbt'], n_bins=20)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "explainer.plot_ale(ale=ale)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Next Steps\n", "Explore the other notebooks for deeper dives into each method." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.8.0" } }, "nbformat": 4, "nbformat_minor": 4 }