Mastering the Game of Go – slides [paper explained]

This week I presented to our weekly reading group, this work:

Silver, D., Huang, A., Maddison, C. J., Guez, A., Sifre, L., van den Driessche, G., … Hassabis, D. (2016). Mastering the game of Go with deep neural networks and tree search. Nature, 529(7587), 484–489.

To quickly summarize this work…

Basically, they create a policy network, which is a convolutional neural network, that predicts the next move a human player would do from a board state. They create a value network, also a convolutional neural network, that predicts the outcome (win or lose) of the game given the current board state.
Continue reading “Mastering the Game of Go – slides [paper explained]”

Dermofit 10-class – differences in ISBI and MLMI accuracy explained

I just got a great question asking why there is a discrepancy in the accuracy reported in our two works:

[ISBI paper, we report 81.8% accuracy over 10 classes]
Kawahara, J., BenTaieb, A., & Hamarneh, G. (2016). Deep features to classify skin lesions. In IEEE ISBI (pp. 1397–1400). Summary and slides here.

[MICCAI MLMI paper, we report 74.1% accuracy over 10 classes]
Kawahara, J., & Hamarneh, G. (2016). Multi-Resolution-Tract CNN with Hybrid Pretrained and Skin-Lesion Trained Layers. In MLMI. Summary and slides here.

We use the same Dermofit dataset, so it seems surprising the accuracy we report in the papers are different. So I thought I would elaborate on why here.
Continue reading “Dermofit 10-class – differences in ISBI and MLMI accuracy explained”

Mendeley crashes on Ubuntu laptop with NVIDIA GPU

On a Ubuntu laptop, with a NVIDIA GPU, when trying to open Mendeley, you get this rather unhelpful error:

The application Mendeley Desktop has closed unexpectedly.

I’m sure there are many causes for this error, but one unexpected reason you might get this error is related to your graphics card.

If you have a NVIDIA GPU on your laptop, try to switch to your Intel graphics card instead of NVIDIA..

To switch to your Intel graphics card, open your terminal and type:

sudo prime-select intel

Then restart Mendeley. Like magic and deep learning, it just seems to work.

(if you need to switch back to your NVIDIA card, just type sudo prime-select nvidia)

TensorFlow – failed call to cuInit: CUDA_ERROR_UNKNOWN

Scenario: You’re trying to get your GPU to work in TensorFlow on a Ubuntu Laptop. You’ve already installed Tensorflow, Cuda, and Nvidia drivers.

You run python and import TensorFlow:

import tensorflow as tf

And you see encouraging messages like: "successfully opened CUDA library locally"

But in Python, when you run,


You get this cryptic error:

failed call to cuInit: CUDA_ERROR_UNKNOWN

Here’s how to fix this.
Continue reading “TensorFlow – failed call to cuInit: CUDA_ERROR_UNKNOWN”

How to normalize vectors to unit norm in Python

There are so many ways to normalize vectors… A common preprocessing step in machine learning is to normalize a vector before passing the vector into some machine learning algorithm e.g., before training a support vector machine (SVM).

One way to normalize the vector is to apply l2-normalization to scale the vector to have a unit norm. “Unit norm” essentially means that if we squared each element in the vector, and summed them, it would equal 1.

(note this normalization is also often referred to as, unit norm or a vector of length 1 or a unit vector)

So given a matrix X, where the rows represent samples and the columns represent features of the sample, you can apply l2-normalization to normalize each row to a unit norm. This can be done easily in Python using sklearn.

Here’s how to l2-normalize vectors to a unit vector in Python

import numpy as np
from sklearn import preprocessing
# Two samples, with 3 dimensions.
# The 2 rows indicate 2 samples, 
# and the 3 columns indicate 3 features for each sample.
X = np.asarray([[-1,0,1],
                [0,1,2]], dtype=np.float) # Float is needed.
# Before-normalization.
print X
# Output,
# [[-1.  0.  1.]
#  [ 0.  1.  2.]]
# l2-normalize the samples (rows). 
X_normalized = preprocessing.normalize(X, norm='l2')
# After normalization.
print X_normalized
# Output,
# [[-0.70710678  0.          0.70710678]
#  [ 0.          0.4472136   0.89442719]]

Now what did this do?
Continue reading “How to normalize vectors to unit norm in Python”

caffe – Check failed: proto.SerializeToOstream(&output)

You suddenly get this error when training/saving a model in Caffe or saving a model in pycaffe.

io.cpp:69] Check failed: proto.SerializeToOstream(&output)
*** Check failure stack trace: ***

Here are two possible reasons for this error

  1. The directory the snapshot is trying to write the .caffemodel into does not exist
  2. You are out of disk space

Continue reading “caffe – Check failed: proto.SerializeToOstream(&output)”

An Anthropologist on Mars – Oliver Sacks – audiobook review

Title: An Anthropologist on Mars
Author: Oliver Sacks
Narrator: Jonathan Davis
Year: 1995
Tags; non-fiction; clinical; neurology;

Overall impressions

This book is in the same spirit as Dr. Sack’s earlier enjoyable book, The Man Who Mistook His Wife for a Hat. Of the two, while I preferred his earlier work, this book, An Anthropologist on Mars, is still definitely worth a read/listen. If you read only one, choose The Man Who Mistook His Wife for a Hat. If you liked that book, and you want more of the same, then this is it.
Continue reading “An Anthropologist on Mars – Oliver Sacks – audiobook review”

Recommended Audible audiobooks

I’ve written before about my affection for Audible audiobooks. Now I’m putting together a list of books that I have read, along with summaries for each.

Below I started a list of audiobooks that I read, but I decided to move to a new table format, which you can view here. I’ve left the below list for historical purposes, and recommend you check out my updated recommended book list instead.

Continue reading “Recommended Audible audiobooks”

How to upload sitemap.xml to google app engine

Ah the world wide web… the old www. So many factors to consider when developing web applications, especially if you’re used to developing in a relatively simple research environment.

One thing you will think about is how to get Google to include your page in it’s searchers (i.e., get indexed). To do this, we’ll submit a sitemap to Google. Basically a sitemap lists the links that you want Google to start indexing (so other people can find it when they search the web).

If you’re using WordPress, this is pretty simple, and you can just download a plugin and skip to the last step below (step 6).

However, if you’re using Google App Engine to run your site, then you need to do a few more steps. So here’s instructions for how to do this.
Continue reading “How to upload sitemap.xml to google app engine”

ubuntu – black screen on ubuntu laptop after installing nvidia drivers

I’m running Ubuntu on my Lenovo Y50 laptop, with a Nvidia GPU. And every time I do an update (or restart it?), I see the Ubuntu logo, hear the chime to log in, and then see a blank black screen, or a small white dot in the upper corner.

Other times, after a reboot, I get to the login screen, enter my username and password, then everything flickers violently, and it loops back to asks me to enter in my info again.

Today this post is not about how to permanently fix this (although that would be nice), but rather how to get your GUI back (until you update/restart your machine again).

It seems that on some laptops, the Nvidia drivers and Ubuntu do not always nicely play together. Why? I am not sure.

But anyways, here’s how to get fix your laptop when Ubuntu has a black screen on login (assuming your problem is related to the Nvidia drivers).
Continue reading “ubuntu – black screen on ubuntu laptop after installing nvidia drivers”