1
$\begingroup$

I am a newbie in ML world, but very curious and enthusiastic about it. Have gone through articles and some hands-on too. Still got a silly doubt.

In sample datasets (like Iris or diabetes or breast cancer etc.) and exercises, I find the data to be well-formed and ready to be digested by ML model (algos). But, in reality, it is much more than that.

For example, Amazon's feature of suggesting (cross-selling) products. Based on my previous searches and orders, it probably would be looking into several features and predicting further items. I'm curious -

  1. How does it work in real time?
  2. How my product searches (they are not numbers) are fed into the ML model under-the-hood?

Please share your thoughts.

Regards, RB (using Python 3.6 & latest-1 versions of NumPy, Scikit and Pandas)

$\endgroup$
4
$\begingroup$

OK, first regarding the real time part.

Machine learning (particularly supervised learning) has two parts

  1. Training
  2. Predicting

Training is a complex and slooooow process, you need to figure out a good model, then train it with the correct data... not simple and computationally expensive.

Predicting however is MUCH simpler, as normally consist (in the world of neural networks) of a simple forward pass in the neural network, and a forward pass is, at its core, a bunch of matrix multiplications. So once a model has been built and train, predicting something using the existing model is quite quick, also one can retrain the model with new data too.

Now, regarding with the text searches and how to deal with them. There is a very cool idea called word embeddings, it simply consist on transforming words into vectors. Imagine a 2d grid (like the x,y coordinates we studied in school), now imagine that the vertical axis (y) denotes how powerful something is, the hifher the y value, the more powerful it is. And now imagine that the x axis denotes the gender of something. (lets assume negative x means male and positive x means female).

And now thing of the word : King. King is male (x=Negative value) and powerful (y=Positive value). With those two coordinates, and starting from position 0,0 you could have a vector.

Now think of Queen, in this case the coordinates will be x=Positive value and y=Positive value, now you have another vector.

And now think of the word Spartacus (he was a slave in ancient rome), so that word will have x=Negative and y=Negative.

Think of this, suddenly not only you can represent the words as numbers, you can also represent them with vectors, which allows you to possibly figure out that King and Emperor are both SIMILAR words.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for your response. I know about the workings you mentioned above. It's good to train and predict using PyCharm or some IDE from my machine using sample data sets. I wanted to understand how the training and prediction happens in a real time application. How does a web application get and feed the data in ML model ? $\endgroup$ – ranit.b Jan 14 '19 at 23:29
  • $\begingroup$ Well, a web could capture your behaviour and encode it in the form of vectors and then using, for example, a REST api send such information to a server that ultimately runs a model and then the output is returned by the rest service. Notice that the output is tipycally small (for example a list of products you might be interested in). $\endgroup$ – Juan Antonio Gomez Moriano Jan 14 '19 at 23:51
  • $\begingroup$ Thanks. Now I got the idea. So, it is the web services which under-the-hood send my searches/clicks/likings to the server where a ML model is run and the prediction(s) are again sent back to the front end application. Cool :) $\endgroup$ – ranit.b Jan 15 '19 at 0:18
  • $\begingroup$ Yep, that's what seems to be a sensible approach :) $\endgroup$ – Juan Antonio Gomez Moriano Jan 15 '19 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.