Precision and recall explained for 5-year old

In algorithms of binary classification I usually meet the terms “precision” and “recall.” I had a really hard time understanding their meaning on a basic level. In other words, how would I explain them to a five year-old? I finally found these definitions:

  1. Precision is how often our algorithm predicts class one and turns out to be right.
  2. Recall is how many objects of class one the algorithm has found at all.

Continue reading

Simplest Slack bot of yours

robot-character In our team at legelisten.no we had HipChat as a main way of communication before. But recently we’ve migrated to Slack and do not feel regret.

One thing I feel missing there was Standup Bot which we used to write and read each other standup messages during the day.

Functions of this standup bot were deadly simple: it can save your message and it can show you all messages from all team members for today.

So long story short, I decided to make the same bot for slack. I’ve seen some alternatives, but they seemed too complicated for such simple issue.

I made my own Ruby (Sinatra) + MongoDB – based bot.

How to make the simplest Slack bot?

  1. Choose outgoing webhooks instead of slask app. You can read about this hooks here: https://api.slack.com/outgoing-webhooks
  2. Create simple sinatra app with one route for POST.
  3. Point your webhook to that route you just created.
  4. Do whatever you want with data you have from Slack.
  5. Respond with simple JSON like {text: “your bot’s answer here”}
  6. PROFIT!

You can have a look to my slask bot here: https://github.com/kiote/standup-bot

Does Naive Bayes Belive in a Big Foot?

There is a quite interesting, widely-using and powerful theorem in a probability theory: Bayes’ theorem. In AI this theorem are used for “Naive Bayes classifier” algorithm.

Why this theorem is interesting? Because in many cases of machine-learning it could give you good result and it’s really simple to implement this algorithm. For example, with Naive Bayes help many spam-filtering systems are working.

Why the hell it’s “naive”? Continue reading

Google Trends API + Golang

Google trends is a really nice stuff, when you try to compare what is more popular: cola or pepsi, whiskey or soda?

So I wondered, is it have any API. With a bit of googling I found they have some kind of.. unofficial though. With special formed query anybody can obtain javascript-ready string with whole data: example.

Not so friendly as before, huh? But it’s still something.

With zero knowledge of golang, and with only help of online documentation to this great language (so I pretty sure you can do better!), I’ve created this command-line tool.

You can run it with two paramethers and have the “rating” of first and second as an answer.

That was pretty much just go-practice.