2013-07-08

Clojure Data Analysis Cookbook - a Book Review

Like yogthos, I was recently asked to review Clojure Data Analysis Cookbook.  With Incanter, data analysis has been one of the "selling points" of Clojure as a practical language.  A practical lisp for practical data analysis.

(Edit 2016: a second edition is available!)

The book is very example oriented, basically being a collection of code recipes for accomplishing apparently common tasks for data analysis.  It gives you recipes to go from taking raw data in the form of CSV, JSON, or whatever, to making an Incanter dataset, to doing analysis on those datasets (e.g. clustering the data by using a self-organizing map), to saving, viewing, or charting the resultant data.  Each recipe is accompanied by brief explanations, and cross-references to other related recipes in the book.

Each recipe is more or less self-contained, without much in building on top of previous recipes.  It makes the book more "random access".  It's less a book to read through cover to cover, and more of a handy reference to use by full-text searching for key terms, clicking on the relevant topic in the table of contents, or by looking up terms in the index.  It's definitely a book I'd rather have as a PDF ebook so that I can access it anywhere in the world, and so I can do full-text search in.

Having said that, you can tell whether a book was made to be seriously used as a reference or not by looking at its index.  There are 10 pages of indices, equivalent to about 3.2% of the number of pages previous to the index.  This counts as a book to be seriously used as a reference.

As a reference book, it's great for people who have already a familiarity with Clojure (and better yet, Incanter) in general.  If you don't know Clojure, this book won't teach it to you.  If you don't know Incanter, you can pick it up from this book if you're a fast learner (don't expect a lot of hand holding in learning Incanter though).

Similarly, I'd say you had best be familiar with how to do data analysis as a discipline in itself.  If you don't know whether to do clustering or regression, or whether to use a SOM or K-means, this book won't teach it to you.

Also, as a reference book, it is not comprehensive.  For example, as far as neural networks go, it only includes self-organizing maps.  There are no other kinds mentioned.  If you want another kind of neural network, you best know where to look for another Java or Clojure library.

Even with all those caveats, I'd still say this is a pretty decent book.  Why?  Because if you have some familiarity of Clojure, played around with Incanter for a bit to learn that library, have taken a class or two of data analysis in university, and aren't expecting a lot of hand holding from the book, then this book is a great guide to start you off on the road to doing data analysis with Clojure, Incanter, Weka, OpenCL, Cascalog, etc.


2013-03-26

Passion, Fascination, and Aspiration


Getting ahead, moving up the corporate ladder, building a career, etc. — these are all legitimate, valid, and even admirable desires, if pursued for the right reasons. But where does that corporate ladder lead to? I still recall being warned by one professor, in the context of research some eleven years ago, to be careful of which totem pole to climb. Thinking on that warning some more, don't we find that all totem poles lead nowhere except to some arbitrarily higher elevation of some arbitrary spot in the ground?

And as for getting ahead: ahead of whom? And to what end? It's cliché to say that life is not a race, but if life were a race, then the end of the race would be called old age, and the prize would be death. So why would anyone want to hurtle down the race track towards that?

These questions doesn't imply that people should lead stagnant lives without goals, or without improving themselves. In fact, a person can become better by simply trying to become better all the time. What seems to become problematic is when we look for destinations, careers, and other people's lives, to not just aspire to, but to plan to achieve as a goal. I mean it seems problematic to crystallize a part of someone else's life, a life that that someone is still living, and then make it a goal to attain it.

To see what I mean by crystallization, here's two people who have careers that I'd love to have:

1) I look at someone like Peter Norvig, Director of Research at Google, and I think, "wow, I wish I could be like that. I want to be Director of Research! That must be such an awesome job — even he says it's 'the best job in the world at the best company in the world'!" Look at his resume — Division Chief at NASA, Sr. Scientist at Sun Microsystems, researcher at UC Berkeley, and was a Prof. at U of Southern California. I wonder how anyone, and especially how I, could build such a career!

2) Take a look at Chris Bishop, Distinguished Scientist at Microsoft and a Professor at the University of Edinburgh. "Wouldn't I want to be that 'when I grow up'!" He used to do research in theoretical physics too! Plus look at all the honours he's got, like being elected VP of the Royal Institution of Great Britain. How can I be successful like him?

Notice that out of these two people's lives, I've taken a very select aspect of it to crystallize into a portrait — in particular the titles, honours, and a minuscule portion of what they might be doing daily. Then I wonder how I can become that portrait.

The portraits are seductive — prestige and money! — but practically unattainable. They're like the "photoshopped" images of super models that are practically impossible for anyone to be in real life.

You could probably come up with several examples that apply more forcefully to your own life too. Any particular sports figure with fame and fortune you wish you could attain? Fancy the career of Lloyd Blankfein, the CEO of Goldman Sachs, and wish for a career that leads you to where he's at now? Want to travel the globe and be a famous travel writer like Paul Theroux? Want to be a rock star?

2012-12-30

Simple Backup sbackup doesn't run on Lubuntu 12.10

I had this problem with sbackup 0.11.4 on Lubuntu, installed as Ubuntu 12.10 with lubuntu-core package installed.  When sudo sbackup is run, even with --no-dbus or --legacy-indicator, it still gives plenty of errors and notably, the message "No desktop session found".

Strangely, scheduled backups work though.  But when I tried instead:


sudo /usr/share/sbackup/sbackup-launch


that seems to work.

The bug might be because Lubuntu doesn't have 'gnome-session' or 'x-session-manager' running.  Instead, it uses 'lxsession'.

2012-12-29

Migrating to Lubuntu - tips and fixes

If you want a fast, no frills version of Ubuntu, I suggest giving Lubuntu a try. It's Ubuntu with the LXDE desktop environment. I made the switch after installing Ubuntu 12.10 by installing lubuntu-core.

lubuntu-core doesn't install a lot of Lubuntu programs though, e.g. lxtask, so there's some fiddling to do with user settings to make the environment really usable. I'll describe some of what I did below.

I've tried migrating by installing lubuntu-desktop on another computer, which gave me all the programs associated with Lubuntu (like Abiword), but I preferred the Ubuntu set of programs — plus all the stuff I've accumulated thus far from using Ubuntu for the last few years — so I really just want the LXDE core modules. If you're installing a fresh OS, I suggest installing Lubuntu directly instead.

When using Lubuntu, you'll have to get used to not having a GUI for everything. There's some GUI system tools, but they don't always work all that well. Lubuntu is such a young OS, there's a lot of rough edges compared to Ubuntu. In fact, don't try Lubuntu unless you're running the latest (not necessarily LTS) distribution release — I encountered some problems with Ubuntu 12.04 LTS with the lubuntu-desktop package installed that were fixed with Lubuntu 12.10.

lxpanel keyboard shortcuts to the Main Menu stops working

The Main Menu contains shortcuts to lots of programs and system preferences. Usually Alt-F1 or Ctrl-Esc will activate it. But there's been a continual bug with the keyboard shortcuts when Lubuntu is installed over top of Ubuntu so that the keyboard shortcut may work once then stop working. Actually, that bug in lxpanel was fixed by Lubuntu 12.10, but a different bug took its place.

It turns out lxpanel runs in the background, and lxpanelctl controls it. But if you bring up the "Panel Settings/Preferences" window, the keyboard shortcut stops working. The keyboard shortcuts are actually bound to execute the lxpanelctl command, so it's lxpanelctl that loses control of lxpanel. Another way lxpanelctl loses control is when the "Run" window (lxpanelctl run) opens, and you type in a program name that then gets matched, then you use arrow keys to highlight one of the matches, then type escape repeatedly until the window closes. It's weird, but the fix is the same:

Kill lxpanel and restart it. I do it in the command line with a quick

killall lxpanel; lxpanel -p Lubuntu &
In fact, I have a bash alias to do that because it happens so often...

lxkeymap forgets your settings after log out

I like my caps lock changed to be another control key, and lxkeymap lets me make that setting. Oh, lxkeymap needs to be installed separately from lubuntu-core first. But why does it forget it's settings after logging out and logging back in? It's a bug in the lxkeymap package.

Per that bug report, you can fix this by creating a .desktop file with the following:

2012-10-21

How to protect your cheques in Canada

Not how to protect your cheques physically - that's up to you and your martial arts training.

I mean how to ensure your cheques are deposited to the account of your choosing.  Because even though you write on your cheques who the payee ought to be, it can be signed off to a third party to be cashed or deposited.

Other places in the world use markings to "cross" the cheque to ensure it is deposited to a bank account only, and not cashed (literally exchanged for cash).  In other places, you may write "non-negotiable" to ensure it is deposited or cashed only by the person named on the front as payee, and no one else.

But Canada and the USA does this differently.  USA should be similar (but you should check for yourself) to Canada, but the following is Canada specific:

Write "For deposit only to account of payee" on the back of the cheque to ensure that the cheque can only be deposited (not cashed) and to the named payee only (and can't be negotiated --- signed --- away to a third party) [1, 2].


[1] Added Protection when paying by Cheque --- Financial Consumer Agency of Canada
[2] Cheques - What You Need to Know --- Canadian Bankers Association