Archive for the ‘Python’ Category

Few Python base Deep Learning Libs

June 23, 2015 Leave a comment

Lasagne: light weighted Theano extension, Theano can be used explicitly

Keras: is a minimalist, highly modular neural network library in the spirit of Torch, written in Python, that uses Theano under the hood for fast tensor manipulation on GPU and CPU. It was developed with a focus on enabling fast experimentation.

Pylean2: wrapper for Theano, yaml, experimental oriented.

Caffe: CNN oriented deep learning framework using c++, with python wrapper, easy model definitions using prototxt.

Theano: general gpu math

nolearn: a probably even simpler one

you can find more here.

For Lasagne and nolearn, they are still in the rapid develop stage, so they changes a lot. Be careful with the versions installed, they need to match each other. If you are having problems such as “cost must be a scalar”, you can refer link here to solve it by uninstall and reinstall them.

pip uninstall Lasagne
pip uninstall nolearn
pip install -r

Installing Mercurial on Mac

May 29, 2014 Leave a comment
$ brew install mercurial

If you see errors like:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

you can disable the ‘warning’ (which is now showing as error ) by:

$ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future \ 
brew install mercurial

Again, after the install successed, if you see linking error:

Error: Could not symlink file: /usr/local/Cellar/mercurial/2.9/share/man/man5/hgrc.5
/usr/local/share/man/man5 is not writable. You should change its permissions.

You can change the permission. It is said to be safe to change the permission for the whole /usr/local. If you don’t want to do so, just do it for this case

$ sudo chown -R 'your-user-name' /usr/local/share/man/man5
 $ brew link mercurial
Categories: Python, Software

A Book on text processing in Python

December 10, 2012 Leave a comment
Categories: NLP, Python

paw detection

July 11, 2012 Leave a comment

really really Awesome post. — A paw detection using Python ndimage.

Categories: Image Processing, Python

Random Forest in Python

June 21, 2012 Leave a comment

milk is the machine learning package written in python. It also comes with a complimentary data set called milksets which includes several U.C.I machine learning dataset.

from milksets import wine

features,labels = wine.load()
features will be a 2d-numpy.ndarray of features (noSample * noFeatureDim) and labels will be a 1d-numpy.ndarray of labels starting at 0 through N-1 (independently of how the labels were coded in the original data).

Below is an example using milk -random forest to predict the labels for the wine data. Three classes, feature is a (178L, 13L) np-matrix.  Sample with maker ‘0’ is the correct predictions, with maker ‘x’ is the incorrect prediction. It takes some time to do the prediction, the cross-validation accuracy = 0.943820224719.

Categories: Machine Learning, Python

Select and Crop Region of the Figure in Python

June 13, 2012 Leave a comment

I wanted to be able to select and crop some region of the figures in python interactively. Here’s some ways that I found quite useful. You could modify the code and adapt to your need.


And superisingly, matplot has the same function of ginput just as in matlab.

Categories: Python


May 18, 2012 Leave a comment

It seems that python-graph is a nice tool. To install it, I used
the easy install.

My desktop is Win7 with Git, so install easy_install using:

$ curl -O
$ python

I found that my Git actually can not local where the easy_install is. So
simply way: find by your self. You may find a application file “easy_install.exe”
within your python folder. Then use:

$/c/Python27/Script/easy_install python-graph-core
$/c/Python27/Script/easy_install python-graph-dot

Then, you done 🙂

Categories: Python