Algorithmic inspection for trustworthy ML models
Install the latest version of FixOut from PyPI using
pip install fixout
How to start analysing a simple model (let's say you have trained a binary classifier on the German Credit Data):
from fixout.artifact import FixOutArtifact
from fixout.runner import FixOutRunner
fxo = FixOutRunner("Credit Risk Assessment (German Credit)")
# Indicate the sensitive features
sensitive_features = ["foreignworker","statussex"]
# Create a FixOut Artifact with your model and data
fxa = FixOutArtifact(model=model,
training_data=(X_train,y_train),
testing_data=[(X_test,y_test,"Testing")],
features_name=features_name,
sensitive_features=sensitive_features,
dictionary=dic)
Then run the inspection with the method runJ
fxo.runJ(fxa, show=False)
You can now check the calculated fairness metrics by using the method fairness
.
fxo.fairness()
If you prefer to integrate FixOut into your code, then run the inspection by calling run
fxo.run(fxa, show=True)
In this case, you can access the generated dashboard at http://localhost:5000 ;)
You should be able to see an interface similar to the following