Precisely, what is precision and recall?

Precision and recall is something which comes to our mind first when we talk of information retrieval.

Whenever we develop an IR engine or tune the existing engine, we are interested to know how good our search result is or how is the improvement. This is where precision and recall comes into play.

Whenever we query the IR system, we generally retrieve the x result out of the relevant results from the total documents z in corpus. Out of these x retrieved documents some a will be relevant.

Precision can be defined as a/x and recall is a/y.

Hence, we can define precision as the fraction of retrieved instances that are relevant, while recall is the fraction of relevant instances that are retrieved.

For example, the index has 20 documents for music and 10 for movies.  A query for some music returns 10 document which as 5 music and 5 movies. Hence, the precision is 5/10= 1/2 i.e. 50% and recall is 5/20= 1/4 i.e. 25%for the query.

In a nutshell, we can say that precision is a measure of quality while recall is a measure of quantity. So, high recall means that an algorithm returned most of the relevant results and high precision means that an algorithm returned more relevant results than irrelevant.

Precision = relevant (intersect) retrieved / retrieved
Recall = relevant (intersect) retrieved / relevant


In the next blog, we will try to dive deeper into the concept.


Stemming vs Lemmatization

How is stemming and lemmatization different?

Stemming work on single word without knowledge of the subject. Stemmers are easier to implement and faster to run.

Lemma of a word changes with context and hence are difficult to implement. ‘Running’ has ‘run’ as it’s lemma as well as stem. ‘Better’ has ‘good’ as it’s lemma but not stem.

Java Best Practices

When creating a Java application, the following best practices should be considered:

  • Program to an interface, not an implementation.
  • A class should have only one reason to change.
  • Identify the code that vary and separate it from the code that remains the same.
  • No principle is a law. Principles just provide guidance. Hence should be used when and where they are helpful.
  • All designs have tradeoffs like abstraction vs speed, time vs space. Hence, all factors should be taken into account before applying them.
  • Favor composition over inheritance.
  • Classes should be open for extension but closed for modification.
  • Depend on abstraction. Do not depend on concretion.
  • Only talk to your friend.

States of Functional Design Document

Following are the states of Functional Design Document:

  1. Draft
  2. In Review
  3. Final
  4. Approved

JCP Specification Steps

The following are the essential JCP steps to become a final specification & potentially become part of the java platform:

  1. Initiation
  2. Early Draft Review
  3. Public Draft Review
  4. Maintainence

Tomcat Error on deploy / undeploy on an application

SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base <application> does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(
at org.apache.catalina.core.StandardContext.resourcesStart(
at org.apache.catalina.core.StandardContext.start(
at org.apache.catalina.core.ContainerBase.addChildInternal(
at org.apache.catalina.core.ContainerBase.addChild(
at org.apache.catalina.core.StandardHost.addChild(

Tomcat throws this error when the <application> path is hard-coded/set in the context but it doesn’t find the corresponding directory.

One possible reason can be that the application/war has been removed from the webapps directory but the context for this exist. Try removing the context from the conf at location {CATALINA_HOME}/conf/{Engine}/{Host}/<applicationname>.xml

You have an application called testapplication.war in webapps and now you replaced it with tryapp.war. This may lead to
above mentioned error.

1. Remove the {CATALINA_HOME}/conf/Catalina/localhost/testapplication.xml
2. Enjoy 🙂


Install Flex SDK in Ubuntu Linux

If you want to install FlexSDK in your Linux Ubuntu machine, below are the steps to be followed:
1. Download and unzip the file.
2. Create a directory called flex in /opt directory:
sudo mkdir /opt/flex/
3. Copy the unzipped file from temp directory to the flex directory.
cd <temp-dir>
sudo cp -r * /opt/flex
4. Check and give appropriate permissions to the files inside flex directory.
5. Set the path of FlexSDK to the path variable

  • Open .bashrc
  • Add the path of FlexSDK to the path variable.

export FLEX_HOME=/opt/flex

  • Reopen the terminal

6. Compile your flex application using the mxmlc command.