Book Review – Machine Learning for Hackers

May 13th, 2012

Machine Learning for Hackers provides an introduction to Machine Learning and the increasingly popular statistics oriented language: R.

The book covers the basic concepts and some useful tools, including:

  • An introduction to R;
  • Basic stats and probability;
  • Supervised and unsupervised learning;
  • Linear regression and categorization;
  • Non-linear data and regularization;
  • Principal Component Analysis (PCA) and input correlation;
  • Multidimensional scaling (MDS) for clustering;
  • k-nearest neighbour (kNN) for social network analysis; and
  • SVMs for non-linear classification.

The general structure of each section is to first introduce a new concept, then demonstrate it by applying the concept to a trivial data set. Next, the technique is applied to a real data set. This structure is a great way to understand a technique.

The complete process of first massaging the data and then determining the technique to apply is covered. Occasionally the author makes a wrong turn and the analysis fails. The demonstration of failure, why it occurs and what to do about it is a great feature of the book.

The book is almost completely lacking in any of the mathematics or workings of the underlying algorithms being used, which may be considered a good or bad thing. Sometimes the book felt more like a tutorial on using R’s various machine learning packages, rather than learning about machine learning itself.

If you aren’t familiar with R or machine learning, this book presents a significant learning curve. Unfortunately, R’s syntax can be quite opaque, even to experienced programmers. Indeed, due to the heavy R component in this book, a better title may have been “Machine Learning with R”.

I’m not sure you can “hack” machine learning without properly understanding the underlying concepts, but with this book you can undoubtedly try.

The book presents a relatively quick, somewhat cursory overview of Machine Learning. It provides a good starting point for further study.

Note: This book was provided by O’Reilly Media as part of their blogger review program.

I review for the O'Reilly Blogger Review Program

Unchained Melody – the best song of all time?

March 19th, 2012

The radio station Magic recently announced the top 500 songs of all time, as voted by its listeners.

Supernifty has generated a handy visualization so you can easily see the entire list, along with the movers and shakers compared to the last time the survey was held in 2010.

There are unsurprising movers – e.g. Whitney Houston.

There are songs that should have been there all along e.g. Suspicious Minds by Elvis Presley and Hotel California by The Eagles.

Finally, there are the inexplicables – e.g. Mascara, by John Stephan (?!)

Check out which singer has the most entries, and which decade has produced the most hits.

Although the results are very much a reflection of who listens to Magic, it’s pretty fun and interesting to play with – check out Magic’s top 500 songs of all time.

Backup your Google Docs documents to Dropbox

February 5th, 2012

Supernifty is pleased to announce a new, free service that enables you to backup your Google Docs documents to Dropbox.

Google Docs to Dropbox

Nobody cares more about your own data than you. Anything that you care about should be backed up. If you have anything on Google Docs that you care about, you should be backing this up.

Although Google mostly do a fantastic job, even they occasionally lose user’s data. It’s inevitable. Hard drives fail. Things catch fire. Accounts are hacked.

Your next big novel could be lost forever.

Enter Supernifty. Supernifty’s new free service exports all your documents from Google Docs to Dropbox once a week. Simple.

Being Dropbox, once your Google Docs are on Dropbox, they will then be synced down to your local machine. And you’re safe. Safe!

If Google go offline, or you accidentally overwrite your tax return, or reveal your password to the Russian mafia, you will still have your documents, safely and securely stored on Dropbox. Easily recovered.

I recommend you give it a try.

The service is new – we are actively adding features and looking for issues. If you try it out, please let us know what you think.

Note that neither Supernifty nor this service are afiliated with either Google or Dropbox.

Book Review – iOS Sensor Apps with Arduino

February 3rd, 2012

iOS Sensor Apps with Arduino provides a concise introduction to the possibilities of interfacing Arduino with iOS.

Much of the book concentrates on the Redpark serial cable. This cable simplifies many of the headaches involved with interfacing with iOS devices.

With the Redpark serial cable, things appear to be reasonably plain sailing, with the author providing step by step instructions to building a simple application that interfaces with Arduino, takes a reading from a sensor and plots it on the iPhone.

The book includes a number of useful tips along the way that may not be obvious to the beginner, such as how to easily track the log messages generated by the Arduino.

Finally, the book covers other communication options, if you don’t want to use the Redpark serial cable. This includes:

  • Ethernet
  • Wi-Fi
  • X-Bee
  • The microphone (a la Square)
  • USB; and
  • Midi

This is a short, readable book that covers the essentials; recommended if you want to get started in this area, particularly if you intend on using the Redpark serial cable for your interfacing requirements.

Note: This book was provided by O’Reilly Media as part of their blogger review program.

I review for the O'Reilly Blogger Review Program

Late Night Creativity – Comic #5

October 3rd, 2011

Late night creativity - Supernifty Comic #5

Click to see the comic full size

Speed Scrabble Notifier for Firefox

September 28th, 2011

If you’re a Speed Scrabble player and running Firefox, then you might be interested in trying the new Speed Scrabble Extension.

The add-on helps you keep track of who is currently online so you can easily drop in for a game. Try it out!.

Speed Scrabble is a fast, fun and free online multiplayer word game. If you’ve not played it before then check it out!

If you aren’t a Firefoxer, there are similar extensions for Safari and Chrome.

If you’re a software developer interested in seeing how the extension works, the source code is freely available and can be used for any purpose.

If you have any thoughts on the new extension, feel free to get in touch!

Book Review – Supercharged JavaScript Graphics by Raffaele Cecco (O’Reilly Media)

September 18th, 2011

Supercharged JavaScript Graphics provides an introduction to a number of modern and practical JavaScript topics.

This book is well-written and easy to read, with relevant, practical examples. It covers a wide range of topics, centred around dynamic graphics and game development, including:

  • Profiling and optimization
  • DHTML Sprites
  • The Canvas element
  • Vector graphics
  • Visualizations with the Google Charts API
  • Mobile app development with JavaScript

Each topic is covered in enough detail to get you started, without getting particularly involved in too many specifics. Presumably if any topic piques your interest you can investigate further.

I found this book to be an easy read and a good introduction to a number of interesting JavaScript topics. The book is particularly relevant for game development with an excellent example of how to develop a complete game with JavaScript and jQuery.

The examples in this book are excellent – well written, well explained, and typically complete and usable. It’s obvious that Raffaele knows his craft.

The book also provides an excellent overview of the current state of JavaScript and gives you a good idea of what can currently be accomplished with a pure HTML/CSS/JavaScript solution.

The only addition I would like to see is a section with recommendations for more in-depth information. Overall though this is a good practical introduction to JavaScript graphics.

Note: This book was provided by O’Reilly Media as part of their blogger review program.

I review for the O'Reilly Blogger Review Program

Python localization made easy

September 16th, 2011

Here’s a set of simple steps to localize a Python application for different translations. This tutorial provides a clear set of steps with sample code.

Step 1: Initialize your application

Here is the code to initialize your application with localization enabled:

If you can’t see the source code try here.

This snippet looks for a resource file based on the users locale. For instance, “res/” for English. If it fails to open the appropriate translation file, it falls back to NullTranslations, which simply performs no translation.

Step 2: Prepare your application for translation

trans.install() generates a global function available to all modules in your application: _().

Find all the strings in your application that you wish to translate, and wrap them with the _() function.

i.e. “Hello” becomes _(“Hello”).

This applies to parameterized strings as well. e.g. “Hello %s” % name becomes _(“Hello %s”) % name.

Step 3: Generate the pot

That’s messages.pot.

Run the command xgettext *.py or pygettext *.py. Under Windows, you might have to look for this tool. Under the Python installation directory, try Tools/i18n.

This command looks for all strings inside the _() function, and generates the file messages.pot.

Step 4: Translate

Send your generated pot file to your translator. They will replace the empty strings with the appropriate translations and return the file to you.

Step 5: Generate the mo

Save the returned file to reflect the new language that your application has been translated to. e.g. messages_De.po

Run the command msgfmt -o res/ messages_De.po to generate the required .mo file.

As with pygettext, if your system doesn’t find this command, look in Tools/i18n under the Python installation directory.

After running this command, the translation file required by the application will be in the res directory. When you’re distributing the application, make sure the res directory goes too.

Step 6: Test

On Windows XP, you can change your locale with the following steps:

  • Start->Control Panel->Regional and Language Options;
  • Under “Regional Options”, choose the locale for the translation file you have created and click “Apply”;
  • Start the Python application;
  • (Hopefully) enjoy your translated application!

In summary…

It’s straightforward to setup localization with Python once you know how.

Helping the world through microlending

August 29th, 2011

Supernifty likes helping others out, especially those who really need it. Microlending is one way to do this.

Microlending involves lending a small amount – sometimes just a few dollars – to someone just to help get their business off the ground.

In developing countries, often this is all that is needed to get a viable business up and running. The recipient starts earning money, can pay back the loan, and can help bring their whole family out of poverty. Children can afford to go to school, get proper jobs, and the cycle of poverty is broken.

Kiva is a well-known microlender. One of Kiva’s founders gave a good explanation of how this works.

Interested? Well then, try it out.

You can lend as little as $25, and since the loan is (typically) repaid, you get to help someone out and improve our world a little – for next to nothing. Brilliant!

Visit Kiva to learn more.

JavaScript Task Queue – Hack it #9

July 17th, 2011

Suppose you have a lot of tasks with completion callbacks to complete in the browser, but you want to do them sequentially. For instance, you might have a list of AJAX requests to make to your server.

This JavaScript demonstrates a simple solution:

If you can’t see the source code, look here.