Histograms are one of the most basic statistical tools that we have. They are also one of the most powerful and most frequently used. However, they are not without pitfalls… So this StatQuests covers the essential information that you need to have to make the most of histograms.
As artificial intelligence (AI) models, especially those using deep learning, have gained prominence over the last eight or so years , they are now significantly impacting society, ranging from loan decisions to self-driving cars. Inherently though, a majority of these models are opaque, and hence following their recommendations blindly in human critical applications can raise issues such as fairness, safety, reliability, along with many others. This has led to the emergence of a subfield in AI called explainable AI (XAI) . XAI is primarily concerned with understanding or interpreting the decisions made by these opaque or black-box models so that one can appropriate trust, and in some cases, have even better performance through human-machine collaboration .
While there are multiple views on what XAI is  and how explainability can be formalized [4, 6], it is still unclear as to what XAI truly is and why it is hard to formalize mathematically. The reason for this lack of clarity is that not only must the model and/or data be considered but also the final consumer of the explanation. Most XAI methods [11, 9, 3], given this intermingled view, try to meet all these requirements at the same time. For example, many methods try to identify a sparse set of features that replicate the decision of the model. The sparsity is a proxy for the consumer’s mental model. An important question asks whether we can disentangle the steps that XAI methods are trying to accomplish? This may help us better understand the truly challenging parts as well as the simpler parts of XAI, not to mention it may motivate different types of methods.
We conjecture that the XAI process can be broadly disentangled into two parts, as depicted in Figure 1. The first part is uncovering what is truly happening in the model that we want to understand, while the second part is about conveying that information to the user in a consumable way. The first part is relatively easy to formalize as it mainly deals with analyzing how well a simple proxy model might generalize either locally or globally with respect to (w.r.t.) data that is generated using the black-box model. Rather than having generalization guarantees w.r.t. the underlying distribution, we now want them w.r.t. the (conditional) output distribution of the model. Once we have some way of figuring out what is truly important, a second step is to communicate this information. This second part is much less clear as we do not have an objective way of characterizing an individual’s mind. This part, we believe, is what makes explainability as a whole so challenging to formalize. A mainstay for a lot of XAI research over the last year or so has been to conduct user studies to evaluate new XAI methods.
#overviews #ai #explainability #explainable ai #xai
The code is available here on Github.
Before start defining the histogram, for simplicity, we use grayscales images. Then later I explain the process for the color images as well.
The image histogram indicates the intensity distribution of an image. In other words, the image histogram shows the number of pixels in an image having a specific intensity value. As an example, assume a normal image with pixel intensities varies from 0 to 255. In order to generate its histogram we only need to count the number of pixels having intensity value 0, then 1 and continue to the 255. In Fig.1, we have a sample 5*5 image with pixel diversities from 0 to 4. In the first step for generating the histogram, we create the Histogram Table, by counting the number of each pixel intensities. Then we can easily generate the histogram by creating a bar chart based on the histogram table.
In python, we can use the following two functions to create and then display the histogram of an image.
import matplotlib.pyplot as plt import numpy as np def generate_histogram(img, do_print): """ @params: img: can be a grayscale or color image. We calculate the Normalized histogram of this image. @params: do_print: if or not print the result histogram @return: will return both histogram and the grayscale image """ if len(img.shape) == 3: ## img is colorful, so we convert it to grayscale gr_img = np.mean(img, axis=-1) else: gr_img = img '''now we calc grayscale histogram''' gr_hist = np.zeros() for x_pixel in range(gr_img.shape): for y_pixel in range(gr_img.shape): pixel_value = int(gr_img[x_pixel, y_pixel]) gr_hist[pixel_value] += 1 '''normalizing the Histogram''' gr_hist /= (gr_img.shape * gr_img.shape) if do_print: print_histogram(gr_hist, name="n_h_img", title="Normalized Histogram") return gr_hist, gr_img def print_histogram(_histrogram, name, title): plt.figure() plt.title(title) plt.plot(_histrogram, color='#ef476f') plt.bar(np.arange(len(_histrogram)), _histrogram, color='#b7b7a4') plt.ylabel('Number of Pixels') plt.xlabel('Pixel Value') plt.savefig("hist_" + name)
Most of the time when we create a histogram, we normalize the histogram by dividing the number of pixels with each intensity value by the normalizing factor which is the multiplication of the image width and image height. For ease of use, if the input image of the generate_histogram function is a color image, we first convert to a grayscale image(see line## 6).
#computer-vision #histograms #image-processing #python #histogram-equalization
Let’s understand why an explainable AI is making lot of fuss nowadays. Consider an example a person(consumer) Mr. X goes to bank for a personal loan and bank takes his demographic details, credit bureau details and last 6 month bank statement. After taking all the documents bank runs this on their production deployed machine Learning Model for checking whether this person will default on loan or not.
A complex ML model which is deployed on their production says that this person has 55% chances of getting default on his loan and subsequently bank rejects Mr. X personal loan application.
Now Mr X is very angry and puzzled about his application rejection. So he went to bank manager for the explanation why his personal loan application got rejected. He looks his application and got puzzled that his application is good for granting a loan but why model has predicted false. This chaos has created doubt in manager’s mind about each loan that was previously rejected by the machine learning model. Although accuracy of the model is more than 98% percentage. But still it fails to gain the trust.
Every data scientist wants to deploy model on production which has highest accuracy in prediction of output. Below is the graph shown between interpretation and accuracy of the model.
Interpreability Vs Accuracy of the Model
If you notice the increasing the accuracy of the model the interpreability of the model decrease significantly and that obstructs complex model to be used in production.
This is where Explainable AI rescue us. In Explainable AI does not only predict the outcome it also explain the process and features included to reach at the conclusion. Isn’t great right that model is explaining itself.
ML and AI application has reached to almost in each industry like Banking & Finance, Healthcare, Manufacturing, E commerce, etc. But still people are afraid to use the complex model in their field just because of they think that the complex machine learning model are black box and will not able to explain the output to businesses and stakeholders. I hope until now you have understood why Explainable AI is required for better and efficient use of machine learning and deep learning models.
Now, Let’s understand what is Explainable AI and How does it works ?
Explainable AI is set of tools and methods in Artificial Intelligence (AI) to explain the model output process that how an model has reached to particular output for a given data points.
Consider the above example where Mr. X loan has rejected and Bank Manager is not able to figure out why his application got rejected.Here an explainable can give the important features and their importance considered by the model to reach at this output. So now Manager has his report,
#explainable-ai #explainability #artificial-intelligence #machine-learning-ai #machine-learning #deep learning
With ML models serving real people, misclassified cases (which are a natural consequence of using ML) are affecting peoples’ lives and sometimes treating them very unfairly. It makes the ability to explain your models’ predictions a requirement rather than just a nice to have.
Machine learning model development is hard, especially in the real world.
Typically, you need to:
And that is not all.
You should have the experiments you run and models you train versioned in case you or anyone else needs to inspect them or reproduce the results in the future. From my experience, this moment comes when you least expect it and the feeling of “I wish I had thought about it before” is so very real (and painful).
But there is even more.
#2020 aug tutorials # overviews #explainability #explainable ai #interpretability #python #shap
The session “Explainable AI For Computer Vision” was presented at the first of its kind Computer Vision conference, CVDC 2020 by Avni Gupta, who is the Technology Lead at Synduit. Organised by the Association of Data Scientists (ADaSCi), the premier global professional body of data science and machine learning professionals, it is a first-of-its-kind virtual conference on Computer Vision.
The primary aspect of the talk is computer vision models most of the time act as a black box and it is hard to explain what is actually going behind the models or how the outcomes are coming from. She also mentioned some of the important libraries which can help to make explainable AI possible in Computer Vision models.
According to Gupta, many a time, when developers create a computer vision model, they find themselves interacting with a backbox and unaware of what feature extraction is happening at each layer. With the help of explainable AI, it becomes easier to comprehend and know when enough layers have been added and what feature extraction has taken place at each layer.
#developers corner #black box in ai #computer vision model #explainability in ai #explainable ai #ml models