Introduction to explainable AI
1. Introduction to explainable AI
Welcome, everyone!2. About me
I’m Fouad, a machine learning engineer and PhD candidate specializing in AI for cybersecurity, where explaining model decisions is paramount. Together in this course, we will dive into the intricacies of Explainable AI. Let’s dive in!3. Artificial intelligence
Artificial intelligence, or AI, encompasses a range of technologies that enable machines to perform human-like tasks.4. The need for explainability
Complex AI systems, particularly those based on machine learning, often operate like black boxes: we see the inputs and outputs, but not the internal decision-making process. How can we then trust these outputs?5. The need for explainability
Explainable AI aims to open this black box, providing insights into the model’s inner workings.6. Explainability vs. accuracy
AI models exist on a spectrum where basic models are often more explainable but less precise, while complex models are highly precise but harder to interpret. This precision in complex models comes from their better ability to represent complicated patterns.7. Decision trees vs. neural networks
For instance, decision trees are straightforward models that clearly show the decision path based on learned conditions, making them inherently explainable.8. Decision trees vs. neural networks
A decision tree predicting a student's acceptance to graduate school would illustrate how conditions like undergraduate degree and grades influence the decision.9. Decision trees vs. neural networks
Conversely, neural networks are complex models with multiple layers, each having multiple neurons. While they can model complex phenomena, their decision-making process is not inherently transparent.10. Decision trees vs. neural networks
For the same task, neural networks can predict acceptance but do not explain their decision process.11. Student admission prediction
Imagine a dataset containing information for each student, including GRE and TOEFL test scores, university rating, statement of purpose grades, letters of recommendation grades, and the cumulative grade point average. This dataset is used to predict graduate school acceptance.12. Student admission prediction
We use two models from sklearn: DecisionTreeClassifier with a max_depth of 5 to control the maximum size of the tree, and MLPClassifier for the neural network, with two layers of 1000 neurons each. This is specified by the hidden_layer_sizes parameter, which takes a tuple of integers representing the number of neurons in each hidden layer. Then we fit both models generate predictions on the test set, and derive accuracies. The MLPClassifier shows better performance than the DecisionTreeClassifier.13. Decision tree rules
However, for the DecisionTreeClassifier, we can extract the learned rules using the export_text function from sklearn.tree, provided with the model and feature names from X_train.columns. The rules show that if CGPA is 8.34 or less and GRE score is 320.5 or less, the application is rejected. Conversely, if the GRE score is higher, it is accepted, and so on. Unfortunately, such explanations cannot be generated for neural networks, but we'll explore other methods.14. Model-specific vs. model-agnostic techniques
Explainable AI encompasses model-specific methods tailored to particular models, just like keys designed for specific locks. For instance, extracting decision rules is specific to decision trees, and can't be applied to neural networks.15. Model-specific vs. model-agnostic techniques
Conversely, model-agnostic methods can be applied to any model, just like a master key that opens any lock. Later, we'll explore how to apply these methods to explain neural networks.16. What's next?
This course covers various model-specific and model-agnostic explainability techniques, including local and global methods. We'll also explore advanced topics such as explainability metrics, unsupervised explainability. and generative AI explainability. We will use libraries like sklearn, SHAP, and LIME.17. Let's practice!
But before going further, let's practice what we've learned so far.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.