Bias in AI: how to measure it and how to fix it