HIRE WRITER

Model Visualization

This is FREE sample
This text is free, available online and used for guidance and inspiration. Need a 100% unique paper? Order a custom essay.
  • Any subject
  • Within the deadline
  • Without paying in advance
Get custom essay

What is Model Visualization?

Model visualization means providing reason and logic behind in order to enable the accountability and transparency on model. Machine learning models are considered black box models due to complex inner workings.

It is easy for data scientists to deliver model with high accuracy .If somebody ask about reason, we can say that the model is black box or it is a statistical calculation few year ago but we cannot say that it is anymore nowadays. We also need to convince the client, product team and management to trust the model .As we cannot say that model learnt from data or it is a black box which cannot be explained .

Some scenarios where models cannot be explained .For example, we cannot explain the fraud detection model to public.If we explain the model public can find a way to hack the system.

Different types are:

  1. Data exploration: Data exploration can be done by usingExploratory data analysis (EDA).We can apply or t-distributed Stochastic Neighbour Embedding(t-SNE) or principal component analysis (PCA) techniques to understand about the feature.
  2. Built models: We will use various metric to measure classification and regression model.Accuracy, precision and recall, confusion metrics, log loss and F1 score used in classification while mean squared error(MSE), mean squared logarithmic error, root mean square error(RMSE) used in regression.All these metrics after built model are used to understand and measure the performance.
  3. Decision tree models : static feature summary such as feature importance can be retrieved from model.It is only exists in decision tree base algorithms such as Random forest and XGBoost.
  4. Evaluating Model : We want to know why we predict it wrongly.We can use the library to explain it so that we can fix it.

Visualization during Training

During training of models it is necessary to visualize the training process,it helps in easily understand, debug models and track errors and progress of the models. Visualize the test and train result values at each step.

  • Scalars( Loss and Accuracy): Scalar can be used to show the trends of error during training.Besides logging the loss and accuracy to the stdout regularly, we record and plot them to analyze its long-term trend.
  • Histograms: Visualize how the distribution of tensors in model graph has changed over time.Showing many histograms visualizations of tensor at different points in time.
  • Weight & bias: Monitor the weights and the biases during training time by visualizing them on histograms.
  • Activation: For gradient descent to perform the best, the node outputs before the activation functions should be normal distributed.
  • Gradients: Gradients can be visualized for each layer to identify deep learning problems like gradient diminishing or exploding problems.
  • Graphs: Graphs visualize the internal structure or architecture of the model.
  • Image: Images at each step of training means intermediate images generated can be visualized and visualize tensors .
  • Projector: Visualize the principal component analysis and t-sne algorithm model results. These technique mainly uses for dimensionality reduction.

Why it Matters?

Local Interpretable Model-agnostic Explanations, provide the ability to give visual explanations of the models.

We test model accuracy only and get confident that classifier or model is good.

Reasonable explanations what the model is actually doing?

Why the results are what they are?

Example

When we develop machine learning models for medical diagnostics, high accuracies on test samples might not be enough to sell them to clinicians.Doctors and patients alike will be less inclined to trust a decision made by a model they donot understand.

We need to explain in most of the scenario because :

  1. Trustability: If the client want to use the classification or prediction result. Most of the time, user needs some domain knowledge such as stock trader needs to understand why he/she provide the decision for buy or sell particular stock.
  2. Transparency: Machine learning is not a black box and we should provide the model transparency to client and management.So that they know why you are doing.Just like open source, people are willing to use open source much more as they know what you are doing.
  3. Accountability: Model should has accountability to provide a correct answer to the consumer.As a model owner, we should validate model features to guarantee it help on make a decisions .

How it Works and Adopt it?

Classification/Regression machine learning model results or decisions are difficult to understand by human brains.It also makes them difficult to explain to the non data-scientists.Therefore, all have the ability to explain the models, what is happening inside it.

The complex model functionality can be approximate by locally fit the linear models to some permutations of the training set.

LIME (Local Interpretable Model agnostic Explanations)

LIME is an algorithm explain predicitons of any classifier or regression model.It explains what actually your model is doing, provide visual explanations of the model.

Take some example a model predicts that a certain patient has the flu.The prediction is then explained by an explainer that highlights the symptoms that are most important to the model. With the help of this information about the rationale behind the model, the doctor is now empowered to trust the model or not.

In below figure, it is clear to see how case 195 and 416 behave alike, while third benign case(7) has an unusual large bare nuclei which are detracting from its status as benign without affecting the final prediction (indicating that the values of its other features are making up for this odd one).It is clear that high values in the measurements are indicative of a malignant tumor.

GradCAM (Gradient-weighted Class Activation Maps )

Gradient-weighted Class Activation Maps is advanced and specialized method. The constraints of this method is that we need to have access to the model internals, and it should work with images.For simple intuition of the method, given a sample of data(image), it will give the output a heat map of the regions of the image where the neural network had the most and greatest activations, therefore the features in the image that model correlates with class.

SHAP (Shapley Additive Explanations)

SHAP provides multiple explainers for different kinds of models.

Tree Explainer : Supports XGBoost, LightGBM, CatBoost and scikit learn models by Tree SHAP.

Deep Explainer(DEEP SHAP): Support tensorflow and Keras models by using Deeplift and Shapley values.

Gradient Explainer : Support tensorflow and Keras models.

Kernel Explainer (kernel SHAP): Applying to any models by using LIME and Shapley values.

Decision Trees Visualization

Decision tree Models can be visualized or interpret easily with the help of decision trees.It allows browse through each of the individual trees to see their relative importance to the overall model. Give the answer to the question as what can be the importance of each feature to a particular tree.

Below visualization unique characteristics :

  1. The decision nodes show how the feature space is split.
  2. The split positions for decision nodes are shown visually in the distribution.
  3. In the models, it visualized how the training data or samples gets distributed in leaf nodes and how the tree makes predictions for a specific observation.

Model Structure Visualization

Understanding neural networks through deep visualization.Displays each layer, activations, weights.

  • Visualization of behavior of neural networks
  • Visualization of neural networks take the form of static node link diagrams, which illustrate only the structure of a network, rather than behaviour.
  • Visualization of neural networks trained on handwritten digit recognition, with the intent of showing the actual behaviour of the network given user provided input. The user can interact with the network through a drawing pad, and watch the activation patterns of the network in real time.

Benefits

It is mandatory to understand how these algorithms are making decisions.Understanding the most important features of a model gives us insights into its inner workings and gives directions for improving its performance and removing bias.Besides that, sometimes it helps to debug models .Mostly the reason for providing explanations along with the predictions is that explainable ML models are necessary to gain end-user trust.

Tools

Neural networks Visualization

  • CNNV is: Provides better analysis of Deep Convolutional Neural Networks.
  • Neural Networks Playground: An interactive in-browser visualization of neural networks.TensorFlow Playground is an interactive visualization of neural networks.
  • Netron: Netron gives the visualization for deep learning and ml models.
  • ANN visualizer

Tools for data exploration

  • Tableau
  • Power BI

Tools for explaining predictions

  1. SHAP (Shapley Additive Explanations)
  2. LIME (Local Interpretable Model agnostic Explanations)

Tools for visualizing during training

  • Visual DL is a deep learning visualization tool that can help in visualize deep learning jobs.It includes features such as scalar, parameter distribtuion, model structure and image visualization.
  • TensorBoard It allows to visualize model structure, plot quantitive metrics about the execution of the model, and show additional information data like images, audio, text that pass through it.

Tools for evaluation visualization

  • Yellowbrick is a suite of visual diagnostic tools called visualizers that extend the scikit-learn API to allow human steering of the model selection process.Some visualizers are:
  • Feature Visualization, Classification Visualization, Clustering Visualization, Regression Visualization and Model Selection Visualizaions.

References

Cite this paper

Model Visualization. (2022, Mar 11). Retrieved from https://samploon.com/model-visualization/

We use cookies to give you the best experience possible. By continuing we’ll assume you’re on board with our cookie policy

Hi!
Peter is on the line!

Don't settle for a cookie-cutter essay. Receive a tailored piece that meets your specific needs and requirements.

Check it out