Posts

Jaccard Similarity vs Cosine Similarity

https://datascience.stackexchange.com/questions/5121/applications-and-differences-for-jaccard-similarity-and-cosine-similarity Jaccard Similarity is given by  s i j = p p + q + r s i j = p p + q + r where, p = # of attributes positive for both objects q = # of attributes 1 for i and 0 for j r = # of attributes 0 for i and 1 for j  Whereas, cosine similarity =  A ⋅ B ‖ A ‖ ‖ B ‖ A ⋅ B ‖ A ‖ ‖ B ‖  where A and B are object vectors. Simply put, in cosine similarity, the number of common attributes is divided by the total number of possible attributes. Whereas in Jaccard Similarity, the number of common attributes is divided by the number of attributes that exists in at least one of the two objects. And there are many other measures of similarity, each with its own eccentricities. When deciding which one to use, try to think of a few representative cases and work out which index would give the most usable results to achieve your objective. The Cosine inde...

The Black Magic of Deep Learning - Tips and Tricks for the practitioner

via: https://nmarkou.blogspot.co.uk/2017/02/the-black-magic-of-deep-learning-tips.html I've been using Deep Learning and Deep Belief Networks since 2013. I was involved in a green field project and I was in charge of deciding the core Machine Learning algorithms to be used in a computer vision platform. Nothing worked good enough and if it did it wouldn't generalize, required fiddling all the time and when introduced to similar datasets it wouldn't converge. I was lost. I then caught wind from Academia, the new hype of Deep Learning was here and it would solve everything. I was skeptical, so I read the papers, the books and the notes. I then went and put to work everything I learned.  Suprisingly, it was no hype, Deep Learning works and it works well. However it is such a new concept (even though the foundations were laid in the 70's) that a lot of anecdotal tricks and tips started coming out on how to make the most of it (Alex Krizhevsky covered a lot of them ...

TensorFlow: saving/restoring and mixing multiple models

Image
Via: https://blog.metaflow.fr/tensorflow-saving-restoring-and-mixing-multiple-models-c4c94d5d7125 TensorFlow: saving/restoring and mixing multiple models Before going any further, make sure you read the  very small primer i made on Tensorflow here Why start with those informations? Because, it is of tremendous importance to understand what can be saved at the different level of your code to avoid messing around cluelessly… How to actually save and load something The saver object Any interactions with your filesystem to have persistent data through different sessions can be handled with the  Saver  object. The constructor allows you to control 3 things: The  target : This is used in case of a distributed architecture to handle computation. You can specify which TF server or ‘target’ you want to compute on. The  graph:  the graph you want the  Session  to handle. The tricky things here for beginners, is the fact tha...

TensorFlow, Save and Load a model in a serious way, from different files

via: https://kevincodeidea.wordpress.com/2016/08/02/tensorflow-save-and-load-a-model-in-a-serious-way-from-different-files/ It has been a long time since my last post. Recently I am working in a group developing a deep, online, traceable, better-than-current-method neural network. After carefully comparing theano and tensorflow, we decide to use the latter. The main reason is actually not technical, we simply “predict” tensorflow will have a bright future and will be better maintained. Back to the topic. Since it is an online algorithm, one important requirement is that one has to be able to save the model (not just some script-like operations, but also meta data, trained weights and the whole structure) to the disk and should be able to load the whole thing without a problem. The way I construct a model can be simplified as this: A basic model class contains all the tensorflow variables, in this application, the weights for each layer Several training functions that  cons...