Useful linux commands

Bash To process a file line-by-line while read i; do something-with-$i; done < filename To insert a character literally into a command first hit “Ctrl-v” followed by the character (For example Ctrl-v will insert a literal tab character) Dealing with...

Useful python snippets

A quick handy reference to some python snippets Find path to a package or module import os print os.path.dirname(packagename.__file__) List all modules inside a package import pkgutils import os [name for _, name, _ in...

KDD 2016 Notes

Workshop Day: 14 August 2016 Missed the keynote as the earliest BART reached Powell St by 8:45. Wanted to attend the whole of the time-series workshop but there were other interesting things that had my attention. Nevertheless, anyone interested in time-series...

NVidia GTX 1080 installation on Ubuntu 16.04 LTS

I have spent too many hours trying to figure this out, so here it is. Come, find out how to install the latest NVidia drivers to get your NVidia GPU working on Ubuntu 16.04 LTS. These steps work for GTX 1080.

What are the different ways of decomposing a matrix?

* Eigen-decomposition: If $latex \mathbf{v}$ is a vector such that left (or right) multiplication with a matrix $latex \mathbf{A}$ results in only scaling $latex \mathbf{v}$ by a scalar $latex \lambda$, i.e. $latex \mathbf{A}\mathbf{v} = \lambda\mathbf{v}$ then $latex...

What are the types of Matrices and Vectors?

* Square matrix: If the matrix has same number of columns as rows * Symmetric matrix: A square matrix that is equal to its transpose. $latex \mathbf{A} = \mathbf{A}^T * Diagonal matrix: A matrix where all non-diagonal entriesĀ  are zero $latex $\mathbf{A}_{i,j} = 0,...

How to plot multicolored lines in matplotlib?

Often times, we need to overlay colors on segments of a time-series or other line-plot. The colors could be indicative of some events or to highly particularly important time-spans of interest. Here’s a short function that can be used to generate such line...

Threshold tuning using ROC

Several statistical and machine learning applications call for setting thresholds. For example, if you are presenting search results and wish to display short-listed results. Most document retrieval methods will generate a score per document and one way of showing the...