Saturday, December 28, 2013

Twitter Sentiment Analysis-2 : Dhoom3 Movie

Analyzing positive and negative sentiments of people towards newly released Amir Khan, Abhishek Bacchan and Katerina Kaif starer ‘DHOOM3’ movie.

To analyze public sentiment we have used Twitter as our test bed. The movie released on 20th December therefore we take the 20th December to 28th December as our analysis window.
We used the Twitter API with Python interface to extract public tweets with a list of key word –
Dhoom3, #Dhoom3, @Dhoom3TheMovie, Dhoom:3

We have trained a Naïve Bayes classifier over 18 negative sentiment tweets and 18 positive sentiment tweets. This classifier is then used to classify above mentioned tweets into positive and negative sentiment tweets.


20 Dec 2013 - 28 Dec 2013

  1. Twitter is used by relatively smaller population compared to facebook and therefore extracts the view of this group.
  2. The analysis only used tweets in English language. Hindi and local languages haven’t been analyzed.
  3. Analysis of tweets is also limited by query terms used by us which only 4 terms found by us through manual tweet observations.
  4. Due to multiple tags used for search there are a few duplicate tweets that can be both positive or negative.
  5. Some of the tweets are related to money collection of the movie which are classified as positive.
  6. This is a binary classification and therefore many neutral tweets may be classified in either positive or negative.

Twitter Sentiment Analysis-1 : AAP

Analyzing positive and negative sentiments of people towards newly emerged Aam Admi Party and Arvind Kejariwal before Oath Ceremony on 28th December 2013.

To analyze public sentiment we have used Twitter as our test bed. On 8th December 2013 the results were announced and BJP emerged as single biggest party in the state with 32 seats however the party refused to form a government. Congress with its 8 MLAs gave an external support to AAP claiming to prevent Delhi from a fresh election. AAP was forced to form a Govt from both main stream parties on moral grounds. AAP announced to form government after 10 days of public referendum and public meetings and finally 6 MLAs took oath on 28th Dec 2013 forming new government in Delhi. We used the Twitter API with Python interface to extract public tweets with a list of key word –
Aam admi party, AAP, Kejariwal, @AamAadmiParty, #AAP, #MyCMKejriwal, Kejriwal, @ArvindKejriwal, #Aap

We have trained a Naïve Bayes classifier over 22 negative sentiment tweets and 22 positive sentiment tweets. This classifier is then used to classify above mentioned tweets into positive and negative sentiment tweets.


21 Dec 2013 - 28 Dec 2013


  1. Twitter is mostly used by high class, urban, celebrities and journalist communities and there the tweets collected are not a very accurate measure of social sentiment towards AAP. However it is a good starting point to evaluate social media sentiment towards AAP.
  2. The analysis only used tweets in English language. Hindi and local languages haven’t been analyzed.
  3.  Analysis of tweets is also limited by query terms used by us which only 9 terms found by us through manual tweet observations. 
  4. Because of multiple Tags used for tweet filtering there are a few cases of duplicate tweets which can be both in positive and negative side and hasn't been analysed.
  5. It is a binary classification with Positive and Negative classes. However, in practice some of the tweets may lie as neutral too.

Monday, September 23, 2013

Latest Trends in Brain Research

Human Brain has always been a mystery for both biologists and neuro-engineers. How did it evolve and how it functions is a major focus for many active scientists. With the advent of high computing efficiency and storage capacity combined with recent development in EEG and fMRI technologies interesting results are coming out. US has launched a new brain research initiative and is funding heavily in this field.  

Researchers at MIT have been successful in manipulating memories in Mice’s brain and are furthering in incepting false memories in brain. This focus can lead to a situation screened in Transformer movie where a person who doesn’t know a particular skill can download a skill from internet directly to his brain just like today we download apps for out smart phone.

In Kyoto, Japan scientists have been successful in correlating fMRI scans with person’s dreams and now can claim with 60% accuracy what the dream was about. This accuracy further increases to 70% for a few selected items.

In University of Pennsylvania, one experiment was conducted where a bunch of school students were divided into three groups and presented with a set of objects. They were then asked to write down the uncommon use of these objects. One particular group was given slight electric stimulation on left prefrontal cortex which is supposed to act as a cognitive filter, other group on the right pre-frontal cortex and the third group was given a placebo on left pre-frontal cortex. It was found that the group of students which received the shock on left pre-frontal cortex missed only 8 out of 60 objects while the other two groups missed 15 out of 60. This group was also to come up with the answers on an average of 1 second faster than the other two groups which is a big margin of time in psychological research. It is hypothised that high level of cognitive control is detrimental in coming up with uncommon and creative ideas.

In University of Minnesota, Twin cities scientists have come up with an EEG technique through which they are able to differentiate between different brain imageries (e.g. closed fist, arm etc) and use this to control a quadrotor. The researchers are also working on a bi-directional Brain Computer Interface (BCI).

Prof. Rajesh Rao along with his group has already developed the first Brain to Brain computer interface where he plays a computer game and the neural activities of his brain recorded by EEG device is sent over internet to remote laboratory on the campus where his colleague receives the magnetic stimulation through TMS and he clicks on a keyboard unwillingly.

NASA has formed a dedicated group in this field named ‘Extension of Human Senses’ and is working progressively in this area.

The progress so far in this field is inspiring and promises great advancements in future. It is not long in future where physically impaired people will use such technologies to become cyborgs or MARS rovers will be directly controlled from Earth by a trained person. 


Reading dreams – NIICT, Kyoto, Japan

Incepting False memories in the brain - MIT

Suppressing cognitive filters in Brain- University of Pennsylvania

Brain as controller to Drone – University of Minnesota

Bi-directional Brain interfacing – University of Minnesota

Brain to Brain Interface – University of Washington, Seattle

Extension of Human Senses - NASA

Monday, September 2, 2013

Running scripts on ubuntu startup

When we work on embedded systems it is often required to run certain programs/scripts on OS boot. For example, while I was working on viSparsh (a haptic belt for the visually impaired), the belt boots Ubuntu and it needs to power Kinect and start retrieving data. It shall simultaneously process the data and find the potential obstacles and notify user with intensity varied stereo-vibrations.

Ubuntu has a concept of runlevels where you can set up your preference for a script for the level in which you want it to execute. Below are the ways of executing scripts on either startup or shutdown-

To execute a script upon rebooting Ubuntu

  • Put your script in /etc/init.d and then create softlinnks to any of the run level
  • ln -s /etc/init.d/autorunScript /etc/rc2.d/S99autorunScript command will create a softlink of autorunScript in runlevel 2 with a execution priority of 99. SXX denotes Startup and with priority XX (where 01 < XX < 99).  
  • Make sure the script autorunScript is executable (sudo chmod +x autorunScript)
  • Note: The scripts in this directory are executed in alphabetical order

To execute a script at startup of Ubuntu

  • Edit /etc/rc.local and add your commands
  • The script must always end with exit 0
  • The scripts/commands in this file are executed after all the runlevels

To execute a script at shutdown

  • Put your script in /etc/init.d
  • ln -s /etc/init.d/autorunScript /etc/rc6.d/K98autorunScript command will create a softlink of autorunScript in runlevel 6 with a execution priority of 98. KXX denotes Shutdown and with priority XX (where 01 < XX < 99).  
  • Create softlink of your script in /etc/rc6.d
  • Make it executable (sudo chmod +x myscript)
  • Note: The scripts in this directory are executed in alphabetical order

It is often very convenient to write your commands directly into /etc/rc.local and if you are executing any scripts put those scripts into /home folder to avoid execution permission issues. In case there are multiple scripts to be run make them background process if it is not a UI application. To run a script as a background process simply put an ampersand (&) at the end of the command.

Saturday, August 17, 2013

Ambient Backscatter

Two days back while I was just browsing through my facebook wall I suddenly stuck at a post. One of my friends shared a post titled "Ambient backscatter promises battery-free communications". It was indeed a catchy title and I couldn't restrain myself to read it further. The post referred to an invention made by researchers in University of Washington. 

They developed an RFID like device which works without battery. It is a credit card size sensor which utilizes the RF signals present in the ambiance due to TV and cellular transmissions. Remember the early cellphone covers in which LEDs used to glow before an incoming call? The principle is similar. But this technology, as researchers claim, is different from RFID in three ways-
1. It uses ambient RF signals so doesn't require a power/battery infrastructure.
2. Very low environmental footprint as it doesn't add to existing power consumption and RF-pollution
3. It provides a device to device communication unlike RFID which deploys a Transmitter-Reader approach.

Before understanding how the system works let's understand a very ancient mode of communication Centuries before even Electromagnetic waves were discovered. Primitive man used fire and than drum-sound to convey messages. A little further in time mirrors came to practice where sunlight was reflected to signal a particular message or alert for war. It was a 1-bit communication in modern sense. Now think of continuous pattern of reflections and non-reflections with time delays producing morse code. That could be an advanced version of the same technology. But going further for multiple reflection is not easy to decode by eyes. Optical fibers in essence to the same but using trans-receivers. 

Researchers demonstrate how one payment card can transfer funds to another card by leveraging the existing wireless signals around them. Ambient RF signals are both the power source and the communication medium  

Now, let's head back to back-scattering. The system uses exactly the same technique for ubiquitous RF signals. A device's antenna can either reflect or not-reflect the TV signals it receives creating '1' and '0' bits. The receiver receives an additional path of the TV signal other than the original paths it captured and receives the packet sent by transmitter. The researchers have developed a networking stack over this basic technique so that multiple devices can coexist.

Although the technology is in its primitive stage it can be extremely useful in space missions, sensor networks, multi-robot collaboration, touchless payments, ID cards and eventually replacing NFC.

Sunday, August 11, 2013

Augmented & Immersive Media (AIM)

As a kid I grew up experimenting with my toys and household electronics devices. I was curious and amazed by the variety of devices I used to see around me. As I grew older I started playing with wires and circuits without even knowing how they internally work but that didn't stop me to use them in a way I wanted them to work. The real exploration began when I entered into college and realized that whatever I learned as a kid was on the blackboards with more sophisticated terminologies and mathematical equations. I just started loving those lectures. I would ask questions to understand how things worked in a particular way and what if I make some change. My first hand experience with circuits clearly quadrupled my rate of learning. In next few years I used my knowledge in several projects related to natural user interfaces, embedded systems, robotics, artificial intelligence, natural language processing and communication systems. In recent few years I developed further interest in pervasive computing, cognitive interfaces, assistive technologies,cyber physical systems, machine learning, augmented reality and bio-robotics.

Now it all comes to a point where I find myself surrounded by so many terms that when someone asks me about my interests I find it difficult to put forward a single term. I research on web to find a term as broad as my interests yet so specific and meaningful. Someone suggests Interactive Design and another says Human Computer Interaction and yet another proposes Immersive Technologies but none of them was an exhaustive term. Therefore, I tried coming up with my own term - 'Augmented and Immersive Media'. By which I mean everything which is augmented over and immersed into the most basic setting and has some trans-formative and futuristic value. In this process my purpose is not to toss another term into the existing flood but to find a safer companion.

Thursday, August 8, 2013

The mystery of time and its mythological traces

I am an avid reader and love to read science fictions, science journals and biographies of greatest researchers of all times. Recently, I came across a book ‘The Elegant Universe’ by Brian Greene which is a technical collections of theories around superstrings, hidden dimensions, time travel and theory of relativity.

For me, Einstein’s theory of relativity always had a pull which intrigued me to try understanding this non-intuitive phenomena. The theory claims that when a person is in motion, the time he observes runs slower than everyone stationary. So, if a person can move at 667miles per hour, which is 99.6% of speed of light time in his part of the world would be 10 times slower. That means if life expectancy of this person is 70 years that would correspond to 700 years in his motion frame.

This is quite interesting because I like travelling and if I am in motion then my body clock will tick slower and hence I would live longer. Seriously! But there is a catch. Because my body clock is moving slower, all my activities would also slow down as if I am in a slow motion world. I won’t be able to observe this but stationary world will. Now comes the crazy thought, is it possible to reverse this effect? That is can everything else than me slow down and I can observe this all. Think about the sitcom Heros where a person gets ability to slow down and eventually pause the time. But technically that means everything other than me has to move extremely fast. That seems counter intuitive because if they are moving at near light speed how can they be in slow motion?

But the craziest thing is that it really happens. They will be moving extremely fast in speed but at the same time very slow in time and that’s where our common sense of space-time left us entangles. The person in motion is very fast in space but slow in time and therefore he is analogous to planet Venus which is very fast in revolving around sun but at the same time very slow in revolving around its own axis. It takes 224.7 earth days to take one full spin.

The important thing to notice is that after slowing down the time a person can live longer than others but as he himself gets slowed down his life experience for 700 years would be exactly same as if it was 70 years. This reminds me of a story of King Muchukunda. According to Hindu mythology, Muchukunda was born in the family of Iksvaku whose descendants include Lord Ram too. He was a great warrior and when, in a battle, the deities were defeated by the demons, they sought help from king Muchukunda. King Muchukunda agreed to help them and fought against the demons for a long time. Since the deities did not have an able commander, king Muchukunda protected them against the demonic onslaught, until the deities got an able commander like Kartikeya, the son of Lord Shiva. Then Indra, King of deties, said to the king Muchukunda, "O king, we, the deities are indebted to you for the help and protection which you have given us, by sacrificing your own family life. Here in the heaven, one year equals three hundred and sixty years of the earth. Since, it has been a long time, there is no sign of your kingdom and family because it has been destroyed with the passage of time. We are happy and pleased with you, so ask for any boon except Moksha (liberation) because Moksha is beyond our capacities".

Muchkunda asks Indra for a boon to sleep. While fighting on the side of the deities, king Muchukunda did not get an opportunity to sleep even for a moment. Now, since his responsibilities were over, overcome by tiredness, he was feeling very sleepy. So, he said, "O King of the deities, I want to sleep. Anyone who dares to disturb my sleep should get burnt to ashes immediately". Indra said, "So be it, go to the earth and enjoy your sleep, one who awakens you would be reduced to ashes". After this, king Muchukunda descended to earth and selected a cave, where he could sleep without being disturbed.

Centuries later Lord Krishna was battling with Kalyavan. Kalyavan had a boon to never get defeated in a battle and therefore Krishna had to run and hide in the same cave. Kalyavan chased Krishna and in a fit of anger and unable to see in the dark attacked Muchukunda mistaking him to be Krishna. When Muchkunda opens his eyes, his gaze falls on Kalayavan who is immediately burnt to ashes.

This simple mythological story explains the same theory proposed thousands of years later by Einstein. Interestingly, Einstein himself was a big believer of Hindu mythology and claimed that Srimadbhagwatgeeta is the most scientific religious book he has ever read. The mythological story remains just an anecdote but it gives some inklings to a great treasure of scientific knowledge which we have always ignored.   

Monday, August 5, 2013

Logistic Population Growth and Neural Activation

The population of most of the species follow an exponential growth in an open and infinitely expandable environment. However, in practice this assumption won't hold good. If we consider an isolated environment with limited resource that would better represent the typical environmental condition in nature. Till the point these resources are in excess to the total consumption of the specie population there would be an exponential growth as if the system had infinite resources but when the total consumption of resources by the specie population reaches near the total resources available there is a competition for survival which begins within the ecosystem. 
A typical ecosystem will contain multiple species competing for the resources and therefore this exponential growth is curtailed by the food availability, competition for mating, disease, predation and other such factors. More the competition for the resources, lesser the growth and eventually it slows down to zero as population reaches its carrying capacity (K) for that particular environment. The result of such a growth is an 'S' shaped population growth curve. This phenomenon is known as Logistic Growth and the curve representing this is known as Logistic Curve. Below is the differential equation representing logistic curve-

Solving this equation gives us -

The same model can be used to explain the effect of advertisement and word of mouth influence in technology diffusion, spread of disease or saturation of market sales. 

Interesting insights:
The solution to the differential equation representing logistic growth is very similar to Sigmoid function used extensively in mathematics and machine learning. In neural networks sigmoid function is used to emulate the neural signal activation inside the brain. The neurons use both mechanical and ionic mechanism on their dendrites (input) to produce electric signals which are propagated on axons (output). These electric activations are similar to sigmoid function applied on the resultant of dendrite signals. This gives a small inkling that our neurons might also follow logistic growth model in signal propagation.

Saturday, March 30, 2013

Hough Transform


The Hough Transform (named after Paul Hough) is a feature extraction technique which is widely used in Digital Image Processing and related fields. 

Where to use

In automated analysis of digital images, a subproblem often arises of detecting simple shapes, such as straight lines, circles or ellipses. In many cases an edge detector can be used as a pre-processing stage to obtain image points or image pixels that are on the desired curve in the image space. Due to imperfections in either the image data or the edge detector, however, there may be missing points or pixels on the desired curves as well as spatial deviations between the ideal line/circle/ellipse and the noisy edge points as they are obtained from the edge detector. For these reasons, it is often non-trivial to group the extracted edge features to an appropriate set of lines, circles or ellipses. The purpose of the Hough transform is to address this problem by making it possible to perform groupings of edge points into object candidates by performing an explicit voting procedure over a set of parameterized image objects.  

How it works

Hough Transform uses a voting procedure. This voting procedure is carried out in a parameter space, from which object candidates are obtained as local maxima in a so-called accumulator space that is explicitly constructed by the algorithm for computing the Hough transform.