<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vishal Solanki on Medium]]></title>
        <description><![CDATA[Stories by Vishal Solanki on Medium]]></description>
        <link>https://medium.com/@vishalsolanki_42311?source=rss-eb1c40374660------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BOFSb9LZObRKDtb4</url>
            <title>Stories by Vishal Solanki on Medium</title>
            <link>https://medium.com/@vishalsolanki_42311?source=rss-eb1c40374660------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 05:14:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vishalsolanki_42311/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Explainable AI : The Next Level]]></title>
            <link>https://medium.com/analytics-vidhya/explainable-ai-the-next-level-c6b4dadc240?source=rss-eb1c40374660------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6b4dadc240</guid>
            <category><![CDATA[eli5]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[model-interpretation]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[explainable-ai]]></category>
            <dc:creator><![CDATA[Vishal Solanki]]></dc:creator>
            <pubDate>Fri, 31 Jul 2020 11:47:21 GMT</pubDate>
            <atom:updated>2020-08-06T04:55:34.378Z</atom:updated>
            <content:encoded><![CDATA[<h3>Explainable AI : The Next Level</h3><h4><strong>Explainable AI</strong> (<strong>XAI</strong>) refers to methods and techniques in the ML/AI such that the results of the solution can be understood by humans. It contrasts with the concept of the “black box” in machine learning where even their designers cannot explain why the AI arrived at a specific decision.</h4><h4>Why do we need XAI ?</h4><p>I will keep this section short but informative because as a Data Scientist we know very well why do we need to explain our models.</p><h4>· <strong>Trust Buildup</strong></h4><h4>· Justification</h4><h4>· Speed up the widespread adoption</h4><p>Lets understand the need of XAI form below scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bkC_kSQj82-vp1nOADJ7Rw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MB6_mMp2_QXB0lBnW8hE5w.png" /></figure><p><strong>I think from above two images, it is all clear why do we need XAI layer in our pipeline while making predictions.</strong></p><h3>Service/Libraries Available For XAI</h3><p>There are many services available for XAI but I would say only three are matured enough to use.</p><p>Below are the services which I have explored related to XAI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CiBVG31YbxksxYcvBU0IQg.png" /></figure><h3>Independent Libraries</h3><p>Today, I will be covering ELI5 and LIME to explain the models.</p><p><strong>ELI5</strong>: is a python package which helps to understand the models prediction in an intuitive way, however it doesn’t support true model-agnostic interpretations and support for models are mostly limited to tree-based and other parametric\linear models.</p><p>For Independent libraries I m using <strong>Telecom Customer Churn</strong> dataset.</p><p><strong>Dataset Details:</strong> Shape: (7032,20), Target Variable: Churn( 1:Yes, 0:No)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hfa9kcGwN9y6k4GOohCSDA.png" /></figure><p><strong><em>Dataset Columns=</em></strong><em>[‘gender’, ‘SeniorCitizen’, ‘Partner’, ‘Dependents’, ‘tenure’, ‘PhoneService’, ‘MultipleLines’, ‘InternetService’, ‘OnlineSecurity’, ‘OnlineBackup’, ‘DeviceProtection’, ‘TechSupport’, ‘StreamingTV’, ‘StreamingMovies’, ‘Contract’, ‘PaperlessBilling’, ‘PaymentMethod’, ‘MonthlyCharges’, ‘TotalCharges’, ‘Churn’]</em></p><p>I am using XG boost classifier to classify the data points in Churn(Yes/No), <strong>complete code available at my </strong><a href="https://github.com/vishals2911/XAI"><strong>GitHub </strong></a><strong>repo</strong>.</p><p>After applying XG boost and ELI5, I’m getting below results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ibI1b1d_Dtoo6NO_KHPd7w.png" /></figure><p>Let’s understand each figure:</p><p><strong>Fig (1)</strong>: Shows the independent features importance on the model, all these features are arranged in descending order.</p><p><strong>Fig (2):</strong> Shows the feature contribution on single data point for predicting the class. As we can see Actual label is 1 and model has also predicted 1, it means customer is going to Churn and if we see feature contribution then we can understand because of high monthly charges (102.250), User has only month contract (0: “Month-to-month”, 1: “One year” , 2: “Two year”) and high total charges are the three factors which are impacting the most to classify the datapoint as 1 (Churn-yes).</p><p><strong>LIME: </strong>Local interpretable model-agnostic explanations, as it is clear from the name itself we can use this library only for local interpretation not for global like we did in ELI5 section (Fig 1).</p><p>Again I m using the same data set and even same model XG boost but this time I m going to explain data point for class 0 (Churn-No).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EcbbhEZeqWoBZrUUf-uG5g.png" /><figcaption><strong>Actual 0 (Churn- No) , Predicted 0 (Churn -No)</strong></figcaption></figure><p>As we can see probability for class 0 is 0.93 and actual label is also 0 so we can say yes our model is working fine now let’s check explanation as well. We can see user has only month contract (0: “Month-to-month”, 1: “One year” , 2: “Two year”) like is previous case but monthly charges are too low also user is not a senior Citizen so these two factors are impacting the most during prediction to predict the data point as 0 (Churn-No) however contract is still impacting in opposite way to make it 1(Churn-Yes).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VrufssuXSSTGcZHvdJkKzA.png" /><figcaption><strong>Actual 1 (Churn- Yes) , Predicted 1 (Churn -Yes)</strong></figcaption></figure><p>Now let’s understand the same data point which we explained using ELI5, we can see clearly results are almost similar to ELI5.</p><p>Because of high monthly charges (102.250), monthly contract (0: “Month-to-month”, 1: “One year” , 2: “Two year”) model is classifying the datapoint as 1 (Churn-Yes).</p><h4>Important Links: Independent Libraries</h4><ul><li><a href="https://github.com/oracle/Skater">GitHub - oracle/Skater: Python Library for Model Interpretation/Explanations</a></li><li><a href="https://eli5.readthedocs.io/en/latest/tutorials/">Tutorials - ELI5 0.9.0 documentation</a></li><li><a href="https://github.com/slundberg/shap">GitHub - slundberg/shap: A game theoretic approach to explain the output of any machine learning model.</a></li></ul><h3>IBM AI Explainability 360</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*IkyHoTH77HGPCBhwX6AVBA.png" /></figure><p>AI 360 is open source toolkit provided by IBM, in this we have variety of algorithms. I have explored all of these algorithms but I like the most BRCG and Protodash so we will be discussing these two algorithms today. You can have a look at other algorithms as well, IBM has very intuitive tutorial on their GitHub.</p><h4>How To Use IBM AI Explainability 360 Toolkit</h4><pre><br>conda create --name aix360 python=3.6<br>conda activate aix360<br>git clone <a href="https://github.com/Trusted-AI/AIX360">https://github.com/Trusted-AI/AIX360</a></pre><pre>Then, navigate to the root directory of the project which contains setup.py file and run:</pre><pre>pip install -e .</pre><h4><strong>BRCG</strong></h4><p>Boolean Rule Column Generation explainer, which implements a directly interpretable supervised learning method for binary classification that learns a Boolean rule in disjunctive normal form (DNF) or conjunctive normal form (CNF) using column generation (CG).</p><p>This directly learns accurate and interpretable “or” -of- “and” logical classification rules and this works with only tabular data.</p><p>In this I am using Breast Cancer dataset, where we need to predict a person having cancer or not.</p><p><strong><em>Dataset Columns</em></strong><em>=Index([‘mean radius’, ‘mean texture’, ‘mean perimeter’, ‘mean area’, ‘mean smoothness’, ‘mean compactness’, ‘mean concavity’, ‘mean concave points’, ‘mean symmetry’, ‘mean fractal dimension’, ‘radius error’, ‘texture error’, ‘perimeter error’, ‘area error’, ‘smoothness error’, ‘compactness error’, ‘concavity error’, ‘concave points error’, ‘symmetry error’, ‘fractal dimension error’, ‘worst radius’, ‘worst texture’, ‘worst perimeter’, ‘worst area’, ‘worst smoothness’, ‘worst compactness’, ‘worst concavity’, ‘worst concave points’, ‘worst symmetry’, ‘worst fractal dimension’], dtype=’object’)</em></p><p>Before passing model directly to the BRCG model we need to transform the data accordingly for this we will be using “FeatureBinarizer&quot;.</p><p><strong>FeatureBinarizer:</strong> The standard FeatureBinarizer creates thresholds by binning the data into a user-specified number of quantiles. The default threshold value is 9.</p><p>After preparing data we will pass this to BRCG model and find the rules for our classification. Code for both BRCG and ProtoDash is available at my <a href="https://github.com/vishals2911/XAI"><strong>GitHub </strong></a>repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wJ2mg30cq9prnyhRasJY6g.png" /></figure><p>We got four rules to explain our classification, if our input data satisfy any of the four rules then model will predict as 1 (Having Cancer).</p><h4>ProtoDash</h4><p>ProtoDash provides prototypical examples from dataset. Suppose if you have any customer and he applies for loan and you use ML model to approve/deny the loan. Now if loan gets rejected then you may want to see the previous cases similar to the current one in which loan was rejected so that you can verify. Below image showing the two most similar cases having target variable 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Y4zuCC6WRPuzaxpWLD1_g.png" /></figure><p>Now lets assume you have list of customers having all details and their loan status as well, you want two exactly unique customers one is from approved class and another is from denied class then you can use Protodash to have these details.</p><p>Below image showing the two most unique customers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iIOgYOYtCQkDE8JmLvQtDQ.png" /></figure><h4>Important links: IBM AI 360</h4><ul><li><a href="https://aix360.mybluemix.net/">AI Explainability 360</a></li><li><a href="https://github.com/Trusted-AI/AIX360">GitHub - Trusted-AI/AIX360: Interpretability and explainability of data and machine learning models</a></li></ul><h3><strong>Explainable AI — Google</strong></h3><p>There are three services provide by the google for Explainable AI.</p><p><strong>· AI Explanations</strong></p><p><strong>· What-If-Tool</strong></p><p><strong>· Continuous evaluation</strong></p><p>Explainable AI tools (other than WIT) require customers to build and implement their models within the Google Cloud. Though, they are provided at no extra charge to users of AutoML Tables or AI Platform.</p><p>WIT is an open-source tool and is compatible with TensorBoard, Jupyter and Colaboratory notebooks.</p><h4><strong>AI Explanations</strong></h4><p>AI Explanations helps understand model’s outputs for classification and regression tasks. It tells how much each feature in the data contributed to the predicted result. This information can be used to verify that the model is behaving as expected, recognize bias in models, and get ideas for ways to improve model and training data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BPLtE_gUm9bkWno4oBFE2Q.png" /></figure><h4>What-If-Tool</h4><p>For this amazing tool, I have already written one article.</p><p>You can have a look, I would say this tool has all functionalities which i have explained till now in this tutorial.</p><p><a href="https://medium.com/@vishalsolanki_42311/understand-your-data-and-ml-model-using-what-if-tool-57b7cf0d5541">Understand your data and ML model using What-IF_Tool</a></p><h4>Continuous evaluation (Beta)</h4><p>Continuous evaluation regularly samples prediction input and output from trained machine learning models that have been deployed to AI Platform Prediction. AI Platform Data Labeling Service then assigns human reviewers to provide ground truth labels for prediction input; alternatively, user can provide their own ground truth labels. Data Labeling Service compares your models’ predictions with the ground truth labels to provide continual feedback on how your model is performing over time.</p><p>To implement AI Explanations and Continuous evaluation we need GCP access which I don’t so I am skiping implementation of these two however links are provided below if you wish you can explore.</p><h4><strong>Important Links: Explainable AI by Google</strong></h4><ul><li><a href="https://cloud.google.com/ai-platform/prediction/docs/ai-explanations/overview">Introduction to AI Explanations for AI Platform | AI Platform Prediction | Google Cloud</a></li><li><a href="https://cloud.google.com/ai-platform/prediction/docs/continuous-evaluation">Continuous evaluation overview | AI Platform Prediction | Google Cloud</a></li></ul><h4><strong>The code used in this article is available on </strong><a href="https://github.com/vishals2911/XAI"><strong>GitHub</strong></a><strong>.</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6b4dadc240" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/explainable-ai-the-next-level-c6b4dadc240">Explainable AI : The Next Level</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Add Awesome Functionalities To Your Jupyter Notebook]]></title>
            <link>https://medium.com/@vishalsolanki_42311/add-awesome-functionalities-to-your-jupyter-notebook-2332df14a4dd?source=rss-eb1c40374660------2</link>
            <guid isPermaLink="false">https://medium.com/p/2332df14a4dd</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[nbextensions]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[hide]]></category>
            <category><![CDATA[jupyter-notebook]]></category>
            <dc:creator><![CDATA[Vishal Solanki]]></dc:creator>
            <pubDate>Sun, 26 Jul 2020 04:58:59 GMT</pubDate>
            <atom:updated>2020-07-26T16:14:02.864Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, I’m gonna show you some amazing functionalities which you can add in your jupyter notebook to make it awesome.</p><p><strong><em>What if you find, you can debug your code without modifying your current notebook, write pep8 standard code even without writing them with standards actually, search any file by filename in jupyter and many more.</em></strong></p><p>Personally, I know around 320–350 Data Scientists and 80% of them are using Jupyter to write their code but only 8–10 % are aware of these functionalities. I have been using jupyter for 4 years and have faced many challenges which we can overcome easily by using these extensions.</p><p>There are many extensions available for jupyter but personally I love Nbextensions and I’m sure you will love it too after using below functionalities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tB1GMS0e3DyU8ijTJrxELg.png" /></figure><h3>How to add Nbextensions to your jupyter notebook?</h3><p>Run below command in anaconda or command prompt.</p><p><strong><em>pip install jupyter_contrib_nbextensions &amp;&amp; jupyter contrib nbextension install</em></strong></p><p>After completing above command successfully, start jupyter and you will be able to see Nbextensions tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HlU4XxLlKxsnX2Q2rWvQAQ.png" /></figure><p>Now you are ready to use extensions.</p><h3>1. Prettify</h3><p>This nbextension reformats/prettifies code in notebook code cells. Use this whenever you want your code to be clean and readable.</p><p>What, Do you want this every time ? hahaha</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*E10t4OTlzN3tNWKE84HWlA.gif" /></figure><h3><strong>2. Hot Keys</strong></h3><p>Adds new key combinations for easier notebook navigation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*I6UAiyKWwuFleZjnFE1swg.png" /></figure><h3>3. Notify</h3><p>This is probably my favorite extension at the moment, because I always have code running in the background and used to catch it well after the kernel was idle — but not anymore!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*jW3-qHRCSGCmLk0xs_kG9w.gif" /></figure><h3>4. Scratchpad</h3><p>This happens with me most of the time, I add some lines to debug my code and ended up with having those line in the final code.</p><p>Once enabled, <a href="https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/scratchpad/README.html#">Scratchpad</a> is a cell that acts like a scratch notebook where you can execute code against the kernel without having to modify your notebook.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Mh79o_R0X81wiTBVGvCiQ.gif" /></figure><h3>5. Tree Filter</h3><p>If you use jupyter then you must be aware how difficult it is to search a file but not now after having this amazing extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZOY-y6Aayfg4JLbM8kQKmA.gif" /></figure><h3>6. 2 to 3 Converter</h3><p>Converts python2 code in a notebook’s code cell to python3 code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*_BjBwxoBlmDpdX9DxTIy_Q.gif" /></figure><h3>7. Execute Time</h3><p>Display when each cell has been executed and how long it took, this is very useful when we compare different models, pre-processing/processing steps w.r.t to their time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*BlxcAMGt4mQp26LbzMaoEA.png" /></figure><h3>8. Snippets</h3><p>Do you have the some sets of code which you use almost in your every program? if yes then you will love this extension.</p><p>Just make the snippet of your code and use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q4aHrd_tqbm1_4CQOWxNqw.gif" /></figure><h3>9. Table of Contents</h3><p>The toc2 extension enables to collect all running headers and display them in a floating window, as a sidebar or with a navigation menu. The extension is also draggable, resizable, collapsable, dockable and features automatic numerotation with unique links ids, and an optional toc cell.</p><h4><strong>Floating toc window and SideBar, toc auto-update, section numbering.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*ruHolltN71WhDHYyCaMDLw.gif" /></figure><h4>Save as html with toc / Navigation menu.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*pzY82F93myCq4QkovaOMFw.gif" /></figure><h4>Notebook scrolling and Collapsing sections</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*PNV_xAcapA3ONJZwuCKnfg.gif" /></figure><h3><strong>10. Variable Inspector</strong></h3><p>Some of my friends use Spyder just because it shows variable but now you can see your variables in Juptyer as well.</p><p>The Variable Inspector extension collects all defined variables and display them in a floating window. The extension is also draggable, resizable, collapsable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*2Iedq8J8NA1xQ3nUU1qpDw.gif" /></figure><h3>11. Autopep8</h3><p>We all know it is always a good practice to write code with pep 8 standards but who has time to follow all standards, do you have?… but sorry, really i don’t have.</p><p>This nbextension reformats/prettifies code in notebook python code cells as per pep 8 standards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qATJszW3KUg38ILl8Czf_w.gif" /></figure><h3>12. Hide All Input</h3><p>Whenever I present my work to someone who don’t have any interests in coding and want to see only output then I always use this extension to gaze their attention.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*V4fZPEW24okqf7Ofwlp6TA.gif" /></figure><h3>13. Skip-Traceback</h3><p>Errors in code are just like part of life to me but why should I waste my time in scrolling down when i have this awesome extension.</p><p>Hide error tracebacks, displaying instead a summary of the error name and type. Clicking the summary displays the whole traceback.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*VRBMBnV9mfGmrMFeAd_BgA.png" /></figure><h4>Use theses extensions and see if your productivity improves.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2332df14a4dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understand your data and ML model using What-IF_Tool]]></title>
            <link>https://medium.com/@vishalsolanki_42311/understand-your-data-and-ml-model-using-what-if-tool-57b7cf0d5541?source=rss-eb1c40374660------2</link>
            <guid isPermaLink="false">https://medium.com/p/57b7cf0d5541</guid>
            <category><![CDATA[ml-model]]></category>
            <category><![CDATA[xai]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[explainable-ai]]></category>
            <category><![CDATA[what-if-tool]]></category>
            <dc:creator><![CDATA[Vishal Solanki]]></dc:creator>
            <pubDate>Fri, 24 Jul 2020 15:33:47 GMT</pubDate>
            <atom:updated>2020-07-28T04:22:20.036Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understand your data and ML model using What-IF Tool</h3><ul><li>The What-If Tool is a visualization-based tool to probe the behavior of trained ML models.</li><li>The tool is part of Google’s open-source Tensorboard web application, we can use this with Colab as well as with Jupyter.</li></ul><p>NOTE: While writing this article, i am assuming you have idea of basic terminologies related to machine learning. After all, you will be using what-If-Tool once you create your model.</p><h3><strong>What it has to provide you?</strong></h3><p>It has three tabs, which are <strong>Datapoint Editor, Performance and Fairness, Features.</strong></p><p><strong>Datapoint Editor</strong></p><ol><li>Partial dependence plots.</li><li>Nearest Counterfactual.</li><li>Edit you data point and see the updated results.</li><li>Draw graph b/w any variable, including target as well as independent variable.</li><li>Model comparison.</li></ol><p><strong>Performance Fairness</strong></p><ol><li>Confusion matrix, F1 score ,FN, FP, Accuracy in case of classification model.</li><li>RMSE, MSE other metrics in case of regression.</li><li>Optimization strategy by setting custom thresholds.</li></ol><p><strong>Features</strong></p><ol><li>Feature insights for numerical as well as Categorical features.</li><li>For numerical features it provides like missing percentage, mean, median, zeros, standard deviation, max value.</li><li>For categorical features it gives missing values, max repeated value, average string length.</li></ol><h3><strong>Advantages</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*ycpaq0KYx1Yls4SJiLHdZw.png" /></figure><h3>A tour of the What-If Tool</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RyFxfgGlSlW3lZv3EJ6amg.gif" /></figure><h3>How to use What-If-Tool.</h3><p><strong>For Tensorflow based model: we need to use below code to invoke the What-If-Tool.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*xKYds7dOanaPY6LtChW0mg.png" /></figure><p>In above code:</p><p><em>examples[0:num_datapoints]: A dataframe into a list of tf.Example protos for which we want predictions.</em></p><p><em>regressor: TF based model</em></p><p><em>feature_speec: A tf feature spec from the dataframe and columns specified.</em></p><p><strong>For sklearn based model: we need to use below code to invoke the What-If-Tool, here we are using set_custom_predict_fn().</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*qlaS83gHx4YnqZ1zJTMR3A.png" /></figure><p>In above code:</p><p><em>test_examples.tolist(): A dataframe converted into numpy array for which we want to predict and test our model.</em></p><p><em>X_test.columns.tolist(): List of the columns in our dataframe.</em></p><p><em>[“age”]:Target variable</em></p><p><em>adjust_prediction: A custom function to make prediction, which basically convert the numpy array into pandas dataframe and make predictions.</em></p><p><strong>Code:</strong><a href="https://github.com/vishals2911/What-If-tool"><strong> What-If-tool</strong></a></p><p>.ipynb and .py files for both TF based models as well as Sklearn models are available at my github repo.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FqTUUwfG1vSs%3Fstart%3D3%26feature%3Doembed%26start%3D3&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqTUUwfG1vSs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FqTUUwfG1vSs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/96407d4c464df21654e20f17a37c530c/href">https://medium.com/media/96407d4c464df21654e20f17a37c530c/href</a></iframe><p><strong>Conclusion:</strong></p><p>What-If-Tool provided by google, it is open source and can be easily integrated with colab or jupyter. It provides data insights, partial dependence plots, we can edit data point and see the impact on predictions point, model comparison if we are using more than one model, change the thresholds value and visualize the impact on accuracy.</p><h3>Important links:</h3><ul><li><a href="https://pair-code.github.io/what-if-tool/get-started/">WIT - Getting Started</a></li><li><a href="https://github.com/PAIR-code/what-if-tool">PAIR-code/what-if-tool</a></li><li><a href="https://www.tensorflow.org/tensorboard/what_if_tool">Model Understanding with the What-If Tool Dashboard | TensorBoard</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57b7cf0d5541" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>