From c61da5435eb6669c829d006c70a32fe8febae7a5 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 29 Jan 2020 12:03:17 +0530 Subject: Publish deploy 2020-01-29 12:03 --- Themes/styles 2.css | 397 --------------------- assets/IPAs/Instagram-Rhino.ipa | Bin 0 -> 45961163 bytes assets/disqus 2.js | 5 - .../gciTales/01-teachableMachines/01-collect 3.png | Bin 3148125 -> 0 bytes .../gciTales/01-teachableMachines/02-train 3.png | Bin 1673773 -> 0 bytes .../gciTales/01-teachableMachines/03-label 3.png | Bin 134577 -> 0 bytes .../gciTales/01-teachableMachines/04-alert 3.png | Bin 45710 -> 0 bytes assets/gciTales/01-teachableMachines/05-html 3.png | Bin 15084 -> 0 bytes assets/gciTales/01-teachableMachines/06-js 3.png | Bin 117349 -> 0 bytes assets/gciTales/01-teachableMachines/07-eg 3.png | Bin 787109 -> 0 bytes assets/gciTales/01-teachableMachines/08-eg 3.png | Bin 832865 -> 0 bytes assets/gciTales/03-regression/1 3.png | Bin 39478 -> 0 bytes assets/gciTales/03-regression/2 3.png | Bin 67134 -> 0 bytes assets/gciTales/03-regression/3 3.png | Bin 59514 -> 0 bytes assets/gciTales/03-regression/4 3.png | Bin 58153 -> 0 bytes assets/gciTales/03-regression/5 3.png | Bin 58824 -> 0 bytes assets/gciTales/03-regression/6 3.png | Bin 59554 -> 0 bytes "assets/r\303\251sum\303\251 2.pdf" | Bin 90006 -> 0 bytes .../index 2.html | 23 -- posts/2019-12-22-Fake-News-Detector/index 2.html | 173 --------- .../index 2.html | 9 - .../index 2.html | 1 - posts/hello-world/index 2.html | 1 - posts/index 2.html | 1 - .../index 2.html | 7 - tags/article/index 2.html | 1 - tags/article/index 3.html | 1 - tags/codesnippet/index 2.html | 1 - tags/codesnippet/index 3.html | 1 - tags/colab/index 2.html | 1 - tags/colab/index 3.html | 1 - tags/experiment/index 2.html | 1 - tags/experiment/index 3.html | 1 - tags/experiment/index 4.html | 1 - tags/helloworld/index 2.html | 1 - tags/helloworld/index 3.html | 1 - tags/kaggle/index 2.html | 1 - tags/linux/index 2.html | 1 - tags/linux/index 3.html | 1 - tags/linux/index 4.html | 1 - tags/publication/index 2.html | 1 - tags/raspberrypi/index 2.html | 1 - tags/raspberrypi/index 3.html | 1 - tags/swiftui/index 2.html | 1 - tags/swiftui/index 3.html | 1 - tags/tensorflow/index 2.html | 1 - tags/tensorflow/index 3.html | 1 - tags/turicreate/index 2.html | 1 - tags/turicreate/index 3.html | 1 - tags/tutorial/index 2.html | 1 - tags/tutorial/index 3.html | 1 - tutorials/index/index 2.html | 1 - tutorials/index/index 3.html | 1 - 53 files changed, 645 deletions(-) delete mode 100644 Themes/styles 2.css create mode 100644 assets/IPAs/Instagram-Rhino.ipa delete mode 100644 assets/disqus 2.js delete mode 100644 assets/gciTales/01-teachableMachines/01-collect 3.png delete mode 100644 assets/gciTales/01-teachableMachines/02-train 3.png delete mode 100644 assets/gciTales/01-teachableMachines/03-label 3.png delete mode 100644 assets/gciTales/01-teachableMachines/04-alert 3.png delete mode 100644 assets/gciTales/01-teachableMachines/05-html 3.png delete mode 100644 assets/gciTales/01-teachableMachines/06-js 3.png delete mode 100644 assets/gciTales/01-teachableMachines/07-eg 3.png delete mode 100644 assets/gciTales/01-teachableMachines/08-eg 3.png delete mode 100644 assets/gciTales/03-regression/1 3.png delete mode 100644 assets/gciTales/03-regression/2 3.png delete mode 100644 assets/gciTales/03-regression/3 3.png delete mode 100644 assets/gciTales/03-regression/4 3.png delete mode 100644 assets/gciTales/03-regression/5 3.png delete mode 100644 assets/gciTales/03-regression/6 3.png delete mode 100644 "assets/r\303\251sum\303\251 2.pdf" delete mode 100644 posts/2019-12-10-TensorFlow-Model-Prediction/index 2.html delete mode 100644 posts/2019-12-22-Fake-News-Detector/index 2.html delete mode 100644 posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab/index 2.html delete mode 100644 posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal/index 2.html delete mode 100644 posts/hello-world/index 2.html delete mode 100644 posts/index 2.html delete mode 100644 publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response/index 2.html delete mode 100644 tags/article/index 2.html delete mode 100644 tags/article/index 3.html delete mode 100644 tags/codesnippet/index 2.html delete mode 100644 tags/codesnippet/index 3.html delete mode 100644 tags/colab/index 2.html delete mode 100644 tags/colab/index 3.html delete mode 100644 tags/experiment/index 2.html delete mode 100644 tags/experiment/index 3.html delete mode 100644 tags/experiment/index 4.html delete mode 100644 tags/helloworld/index 2.html delete mode 100644 tags/helloworld/index 3.html delete mode 100644 tags/kaggle/index 2.html delete mode 100644 tags/linux/index 2.html delete mode 100644 tags/linux/index 3.html delete mode 100644 tags/linux/index 4.html delete mode 100644 tags/publication/index 2.html delete mode 100644 tags/raspberrypi/index 2.html delete mode 100644 tags/raspberrypi/index 3.html delete mode 100644 tags/swiftui/index 2.html delete mode 100644 tags/swiftui/index 3.html delete mode 100644 tags/tensorflow/index 2.html delete mode 100644 tags/tensorflow/index 3.html delete mode 100644 tags/turicreate/index 2.html delete mode 100644 tags/turicreate/index 3.html delete mode 100644 tags/tutorial/index 2.html delete mode 100644 tags/tutorial/index 3.html delete mode 100644 tutorials/index/index 2.html delete mode 100644 tutorials/index/index 3.html diff --git a/Themes/styles 2.css b/Themes/styles 2.css deleted file mode 100644 index 6042be0..0000000 --- a/Themes/styles 2.css +++ /dev/null @@ -1,397 +0,0 @@ -* { - margin: 0; - padding: 0; - box-sizing: border-box; - font-size: 16px; - -webkit-text-size-adjust: 100%; -} - -body { - background: #fff; - color: #000; - font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial; - text-align: center; -} - -.wrapper { - max-width: 900px; - margin-left: auto; - margin-right: auto; - padding: 40px; - text-align: left; -} - -header { - - - position: relative; - color: #ededed; - line-height: 1.5em; - padding: 0 20px; -} - -/* - -header { - background: #ededed; - margin-bottom: 0em; - padding-bottom: 2em; - left: 0px; - top: 0px; - height: 8em; - width: 100%; -} -.header-background { - background-image: url(images/logo.png); - background-size: 100% 100%; - background-repeat: no-repeat; - background-size: cover; - background-position: center; - height: 200px; -} -*/ - -header .wrapper { - padding-top: 20px; - padding-bottom: 20px; - text-align: left; -} - -header a { - text-decoration: none; -} - -header .site-name { - color: #000; - margin: 0; - cursor: pointer; - font-weight: 200; - font-size: 2.3em; - letter-spacing: 1px; -} - -nav { - /*margin-top: 0.5em;*/ - text-align: right; -} - -nav li { - margin-top: 0.5em; - display: inline-block; - background-color: #000; - color: #ddd; - padding: 4px 6px; - border-radius: 5px; - margin-right: 5px; - -} - -nav li:hover { - color: #000; - background-color: #ddd; -} -h1 { - margin-bottom: 20px; - font-size: 2em; -} - -h2 { - margin: 20px 0; -} - -p { - margin-bottom: 10px; -} - -a { - color: inherit; - -} - -.description { - margin-bottom: 20px; -} - -.item-list > li { - display: block; - padding: 20px; - border-radius: 20px; - background-color: #eee; - margin-bottom: 20px -} - -.item-list > li:last-child { - margin-bottom: 0; -} - -.item-list h1 { - margin-bottom: 15px; - font-size: 1.3em; -} -.item-list a { - text-decoration: none; -} - -.item-list p { - margin-bottom: 0; -} - -.reading-time { - display: inline-block; - border-radius: 5px; - background-color: #ddd; - color: #000; - padding: 4px 4px; - margin-bottom: 5px; - -} - -.tag-list { - margin-bottom: 5px; /* 15px */ -} - -.tag-list li, -.tag { - display: inline-block; - background-color: #000; - color: #ddd; - padding: 4px 6px; - border-radius: 5px; - margin-right: 5px; - margin-top: 0.5em; -} - -.tag-list a, -.tag a { - text-decoration: none; -} - -.item-page .tag-list { - display: inline-block; -} - -.content { - margin-bottom: 40px; -} - -.browse-all { - display: block; - margin-bottom: 30px; -} - -.all-tags li { - font-size: 1.4em; - margin-right: 10px; - padding: 6px 10px; - margin-top: 1em; -} - -img { - max-width: 100%; - margin-bottom: 1em; - margin-top: 1em; - width: auto\9; - height: auto; - vertical-align: middle; - border: 0; - -ms-interpolation-mode: bicubic; -} - -footer { - color: #000; -} - - - -pre { - overflow-x: auto; - font-family: Monaco,Consolas,"Lucida Console",monospace; - display: block; - background-color: #fdf6e3; - color: #586e75; - margin-bottom: 1em; - margin-top: 1em; - border-radius: 4px; -} - -.highlight { background-color: #fdf6e3; color: #586e75; } -.highlight .c { color: #627272; } -.highlight .err { color: #586e75; } -.highlight .g { color: #586e75; } -.highlight .k { color: #677600; } -.highlight .l { color: #586e75; } -.highlight .n { color: #586e75; } -.highlight .o { color: #677600; } -.highlight .x { color: #c14715; } -.highlight .p { color: #586e75; } -.highlight .cm { color: #627272; } -.highlight .cp { color: #677600; } -.highlight .c1 { color: #627272; } -.highlight .cs { color: #677600; } -.highlight .gd { color: #217d74; } -.highlight .ge { color: #586e75; font-style: italic; } -.highlight .gr { color: #d72825; } -.highlight .gh { color: #c14715; } -.highlight .gi { color: #677600; } -.highlight .go { color: #586e75; } -.highlight .gp { color: #586e75; } -.highlight .gs { color: #586e75; font-weight: bold; } -.highlight .gu { color: #c14715; } -.highlight .gt { color: #586e75; } -.highlight .kc { color: #c14715; } -.highlight .kd { color: #1f76b6; } -.highlight .kn { color: #677600; } -.highlight .kp { color: #677600; } -.highlight .kr { color: #1f76b6; } -.highlight .kt { color: #d72825; } -.highlight .ld { color: #586e75; } -.highlight .m { color: #217d74; } -.highlight .s { color: #217d74; } -.highlight .na { color: #586e75; } -.highlight .nb { color: #8d6900; } -.highlight .nc { color: #1f76b6; } -.highlight .no { color: #c14715; } -.highlight .nd { color: #1f76b6; } -.highlight .ni { color: #c14715; } -.highlight .ne { color: #c14715; } -.highlight .nf { color: #1f76b6; } -.highlight .nl { color: #586e75; } -.highlight .nn { color: #586e75; } -.highlight .nx { color: #586e75; } -.highlight .py { color: #586e75; } -.highlight .nt { color: #1f76b6; } -.highlight .nv { color: #1f76b6; } -.highlight .ow { color: #677600; } -.highlight .w { color: #586e75; } -.highlight .mf { color: #217d74; } -.highlight .mh { color: #217d74; } -.highlight .mi { color: #217d74; } -.highlight .mo { color: #217d74; } -.highlight .sb { color: #627272; } -.highlight .sc { color: #217d74; } -.highlight .sd { color: #586e75; } -.highlight .s2 { color: #217d74; } -.highlight .se { color: #c14715; } -.highlight .sh { color: #586e75; } -.highlight .si { color: #217d74; } -.highlight .sx { color: #217d74; } -.highlight .sr { color: #d72825; } -.highlight .s1 { color: #217d74; } -.highlight .ss { color: #217d74; } -.highlight .bp { color: #1f76b6; } -.highlight .vc { color: #1f76b6; } -.highlight .vg { color: #1f76b6; } -.highlight .vi { color: #1f76b6; } -.highlight .il { color: #217d74; } - - -@media (prefers-color-scheme: dark) { - .reading-time { - background-color: #000; - color: #ddd; - } - body { - background-color: #222; - } - - body, - header .site-name { - color: #ddd; - } - nav li { - background-color: #ddd; - color: #000; - - } - nav li:hover { - color: #ddd; - background-color: #000; - } - - .item-list > li { - background-color: #333; - } - - header { - background-color: #000; - } - footer { - color: #ddd; - } - - pre { - background-color: #002b36; - color: #93a1a1; - } - - .highlight { background-color: #002b36; color: #93a1a1; } - .highlight .c { color: #759299; } - .highlight .err { color: #93a1a1; } - .highlight .g { color: #93a1a1; } - .highlight .k { color: #859900; } - .highlight .l { color: #93a1a1; } - .highlight .n { color: #93a1a1; } - .highlight .o { color: #859900; } - .highlight .x { color: #e9662f; } - .highlight .p { color: #93a1a1; } - .highlight .cm { color: #759299; } - .highlight .cp { color: #859900; } - .highlight .c1 { color: #759299; } - .highlight .cs { color: #859900; } - .highlight .gd { color: #2aa198; } - .highlight .ge { color: #93a1a1; font-style: italic; } - .highlight .gr { color: #e8625f; } - .highlight .gh { color: #e9662f; } - .highlight .gi { color: #859900; } - .highlight .go { color: #93a1a1; } - .highlight .gp { color: #93a1a1; } - .highlight .gs { color: #93a1a1; font-weight: bold; } - .highlight .gu { color: #e9662f; } - .highlight .gt { color: #93a1a1; } - .highlight .kc { color: #e9662f; } - .highlight .kd { color: #3294da; } - .highlight .kn { color: #859900; } - .highlight .kp { color: #859900; } - .highlight .kr { color: #3294da; } - .highlight .kt { color: #e8625f; } - .highlight .ld { color: #93a1a1; } - .highlight .m { color: #2aa198; } - .highlight .s { color: #2aa198; } - .highlight .na { color: #93a1a1; } - .highlight .nb { color: #B58900; } - .highlight .nc { color: #3294da; } - .highlight .no { color: #e9662f; } - .highlight .nd { color: #3294da; } - .highlight .ni { color: #e9662f; } - .highlight .ne { color: #e9662f; } - .highlight .nf { color: #3294da; } - .highlight .nl { color: #93a1a1; } - .highlight .nn { color: #93a1a1; } - .highlight .nx { color: #93a1a1; } - .highlight .py { color: #93a1a1; } - .highlight .nt { color: #3294da; } - .highlight .nv { color: #3294da; } - .highlight .ow { color: #859900; } - .highlight .w { color: #93a1a1; } - .highlight .mf { color: #2aa198; } - .highlight .mh { color: #2aa198; } - .highlight .mi { color: #2aa198; } - .highlight .mo { color: #2aa198; } - .highlight .sb { color: #759299; } - .highlight .sc { color: #2aa198; } - .highlight .sd { color: #93a1a1; } - .highlight .s2 { color: #2aa198; } - .highlight .se { color: #e9662f; } - .highlight .sh { color: #93a1a1; } - .highlight .si { color: #2aa198; } - .highlight .sx { color: #2aa198; } - .highlight .sr { color: #e8625f; } - .highlight .s1 { color: #2aa198; } - .highlight .ss { color: #2aa198; } - .highlight .bp { color: #3294da; } - .highlight .vc { color: #3294da; } - .highlight .vg { color: #3294da; } - .highlight .vi { color: #3294da; } - .highlight .il { color: #2aa198; } -} - diff --git a/assets/IPAs/Instagram-Rhino.ipa b/assets/IPAs/Instagram-Rhino.ipa new file mode 100644 index 0000000..79f9466 Binary files /dev/null and b/assets/IPAs/Instagram-Rhino.ipa differ diff --git a/assets/disqus 2.js b/assets/disqus 2.js deleted file mode 100644 index 685f2df..0000000 --- a/assets/disqus 2.js +++ /dev/null @@ -1,5 +0,0 @@ -(function() { - var t = document, - e = t.createElement("script"); - e.src = "https://REPLACE-WITH-SHORTNAME.disqus.com/embed.js", e.setAttribute("data-timestamp", +new Date), (t.head || t.body).appendChild(e) -})(); diff --git a/assets/gciTales/01-teachableMachines/01-collect 3.png b/assets/gciTales/01-teachableMachines/01-collect 3.png deleted file mode 100644 index 58e0b54..0000000 Binary files a/assets/gciTales/01-teachableMachines/01-collect 3.png and /dev/null differ diff --git a/assets/gciTales/01-teachableMachines/02-train 3.png b/assets/gciTales/01-teachableMachines/02-train 3.png deleted file mode 100644 index a69fd63..0000000 Binary files a/assets/gciTales/01-teachableMachines/02-train 3.png and /dev/null differ diff --git a/assets/gciTales/01-teachableMachines/03-label 3.png b/assets/gciTales/01-teachableMachines/03-label 3.png deleted file mode 100644 index efe450d..0000000 Binary files a/assets/gciTales/01-teachableMachines/03-label 3.png and /dev/null differ diff --git a/assets/gciTales/01-teachableMachines/04-alert 3.png b/assets/gciTales/01-teachableMachines/04-alert 3.png deleted file mode 100644 index f648bad..0000000 Binary files a/assets/gciTales/01-teachableMachines/04-alert 3.png and /dev/null differ diff --git a/assets/gciTales/01-teachableMachines/05-html 3.png b/assets/gciTales/01-teachableMachines/05-html 3.png deleted file mode 100644 index f917c07..0000000 Binary files a/assets/gciTales/01-teachableMachines/05-html 3.png and /dev/null differ diff --git a/assets/gciTales/01-teachableMachines/06-js 3.png b/assets/gciTales/01-teachableMachines/06-js 3.png deleted file mode 100644 index 173a8aa..0000000 Binary files a/assets/gciTales/01-teachableMachines/06-js 3.png and /dev/null differ diff --git a/assets/gciTales/01-teachableMachines/07-eg 3.png b/assets/gciTales/01-teachableMachines/07-eg 3.png deleted file mode 100644 index cc8198e..0000000 Binary files a/assets/gciTales/01-teachableMachines/07-eg 3.png and /dev/null differ diff --git a/assets/gciTales/01-teachableMachines/08-eg 3.png b/assets/gciTales/01-teachableMachines/08-eg 3.png deleted file mode 100644 index b1261fa..0000000 Binary files a/assets/gciTales/01-teachableMachines/08-eg 3.png and /dev/null differ diff --git a/assets/gciTales/03-regression/1 3.png b/assets/gciTales/03-regression/1 3.png deleted file mode 100644 index b07d172..0000000 Binary files a/assets/gciTales/03-regression/1 3.png and /dev/null differ diff --git a/assets/gciTales/03-regression/2 3.png b/assets/gciTales/03-regression/2 3.png deleted file mode 100644 index 53531ad..0000000 Binary files a/assets/gciTales/03-regression/2 3.png and /dev/null differ diff --git a/assets/gciTales/03-regression/3 3.png b/assets/gciTales/03-regression/3 3.png deleted file mode 100644 index 542d76e..0000000 Binary files a/assets/gciTales/03-regression/3 3.png and /dev/null differ diff --git a/assets/gciTales/03-regression/4 3.png b/assets/gciTales/03-regression/4 3.png deleted file mode 100644 index 16101cd..0000000 Binary files a/assets/gciTales/03-regression/4 3.png and /dev/null differ diff --git a/assets/gciTales/03-regression/5 3.png b/assets/gciTales/03-regression/5 3.png deleted file mode 100644 index 36b9c26..0000000 Binary files a/assets/gciTales/03-regression/5 3.png and /dev/null differ diff --git a/assets/gciTales/03-regression/6 3.png b/assets/gciTales/03-regression/6 3.png deleted file mode 100644 index 479d0e5..0000000 Binary files a/assets/gciTales/03-regression/6 3.png and /dev/null differ diff --git "a/assets/r\303\251sum\303\251 2.pdf" "b/assets/r\303\251sum\303\251 2.pdf" deleted file mode 100644 index 924ddb0..0000000 Binary files "a/assets/r\303\251sum\303\251 2.pdf" and /dev/null differ diff --git a/posts/2019-12-10-TensorFlow-Model-Prediction/index 2.html b/posts/2019-12-10-TensorFlow-Model-Prediction/index 2.html deleted file mode 100644 index 3b71ea8..0000000 --- a/posts/2019-12-10-TensorFlow-Model-Prediction/index 2.html +++ /dev/null @@ -1,23 +0,0 @@ -Making Predictions using Image Classifier (TensorFlow) | Navan Chauhan
🕑 1 minute read.

Making Predictions using Image Classifier (TensorFlow)

This was tested on TF 2.x and works as of 2019-12-10

If you want to understand how to make your own custom image classifier, please refer to my previous post.

If you followed my last post, then you created a model which took an image of dimensions 50x50 as an input.

First we import the following if we have not imported these before

import cv2 -import os -
- -

Then we read the file using OpenCV.

image=cv2.imread(imagePath) -
- -

The cv2. imread() function returns a NumPy array representing the image. Therefore, we need to convert it before we can use it.

image_from_array = Image.fromarray(image, 'RGB') -
- -

Then we resize the image

size_image = image_from_array.resize((50,50)) -
- -

After this we create a batch consisting of only one image

p = np.expand_dims(size_image, 0) -
- -

We then convert this uint8 datatype to a float32 datatype

img = tf.cast(p, tf.float32) -
- -

Finally we make the prediction

print(['Infected','Uninfected'][np.argmax(model.predict(img))]) -
- -

Infected

Tagged with:
\ No newline at end of file diff --git a/posts/2019-12-22-Fake-News-Detector/index 2.html b/posts/2019-12-22-Fake-News-Detector/index 2.html deleted file mode 100644 index a29cd6c..0000000 --- a/posts/2019-12-22-Fake-News-Detector/index 2.html +++ /dev/null @@ -1,173 +0,0 @@ -Building a Fake News Detector with Turicreate | Navan Chauhan
🕑 6 minute read.

Building a Fake News Detector with Turicreate

In this tutorial we will build a fake news detecting app from scratch, using Turicreate for the machine learning model and SwiftUI for building the app

Note: These commands are written as if you are running a jupyter notebook.

Building the Machine Learning Model

Data Gathering

To build a classifier, you need a lot of data. George McIntire (GH: @joolsa) has created a wonderful dataset containing the headline, body and wheter it is fake or real. Whenever you are looking for a dataset, always try searching on Kaggle and GitHub before you start building your own

Dependencies

I used a Google Colab instance for training my model. If you also plan on using Google Colab then I reccomend choosing a GPU Instance (It is Free) This allows you to train the model on the GPU. Turicreat is built on top of Apache's MXNet Framework, for us to use GPU we need to install a CUDA compatible MXNet package.

!pip install turicreate -!pip uninstall -y mxnet -!pip install mxnet-cu100==1.4.0.post0 -
- -

If you do not wish to train on GPU or are running it on your computer, you can ignore the last two lines

Downloading the Dataset

!wget -q "https://github.com/joolsa/fake_real_news_dataset/raw/master/fake_or_real_news.csv.zip" -!unzip fake_or_real_news.csv.zip -
- -

Model Creation

import turicreate as tc -tc.config.set_num_gpus(-1) # If you do not wish to use GPUs, set it to 0 -
- -
dataSFrame = tc.SFrame('fake_or_real_news.csv') -
- -

The dataset contains a column named "X1", which is of no use to us. Therefore, we simply drop it

dataSFrame.remove_column('X1') -
- -

Splitting Dataset

train, test = dataSFrame.random_split(.9) -
- -

Training

model = tc.text_classifier.create( - dataset=train, - target='label', - features=['title','text'] -) -
- -
+-----------+----------+-----------+--------------+-------------------+---------------------+ -| Iteration | Passes | Step size | Elapsed Time | Training Accuracy | Validation Accuracy | -+-----------+----------+-----------+--------------+-------------------+---------------------+ -| 0 | 2 | 1.000000 | 1.156349 | 0.889680 | 0.790036 | -| 1 | 4 | 1.000000 | 1.359196 | 0.985952 | 0.918149 | -| 2 | 6 | 0.820091 | 1.557205 | 0.990260 | 0.914591 | -| 3 | 7 | 1.000000 | 1.684872 | 0.998689 | 0.925267 | -| 4 | 8 | 1.000000 | 1.814194 | 0.999063 | 0.925267 | -| 9 | 14 | 1.000000 | 2.507072 | 1.000000 | 0.911032 | -+-----------+----------+-----------+--------------+-------------------+---------------------+ -
- -

Testing the Model

est_predictions = model.predict(test) -accuracy = tc.evaluation.accuracy(test['label'], test_predictions) -print(f'Topic classifier model has a testing accuracy of {accuracy*100}% ', flush=True) -
- -
Topic classifier model has a testing accuracy of 92.3076923076923% -
- -

We have just created our own Fake News Detection Model which has an accuracy of 92%!

example_text = {"title": ["Middling ‘Rise Of Skywalker’ Review Leaves Fan On Fence About Whether To Threaten To Kill Critic"], "text": ["Expressing ambivalence toward the relatively balanced appraisal of the film, Star Wars fan Miles Ariely admitted Thursday that an online publication’s middling review of The Rise Of Skywalker had left him on the fence about whether he would still threaten to kill the critic who wrote it. “I’m really of two minds about this, because on the one hand, he said the new movie fails to live up to the original trilogy, which makes me at least want to throw a brick through his window with a note telling him to watch his back,” said Ariely, confirming he had already drafted an eight-page-long death threat to Stan Corimer of the website Screen-On Time, but had not yet decided whether to post it to the reviewer’s Facebook page. “On the other hand, though, he commended J.J. Abrams’ skillful pacing and faithfulness to George Lucas’ vision, which makes me wonder if I should just call the whole thing off. Now, I really don’t feel like camping outside his house for hours. Maybe I could go with a response that’s somewhere in between, like, threatening to kill his dog but not everyone in his whole family? I don’t know. This is a tough one.” At press time, sources reported that Ariely had resolved to wear his Ewok costume while he murdered the critic in his sleep."]} -example_prediction = model.classify(tc.SFrame(example_text)) -print(example_prediction, flush=True) -
- -
+-------+--------------------+ -| class | probability | -+-------+--------------------+ -| FAKE | 0.9245648658345308 | -+-------+--------------------+ -[1 rows x 2 columns] -
- -

Exporting the Model

model_name = 'FakeNews' -coreml_model_name = model_name + '.mlmodel' -exportedModel = model.export_coreml(coreml_model_name) -
- -

Note: To download files from Google Volab, simply click on the files section in the sidebar, right click on filename and then click on downlaod

Link to Colab Notebook

Building the App using SwiftUI

Initial Setup

First we create a single view app (make sure you check the use SwiftUI button)

Then we copy our .mlmodel file to our project (Just drag and drop the file in the XCode Files Sidebar)

Our ML Model does not take a string directly as an input, rather it takes bag of words as an input. DescriptionThe bag-of-words model is a simplifying representation used in NLP, in this text is represented as a bag of words, without any regatd of grammar or order, but noting multiplicity

We define our bag of words function

func bow(text: String) -> [String: Double] { - var bagOfWords = [String: Double]() - - let tagger = NSLinguisticTagger(tagSchemes: [.tokenType], options: 0) - let range = NSRange(location: 0, length: text.utf16.count) - let options: NSLinguisticTagger.Options = [.omitPunctuation, .omitWhitespace] - tagger.string = text - - tagger.enumerateTags(in: range, unit: .word, scheme: .tokenType, options: options) { _, tokenRange, _ in - let word = (text as NSString).substring(with: tokenRange) - if bagOfWords[word] != nil { - bagOfWords[word]! += 1 - } else { - bagOfWords[word] = 1 - } - } - - return bagOfWords - } -
- -

We also declare our variables

@State private var title: String = "" -@State private var headline: String = "" -@State private var alertTitle = "" -@State private var alertText = "" -@State private var showingAlert = false -
- -

Finally, we implement a simple function which reads the two text fields, creates their bag of words representation and displays an alert with the appropriate result

Complete Code

import SwiftUI - -struct ContentView: View { - @State private var title: String = "" - @State private var headline: String = "" - - @State private var alertTitle = "" - @State private var alertText = "" - @State private var showingAlert = false - - var body: some View { - NavigationView { - VStack(alignment: .leading) { - Text("Headline").font(.headline) - TextField("Please Enter Headline", text: $title) - .lineLimit(nil) - Text("Body").font(.headline) - TextField("Please Enter the content", text: $headline) - .lineLimit(nil) - } - .navigationBarTitle("Fake News Checker") - .navigationBarItems(trailing: - Button(action: classifyFakeNews) { - Text("Check") - }) - .padding() - .alert(isPresented: $showingAlert){ - Alert(title: Text(alertTitle), message: Text(alertText), dismissButton: .default(Text("OK"))) - } - } - - } - - func classifyFakeNews(){ - let model = FakeNews() - let myTitle = bow(text: title) - let myText = bow(text: headline) - do { - let prediction = try model.prediction(title: myTitle, text: myText) - alertTitle = prediction.label - alertText = "It is likely that this piece of news is \(prediction.label.lowercased())." - print(alertText) - } catch { - alertTitle = "Error" - alertText = "Sorry, could not classify if the input news was fake or not." - } - - showingAlert = true - } - func bow(text: String) -> [String: Double] { - var bagOfWords = [String: Double]() - - let tagger = NSLinguisticTagger(tagSchemes: [.tokenType], options: 0) - let range = NSRange(location: 0, length: text.utf16.count) - let options: NSLinguisticTagger.Options = [.omitPunctuation, .omitWhitespace] - tagger.string = text - - tagger.enumerateTags(in: range, unit: .word, scheme: .tokenType, options: options) { _, tokenRange, _ in - let word = (text as NSString).substring(with: tokenRange) - if bagOfWords[word] != nil { - bagOfWords[word]! += 1 - } else { - bagOfWords[word] = 1 - } - } - - return bagOfWords - } -} - -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView() - } -} -
- -
Tagged with:
\ No newline at end of file diff --git a/posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab/index 2.html b/posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab/index 2.html deleted file mode 100644 index ab122f4..0000000 --- a/posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab/index 2.html +++ /dev/null @@ -1,9 +0,0 @@ -Setting up Kaggle to use with Google Colab | Navan Chauhan
🕑 1 minute read.

Setting up Kaggle to use with Google Colab

In order to be able to access Kaggle Datasets, you will need to have an account on Kaggle (which is Free)

Grabbing Our Tokens

Go to Kaggle

Click on your User Profile and Click on My Account

Scroll Down untill you see Create New API Token

This will download your token as a JSON file

Copy the File to the root folder of your Google Drive

Setting up Colab

Mounting Google Drive

import os -from google.colab import drive -drive.mount('/content/drive') -
- -

After this click on the URL in the output section, login and then paste the Auth Code

Configuring Kaggle

os.environ['KAGGLE_CONFIG_DIR'] = "/content/drive/My Drive/" -
- -

Voila! You can now download kaggel datasets

Tagged with:
\ No newline at end of file diff --git a/posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal/index 2.html b/posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal/index 2.html deleted file mode 100644 index 4f56a6d..0000000 --- a/posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal/index 2.html +++ /dev/null @@ -1 +0,0 @@ -How to setup Bluetooth on a Raspberry Pi | Navan Chauhan
🕑 0 minute read.

How to setup Bluetooth on a Raspberry Pi

This was tested on a Raspberry Pi Zero W

Enter in the Bluetooth Mode

pi@raspberrypi:~ $ bluetoothctl

[bluetooth]# agent on

[bluetooth]# default-agent

[bluetooth]# scan on

To Pair

While being in bluetooth mode

[bluetooth]# pair XX:XX:XX:XX:XX:XX

To Exit out of bluetoothctl anytime, just type exit

Tagged with:
\ No newline at end of file diff --git a/posts/hello-world/index 2.html b/posts/hello-world/index 2.html deleted file mode 100644 index e819ba1..0000000 --- a/posts/hello-world/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Hello World | Navan Chauhan
🕑 0 minute read.

Hello World

Why a Hello World post?

Just re-did the entire website using Publish (Publish by John Sundell). So, a new hello world post :)

Tagged with:
\ No newline at end of file diff --git a/posts/index 2.html b/posts/index 2.html deleted file mode 100644 index 9ac470f..0000000 --- a/posts/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Posts | Navan Chauhan

Posts

Tips, tricks and tutorials which I think might be useful.

\ No newline at end of file diff --git a/publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response/index 2.html b/publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response/index 2.html deleted file mode 100644 index aa29830..0000000 --- a/publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response/index 2.html +++ /dev/null @@ -1,7 +0,0 @@ -Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response | Navan Chauhan
🕑 1 minute read.

Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response

Based on the project showcased at Toyota Hackathon, IITD - 17/18th December 2018

Download paper here

Recommended citation:

ATP

Chauhan, N. (2019). &quot;Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response.&quot; <i>International Research Journal of Engineering and Technology (IRJET), 6(5)</i>. -
- -

BibTeX

@article{chauhan_2019, title={Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response}, volume={6}, url={https://www.irjet.net/archives/V6/i5/IRJET-V6I5318.pdf}, number={5}, journal={International Research Journal of Engineering and Technology (IRJET)}, author={Chauhan, Navan}, year={2019}} -
- -
Tagged with:
\ No newline at end of file diff --git a/tags/article/index 2.html b/tags/article/index 2.html deleted file mode 100644 index 115b617..0000000 --- a/tags/article/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with article

Browse all tags
\ No newline at end of file diff --git a/tags/article/index 3.html b/tags/article/index 3.html deleted file mode 100644 index 115b617..0000000 --- a/tags/article/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with article

Browse all tags
\ No newline at end of file diff --git a/tags/codesnippet/index 2.html b/tags/codesnippet/index 2.html deleted file mode 100644 index d47dff5..0000000 --- a/tags/codesnippet/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with code-snippet

Browse all tags
\ No newline at end of file diff --git a/tags/codesnippet/index 3.html b/tags/codesnippet/index 3.html deleted file mode 100644 index d47dff5..0000000 --- a/tags/codesnippet/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with code-snippet

Browse all tags
\ No newline at end of file diff --git a/tags/colab/index 2.html b/tags/colab/index 2.html deleted file mode 100644 index f2fcaed..0000000 --- a/tags/colab/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with colab

Browse all tags
\ No newline at end of file diff --git a/tags/colab/index 3.html b/tags/colab/index 3.html deleted file mode 100644 index f2fcaed..0000000 --- a/tags/colab/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with colab

Browse all tags
\ No newline at end of file diff --git a/tags/experiment/index 2.html b/tags/experiment/index 2.html deleted file mode 100644 index 8522460..0000000 --- a/tags/experiment/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with experiment

Browse all tags
\ No newline at end of file diff --git a/tags/experiment/index 3.html b/tags/experiment/index 3.html deleted file mode 100644 index 8522460..0000000 --- a/tags/experiment/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with experiment

Browse all tags
\ No newline at end of file diff --git a/tags/experiment/index 4.html b/tags/experiment/index 4.html deleted file mode 100644 index 8522460..0000000 --- a/tags/experiment/index 4.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with experiment

Browse all tags
\ No newline at end of file diff --git a/tags/helloworld/index 2.html b/tags/helloworld/index 2.html deleted file mode 100644 index 1d38cef..0000000 --- a/tags/helloworld/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with hello-world

Browse all tags
\ No newline at end of file diff --git a/tags/helloworld/index 3.html b/tags/helloworld/index 3.html deleted file mode 100644 index 1d38cef..0000000 --- a/tags/helloworld/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with hello-world

Browse all tags
\ No newline at end of file diff --git a/tags/kaggle/index 2.html b/tags/kaggle/index 2.html deleted file mode 100644 index ac37b96..0000000 --- a/tags/kaggle/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with kaggle

Browse all tags
\ No newline at end of file diff --git a/tags/linux/index 2.html b/tags/linux/index 2.html deleted file mode 100644 index 69572e7..0000000 --- a/tags/linux/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with linux

Browse all tags
\ No newline at end of file diff --git a/tags/linux/index 3.html b/tags/linux/index 3.html deleted file mode 100644 index 69572e7..0000000 --- a/tags/linux/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with linux

Browse all tags
\ No newline at end of file diff --git a/tags/linux/index 4.html b/tags/linux/index 4.html deleted file mode 100644 index 69572e7..0000000 --- a/tags/linux/index 4.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with linux

Browse all tags
\ No newline at end of file diff --git a/tags/publication/index 2.html b/tags/publication/index 2.html deleted file mode 100644 index 22f4c9f..0000000 --- a/tags/publication/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with publication

Browse all tags
\ No newline at end of file diff --git a/tags/raspberrypi/index 2.html b/tags/raspberrypi/index 2.html deleted file mode 100644 index 05ac496..0000000 --- a/tags/raspberrypi/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with raspberry-pi

Browse all tags
\ No newline at end of file diff --git a/tags/raspberrypi/index 3.html b/tags/raspberrypi/index 3.html deleted file mode 100644 index 05ac496..0000000 --- a/tags/raspberrypi/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with raspberry-pi

Browse all tags
\ No newline at end of file diff --git a/tags/swiftui/index 2.html b/tags/swiftui/index 2.html deleted file mode 100644 index ae2aae9..0000000 --- a/tags/swiftui/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with swiftUI

Browse all tags
\ No newline at end of file diff --git a/tags/swiftui/index 3.html b/tags/swiftui/index 3.html deleted file mode 100644 index ae2aae9..0000000 --- a/tags/swiftui/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with swiftUI

Browse all tags
\ No newline at end of file diff --git a/tags/tensorflow/index 2.html b/tags/tensorflow/index 2.html deleted file mode 100644 index aea07cc..0000000 --- a/tags/tensorflow/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with tensorflow

Browse all tags
\ No newline at end of file diff --git a/tags/tensorflow/index 3.html b/tags/tensorflow/index 3.html deleted file mode 100644 index aea07cc..0000000 --- a/tags/tensorflow/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with tensorflow

Browse all tags
\ No newline at end of file diff --git a/tags/turicreate/index 2.html b/tags/turicreate/index 2.html deleted file mode 100644 index d47d2a9..0000000 --- a/tags/turicreate/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with turicreate

Browse all tags
\ No newline at end of file diff --git a/tags/turicreate/index 3.html b/tags/turicreate/index 3.html deleted file mode 100644 index d47d2a9..0000000 --- a/tags/turicreate/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with turicreate

Browse all tags
\ No newline at end of file diff --git a/tags/tutorial/index 2.html b/tags/tutorial/index 2.html deleted file mode 100644 index e7c310a..0000000 --- a/tags/tutorial/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with tutorial

Browse all tags
\ No newline at end of file diff --git a/tags/tutorial/index 3.html b/tags/tutorial/index 3.html deleted file mode 100644 index e7c310a..0000000 --- a/tags/tutorial/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Navan Chauhan

Tagged with tutorial

Browse all tags
\ No newline at end of file diff --git a/tutorials/index/index 2.html b/tutorials/index/index 2.html deleted file mode 100644 index 3060536..0000000 --- a/tutorials/index/index 2.html +++ /dev/null @@ -1 +0,0 @@ -Tutorials | Navan Chauhan
\ No newline at end of file diff --git a/tutorials/index/index 3.html b/tutorials/index/index 3.html deleted file mode 100644 index 3060536..0000000 --- a/tutorials/index/index 3.html +++ /dev/null @@ -1 +0,0 @@ -Tutorials | Navan Chauhan
\ No newline at end of file -- cgit v1.2.3