You might read this book Programming Collective Intelligence
] which will take you to the right direction. In addition to this you might need to do bit more research on Collective Intelligence, Data Mining, Machine Learning, Non-Negative Matrix Factorization and some Unsupervised machine learning algorithm and please refresh your math specially Bayes Law in Probability.
All the best :)
Note: The book I mention is written in Python.
Based on your interest I would recommend you to read research paper of
Sergey Brin and Lawrence Page of Google The Anatomy of a Large-Scale Hypertextual Web Search Engine