I wrote a post on how to let Python work with C last week. However, at the finalising stage, I wrangled with the format of the post so that the codes are easy to read with as much the effort as I wrote the article, and without much luck. Hence I postponed the post. Until today, I stumbled across some other guys tutorial, where the codes look very pretty. An inspection with Safari shows that the code is rendered by a WordPress plugin called Cryon Syntax Highlighter. As this can become handy if it is to use WordPress to manage miscellaneous technological knowledge, so the code prettifier deserves a standalone post.
As long as you can install it, which is only a few clicks away, there is not too much to say about its usage. Let’s see an example in Python:
May be a helpful suggestion is that as within a browser, your
<tab> will be explained as to jump over the page-elements, it might be a good idea to edit the code outside the blog post in, say, vim. Then paste into the Crayon’s code formatter.
Another trick is the inline tags. I am lazy and want to stay with the good old
<code> tag. But this requires enabling the option of “capture <code> as inlineTag” in the settings of Crayon PlugIn. A final note, if your code contains example of the code-tag itself, it is wise to delegate the job to Crayon, just inspect the source code of this page to see why.
A little background: Theano is a symbolic computation library which makes writing neural network models very easy. It is python-based, requires a range of dependent libraries, including numpy, scipy among others (I didn’t work through the labyrinth of all the dependencies as I always failed 🙂 ).
If you are as lazy as I am, but want to enjoy the enriched environment and resources by the freeware community, i.e. python here, perhaps the all-inclusive python packages like Anaconda or Enthought provided by those very good people is our choice.
Recently I turned to Enthought to Anaconda for no other reason but the latter is more dummy-proof, since make links are hard, and you don’t need to fiddle with your LD_LIBRARY_PATH, DYLIB_ etc. etc., only to find yourself breaking dependencies of some other program.
However, Anaconda does have a problem with its BLAS library. Fresh installation works well with Theano, but without BLAS. If you install the ATLAS library, Theano will throw out a complain about missing “_gfortran_st_write_done” (likely google this and theano lead you here), when you try to build functions involving nodes of operation such as tanh() function. This is probably because ATLAS does not contain that particular function. Google it returns back some confusing ask-answer sessions. The above explanation is my best guess.
So my solution is simple and brutal. I did “conda remove atlas”. Things went back to the slow and happy status. A sensible step forward would be install OpenBLAS and let conda use it. Will try and see …