Posts

Maximizing cos(x) + cos(y) + cos(z)

Image
It's been a while since my last blog. Since it's getting closer to IEEEXtreme 12.0 I thought of sharing an algorithmic challenge I tried in one of the past competitive programming contests. I had a thought of penning down some insight into this challenge ever since I solved this. For whatever the reason (maybe for the reason I managed to solve this!) this challenge seems to be quite exciting. First of all, I must say that I am not the author of this challenge and in fact, I can't remember the place I encountered this challenge. (If you happen to know the original author please let me know so that I could give credit to him here) I even created a Hackerrank problem using this. (You can have a try, link ) First, let's take a look at the task. Find the maximum value of $\cos{x} + \cos{y} + \cos{z}$ given that $x + y + z = n$ where $x, y, z, n$ are positive integers. The input constraint was $3 \leq n \leq 3 \times 10^6$ The task description is clear and there is n...

Accuracy, F Measure (aka F1 score), precision, recall

If you have gone through machine learning or any statistics related research literature I am pretty sure that you have come across cases where something called F Measure is calculated than the accuracy in some tests. In this short blog let's clear out what is F Measure and why is it needed rather than the simple accuracy. Let's say in a binary classification task some rare incident is predicted. (Can be predicting the occurrence of a landslide given the weather conditions, landslides are rare :-P) If that rare incident only occurs for 1% of the time, a binary classification model predicting all negative (or 0) will get an accuracy of 99%. Does that make the model a good one? No! (Usually, a model having an accuracy of 99% will be dope!) Now you see there is a problem with the accuracy. The solution is to use F Measure or F1 score or F score or... Let's look at the equation for calculating F measure. \[F1 = \frac{2}{\frac{1}{Precision} + \frac{1}{Recall}}\] If yo...

Transition Based Dependency Parser

Image
Hi folks welcome to my blog! I badly wanted to make my own blog since more than three, four years but now only I'm writing my first blog. (Apparently this blog was created in 2010 but no posts since ;-) )  Anyway this blog post is for the guys who have some prior knowledge about natural language processing, and dependency parsing in particular. Let's begin! One of the key tasks in Natural Language Processing is to identify the linguistic structure of sentences. There are mainly two views of linguistic structure. One is phrase structure where the types of phrases inside the sentence is analyzed in the means of context free grammar. The other is dependency structure where the relationships between words of a sentence is analyzed in the means of dependents and their dependency types. In other words, dependency parsing simply means taking every word of the sentence and finding out what that word depends on. Figure 1 shows and example. Figure 1: Dependency between ...