{"id":362,"date":"2014-12-19T19:49:11","date_gmt":"2014-12-19T19:49:11","guid":{"rendered":"http:\/\/www.nicassio.it\/daniele\/blog\/?p=362"},"modified":"2014-12-19T19:49:11","modified_gmt":"2014-12-19T19:49:11","slug":"naive-bayes-classifier-in-js-empowering-telegram-webapp","status":"publish","type":"post","link":"http:\/\/www.nicassio.it\/daniele\/blog\/?p=362","title":{"rendered":"Naive Bayes Classifier in JS, empowering telegram webapp"},"content":{"rendered":"<p>Today I made a simple implementation of a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Naive_Bayes_classifier\" target=\"_blank\">naive bayes classifier<\/a>\u00a0in Javascript. The implementation was largely inspired by <a href=\"http:\/\/burakkanber.com\/blog\/machine-learning-naive-bayes-1\/\" target=\"_blank\">this article<\/a>.<\/p>\n<p>After that, I spent some time to integrate it with <a href=\"https:\/\/github.com\/zhukov\/webogram\" target=\"_blank\">this Telegram webapp<\/a>, and now I have a telegram webapp in which you can mark messages as &#8216;spam&#8217; or &#8216;important&#8217;, and every message is then classified giving some confidence about the possibility of it of being part of these categories.<\/p>\n<p>It saves the results to the chrome local storage, so that you can train the classifier over time, preserving the results beetween sessions.<\/p>\n<p>When I will train it enough, and if the results are\u00a0good, I&#8217;m looking forward to implement the auto-hiding of messages based on this data. This is intended for large telegram group chats, in which often off-topic messages will just make painful extracting important messages from the enormous amount of things people texted. How many times you look at\u00a0your preferred messaging app and you find ~50 unread messages? This is meant to resolve this, even if the bayes classifier is not perfect for this task, it was easy\u00a0to implement and usually gets good results. I&#8217;ll update here if\u00a0I have encouraging\u00a0result from this test.<\/p>\n<p>Meanwhile, here&#8217;s a screenshot:<\/p>\n<p><a href=\"http:\/\/www.nicassio.it\/daniele\/blog\/wp-content\/uploads\/2014\/12\/telegrambayesscreenshot.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-363\" src=\"http:\/\/www.nicassio.it\/daniele\/blog\/wp-content\/uploads\/2014\/12\/telegrambayesscreenshot.png\" alt=\"telegrambayesscreenshot\" width=\"558\" height=\"534\" srcset=\"http:\/\/www.nicassio.it\/daniele\/blog\/wp-content\/uploads\/2014\/12\/telegrambayesscreenshot.png 558w, http:\/\/www.nicassio.it\/daniele\/blog\/wp-content\/uploads\/2014\/12\/telegrambayesscreenshot-300x287.png 300w\" sizes=\"(max-width: 558px) 100vw, 558px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I made a simple implementation of a naive bayes classifier\u00a0in Javascript. The implementation was largely inspired by this article. After that, I spent some time to integrate it with this Telegram webapp, and now I have a telegram webapp in which you can mark messages as &#8216;spam&#8217; or &#8216;important&#8217;, and every message is then &hellip; <a href=\"http:\/\/www.nicassio.it\/daniele\/blog\/?p=362\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Naive Bayes Classifier in JS, empowering telegram webapp<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[38,13,5,7,39,12],"tags":[],"_links":{"self":[{"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=\/wp\/v2\/posts\/362"}],"collection":[{"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=362"}],"version-history":[{"count":1,"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=\/wp\/v2\/posts\/362\/revisions"}],"predecessor-version":[{"id":364,"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=\/wp\/v2\/posts\/362\/revisions\/364"}],"wp:attachment":[{"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=362"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nicassio.it\/daniele\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}