{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from demo_data import *\n", "\n", "from fixout import FixOutArtifact\n", "from fixout import FixOutRunner\n", "\n", "from demo_data import importGermanData" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "model, X_train, X_test, y_train, y_test, features_name, dic = importGermanData()\n", "\n", "fxo = FixOutRunner(\"Credit Risk Assessment (German bank)\") \n", "\n", "sensitive_features = [(19,0,\"foreignworker\"), \n", " (8,2,\"statussex\")] # (no), (yes), (male single) \n", "\n", "fxa = FixOutArtifact(model=model,\n", " training_data=(X_train,y_train), \n", " testing_data=[(X_test,y_test,\"Testing\")],\n", " features_name=features_name,\n", " sensitive_features=sensitive_features,\n", " dictionary=dic)\n", "\n", "fxo.runJ(fxa, show=False) " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fxo.data_distribution()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fxo.data_distribution(\"Testing\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fxo.fairness()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.9" } }, "nbformat": 4, "nbformat_minor": 2 }