How do online ads know what we're looking for?

You are being watched - by machines that learn from your every move on the Internet.

When you look for a hotel in Jakarta online, you likely use a search engine like Google, Yahoo or Bing to find all information you need about the hotel.

However, there is nothing private when you surf the Internet. For every click you make, there is a machine that monitors what you have been up to. This machine is programmed just like a child, except this baby is tracking your activities through the Internet.

As a result, when you open your Facebook page or search for something through Google, in milliseconds, advertisements show up on the side of the page recommending something to buy related to what you were searching for.

Many ads seen online are displayed using machine learning, a type of artificial intelligence (AI) based on observations or set of data, and it learns automatically by some sort of learning algorithm until it finds a pattern.

Basically, the machine learns from what was experienced in the past to make better predictions in future.

Due to the primacy of the Internet, online advertising is increasingly important for businesses - not only because it is less expensive than digital media, but also it is more efficient and benefits the advertisers.

Ad publishers like Google and Facebook charge advertisers for ads that users view or click on. Advertisers are willing to spend a lot just to get their ads online - up to US$70 (S$90) per click - giving publishers plenty of reason to invest in machine-learning research. It is central to the multi-billion dollar online advertising industry, since about 96 per cent of Google's revenue comes from advertising.

So, how does it work with the search engines?

When a user searches for X, an initial set of candidate ads is matched to the query based on advertiser-chosen keywords. Further, there is an auction mechanism to decide whether these ads are shown to the user, what order they are shown in, and what prices the advertisers pay if their ad is clicked.

In addition, the machine also estimates the probability that the ad will be clicked if it is shown to the user. This is how the machine predicts the ad-click rates accurately, quickly and reliably.

Another method is called contextual matching, or, as it is sometimes referred to, contextual targeting. This relies on machine-learning and semantic analysis to analyse the content of a webpage before conducting an "auction" among relevant advertisers before showing ads to users.

Whether you find these ads useful or not, you normally see them as a web banner, or sometimes as text on the side of a webpage.

As with many other artificial intelligence methods, machine-learning has limitations. The drawback of machine learning is that it relies on large training dataset. If the dataset is not representative of the "problem domain", the machine will return a result that may differ from the desired one, thus, ads shown will not reflect user desires or the content of a webpage.

Machine-learning is not perfect: Computers still have difficulties in handling noise, for example. While some algorithms have special provisions to prevent this; in other cases, machines may ignore possible important features of the problem.

Despite the drawbacks, machine-learning algorithms are one of the top research topics among scientists and engineers working on a host of issues, such as helping doctors to interpreting medical images as well as helping researchers to craft designer pharmaceuticals.

Further, machine-learning techniques are currently used in areas of engineering and technology such as automobile navigation systems, social network analysis, noise-cancelling headsets and red-eye reduction in cameras.

The techniques also have potential applications in finance, such in predicting financial distress, predicting stock performance or even making investment decisions.

Thus, you should not be worried if you are being watched. The more you surf, the more you teach the machine to understand people and to make it become smarter.