Book Review- Machine Learning for Hackers

This is review of the fashionably named book Machine Learning for Hackers by Drew Conway and John Myles White (O’Reilly ). The book is about hacking code in R.


The preface introduces the reader to the authors conception of what machine learning and hacking is all about. If the name of the book was machine learning for business analytsts or data miners, I am sure the content would have been unchanged though the popularity (and ambiguity) of the word hacker can often substitute for its usefulness. Indeed the many wise and learned Professors of statistics departments through out the civilized world would be mildly surprised and bemused by their day to day activities as hacking or teaching hackers. The book follows a case study and example based approach and uses the GGPLOT2 package within R programming almost to the point of ignoring any other native graphics system based in R. It can be quite useful for the aspiring reader who wishes to understand and join the booming market for skilled talent in statistical computing.

Chapter 1 has a very useful set of functions for data cleansing and formatting. It walks you through the basics of formatting based on dates and conditions, missing value and outlier treatment and using ggplot package in R for graphical analysis. The case study used is an Infochimps dataset with 60,000 recordings of UFO sightings. The case study is lucid, and done at a extremely helpful pace illustrating the powerful and flexible nature of R functions that can be used for data cleansing.The chapter mentions text editors and IDEs but fails to list them in a tabular format, while listing several other tables like Packages used in the book. It also jumps straight from installation instructions to functions in R without getting into the various kinds of data types within R or specifying where these can be referenced from. It thus assumes a higher level of basic programming understanding for the reader than the average R book.

Chapter 2 discusses data exploration, and has a very clear set of diagrams that explain the various data summary operations that are performed routinely. This is an innovative approach and will help students or newcomers to the field of data analysis. It introduces the reader to type determination functions, as well different kinds of encoding. The introduction to creating functions is quite elegant and simple , and numerical summary methods are explained adequately. While the chapter explains data exploration with the help of various histogram options in ggplot2 , it fails to create a more generic framework for data exploration or rules to assist the reader in visual data exploration in non standard data situations. While the examples are very helpful for a reader , there needs to be slightly more depth to step out of the example and into a framework for visual data exploration (or references for the same). A couple of case studies however elaborately explained cannot do justice to the vast field of data exploration and especially visual data exploration.

Chapter 3 discussed binary classification for the specific purpose for spam filtering using a dataset from SpamAssassin. It introduces the reader to the naïve Bayes classifier and the principles of text mining suing the tm package in R. Some of the example codes could have been better commented for easier readability in the book. Overall it is quite a easy tutorial for creating a naïve Bayes classifier even for beginners.

Chapter 4 discusses the issues in importance ranking and creating recommendation systems specifically in the case of ordering email messages into important and not important. It introduces the useful grepl, gsub, strsplit, strptime ,difftime and strtrim functions for parsing data. The chapter further introduces the reader to the concept of log (and affine) transformations in a lucid and clear way that can help even beginners learn this powerful transformation concept. Again the coding within this chapter is sparsely commented which can cause difficulties to people not used to learn reams of code. ( it may have been part of the code attached with the book, but I am reading an electronic book and I did not find an easy way to go back and forth between the code and the book). The readability of the chapters would be further enhanced by the use of flow charts explaining the path and process followed than overtly verbose textual descriptions running into multiple pages. The chapters are quite clearly written, but a helpful visual summary can help in both revising the concepts and elucidate the approach taken further.A suggestion for the authors could be to compile the list of useful functions they introduce in this book as a sort of reference card (or Ref Card) for R Hackers or atleast have a chapter wise summary of functions, datasets and packages used.

Chapter 5 discusses linear regression , and it is a surprising and not very good explanation of regression theory in the introduction to regression. However the chapter makes up in practical example what it oversimplifies in theory. The chapter on regression is not the finest chapter written in this otherwise excellent book. Part of this is because of relative lack of organization- correlation is explained after linear regression is explained. Once again the lack of a function summary and a process flow diagram hinders readability and a separate section on regression metrics that help make a regression result good or not so good could be a welcome addition. Functions introduced include lm.

Chapter 6 showcases Generalized Additive Model (GAM) and Polynomial Regression, including an introduction to singularity and of over-fitting. Functions included in this chapter are transform, and poly while the package glmnet is also used here. The chapter also introduces the reader formally to the concept of cross validation (though examples of cross validation had been introduced in earlier chapters) and regularization. Logistic regression is also introduced at the end in this chapter.

Chapter 7 is about optimization. It describes error metric in a very easy to understand way. It creates a grid by using nested loops for various values of intercept and slope of a regression equation and computing the sum of square of errors. It then describes the optim function in detail including how it works and it’s various parameters. It introduces the curve function. The chapter then describes ridge regression including definition and hyperparameter lamda. The use of optim function to optimize the error in regression is useful learning for the aspiring hacker. Lastly it describes a case study of breaking codes using the simplistic Caesar cipher, a lexical database and the Metropolis method. Functions introduced in this chapter include .Machine$double.eps .

Chapter 8 deals with Principal Component Analysis and unsupervised learning. It uses the ymd function from lubridate package to convert string to date objects, and the cast function from reshape package to further manipulate the structure of data. Using the princomp functions enables PCA in R.The case study creates a stock market index and compares the results with the Dow Jones index.

Chapter 9 deals with Multidimensional Scaling as well as clustering US senators on the basis of similarity in voting records on legislation .It showcases matrix multiplication using %*% and also the dist function to compute distance matrix.

Chapter 10 has the subject of K Nearest Neighbors for recommendation systems. Packages used include class ,reshape and and functions used include cor, function and log. It also demonstrates creating a custom kNN function for calculating Euclidean distance between center of centroids and data. The case study used is the R package recommendation contest on Kaggle. Overall a simplistic introduction to creating a recommendation system using K nearest neighbors, without getting into any of the prepackaged packages within R that deal with association analysis , clustering or recommendation systems.

Chapter 11 introduces the reader to social network analysis (and elements of graph theory) using the example of Erdos Number as an interesting example of social networks of mathematicians. The example of Social Graph API by Google for hacking are quite new and intriguing (though a bit obsolete by changes, and should be rectified in either the errata or next edition) . However there exists packages within R that should be atleast referenced or used within this chapter (like TwitteR package that use the Twitter API and ROauth package for other social networks). Packages used within this chapter include Rcurl, RJSONIO, and igraph packages of R and functions used include rbind and ifelse. It also introduces the reader to the advanced software Gephi. The last example is to build a recommendation engine for whom to follow in Twitter using R.

Chapter 12 is about model comparison and introduces the concept of Support Vector Machines. It uses the package e1071 and shows the svm function. It also introduces the concept of tuning hyper parameters within default algorithms . A small problem in understanding the concepts is the misalignment of diagram pages with the relevant code. It lastly concludes with using mean square error as a method for comparing models built with different algorithms.


Overall the book is a welcome addition in the library of books based on R programming language, and the refreshing nature of the flow of material and the practicality of it’s case studies make this a recommended addition to both academic and corporate business analysts trying to derive insights by hacking lots of heterogeneous data.

Have a look for yourself at-

R Graphs Resources

Relevant GUI-

GrapheR and Deducer


Graphics by Examples

. UCLA: Academic Technology Services,  Statistical Consulting Group. from (accessed Feb 10, 2011)


Graph Gallery

Frank McCown

Detailed Tutorial

Advanced Data Visualization

Hadley Wickham


and Package-


OK Cupid Data Visualization- Flow Chart to your Heart

Quite appropriate on a V Day, OK Cupid remains quite innovative how they use data (in this questionnaire data)

Viva Libre Office

WordPerfect 5.1 for DOS.
Image via Wikipedia

The Document Foundation is happy to announce the release candidate of
LibreOffice 3.3.1. This release candidate is the first in a series of
frequent bugfix releases on top of our LibreOffice 3.3 product. Please
be aware that LibreOffice 3.3.1 RC1 is not yet ready for production
use, you should continue to use LibreOffice for that.

Following is the list of changes against LibreOffice 3.3:

Key changes at a glance:

* Numerous translation updates
* new mimetype icons for LibreOffice – explained here:
* quite a few crasher fixes

Detailed change log:

* translation updates
* Removed old/unmaintained icon themes
* Fix for Don’t
use a reference or the default formula string will be changed
* Install bash completion for oo* wrappers when enabled
* Build fix: get the stlport compat workaround working for gcc 4.6.0
* Build fix: no ddraw.h or ddraw.lib in the June 2010 DirectX SDK,
removed usage
* Windows installer: padded nologobanner.bmp, new size is 102×58
* removed gd – Gaelic, ky – Kirghiz, pap – Papiamento, ti – Tigrinya,
ms – Malay, ps – Pashto, ur – Urdu. UI localization does not exist
in these languages. So it makes no sense to ship packages.
* Build fix: pass thru PYTHON, found by configure. Will be used by
* Upgraded libwpd (WordPerfect filter) to 0.9.1
* Fixed BrOffice Windows start menu branding
* Removed language code ‘kid’. kid is not Koshin, but key id pseudo
language which is good for debugging UI but should no be included
in the product
* Added ca_XV and ast language/local name and description
* Fixed incorrect page number in page preview mode
( When the
window is large enough to show several ‘Page X’ strings,
the page number was not properly incremented.
* Fixed incorrect import of cell attributes from Excel
documents. When a cell with non-default formatting attribute starts
with non-first row in a column, the filter would incorrectly apply
the same format to all the cells above it if they didn’t have any
* Ubuntu: fix for lp#696527 – enable human icon theme in LibreOffice
* Fix for crash on
changing position of drawing object in header.
* Changed to LibreOffice in nsplugin
* Added Occitan dictionary
* Added Ukrainian dictionaries
* Fix window focus for langpack installation on Mac –
* Added/modified NLPsolver translations from Pootle
* Fix for
* Fix for RTF export crasher
* Use LibreOffice as product name for EPS Creator header
* Parse svg ‘color’ property (fixes
* Use double instead of float in writerfilter import
* Build fix: use PYTHON as passed through by
* Fix for remove
debug line
* Fix for – fixes
ole object import for writer (docx)
* Fix for
rename OOo -> LibO on Getting Support Page
* Fix ooxml import: handle css::table::BorderLine in addition to
css::table::BorderLine2 That means that table cell properties are
correctly set on import again.
* Fix for
wikihelp: Improve the check for existence of the localized help.
* Fix for – fixes
several crashes around config UNO API
* Fix for
* Fix for
Implementation names weren’t matching with xcu.
* Fix: don’t pushback and process a corrupt extension
* Fix: wikihelp – do not check for existence of the localized
help. In case we do not have the help installed, it is up to the
online service to decide the fallback in case a language version is
not available.
* Fix README: change su urpmi to sudo urpmi for Mandriva section
* Fix README formatting – – using CRLF
instead of LF on WIN platform
* Fix README: word wrap at column 75 for better readability
* Build fix: KDE3 library search order
instead of STDLIBS.
* Start using technical.dic instead of oracle.dic
* Build fix: add explicit QRegion* for clipRegion to fix compile of
kde backend
* Cleanup: removed obsolete m_bSingleAltPress
* Remove the menu when Left Alt Key was pressed for GTK
* Fix for use
year of era in long format for zh_TW by default
* Fix wrong collation for Catalan language
* Fix for wrong
line break with “(”
* Fix for – crash
when iterating over the database types.
* Default currency for Estonia should be Euro – fixes
* Avoid a pointless GetHelpText() call in the toolbox. Fixes GetHelpText()
can be quite heavy, see
* Paint toolbar handle positioned properly
* Build fix: move cxxabi.h after stl headers to workaround gcc 4.6.0
and stlport
* Fix for
manipulate also the C runtime’s environment
* Fix for CTL/Other Default Font #i25247#, #i25561#, #i48064#,
* RTF export crasher
* Fixed an infinite loop in RTF exporter
* UI: translations need more space on word count dialog, made space
for it.
* Fix for improve
formfield checkbox binary export (and import)

Again a BIG Thank You!

Again whats Libre Office

What does LibreOffice give you?

Writer is the word processor inside LibreOffice. Use it for everything, from dashing off a quick letter to producing an entire book with tables of contents, embedded illustrations, bibliographies and diagrams. The while-you-type auto-completion, auto-formatting and automatic spelling checking make difficult tasks easy (but are easy to disable if you prefer). Writer is powerful enough to tackle desktop publishing tasks such as creating multi-column newsletters and brochures. The only limit is your imagination.

Calc tames your numbers and helps with difficult decisions when you’re weighing the alternatives. Analyze your data with Calc and then use it to present your final output. Charts and analysis tools help bring transparency to your conclusions. A fully-integrated help system makes easier work of entering complex formulas. Add data from external databases such as SQL or Oracle, then sort and filter them to produce statistical analyses. Use the graphing functions to display large number of 2D and 3D graphics from 13 categories, including line, area, bar, pie, X-Y, and net – with the dozens of variations available, you’re sure to find one that suits your project.

Impress is the fastest and easiest way to create effective multimedia presentations. Stunning animation and sensational special effects help you convince your audience. Create presentations that look even more professional than the standard presentations you commonly see at work. Get your collegues’ and bosses’ attention by creating something a little bit different.

Draw lets you build diagrams and sketches from scratch. A picture is worth a thousand words, so why not try something simple with box and line diagrams? Or else go further and easily build dynamic 3D illustrations and special effects. It’s as simple or as powerful as you want it to be.

Base is the database front-end of the LibreOffice suite. With Base, you can seamlessly integrate your existing database structures into the other components of LibreOffice, or create an interface to use and administer your data as a stand-alone application. You can use imported and linked tables and queries from MySQL, PostgreSQL or Microsoft Access and many other data sources, or design your own with Base, to build powerful front-ends with sophisticated forms, reports and views. Support is built-in or easily addable for a very wide range of database products, notably the standardly-provided HSQL, MySQL, Adabas D, Microsoft Access and PostgreSQL.

Math is a simple equation editor that lets you lay-out and display your mathematical, chemical, electrical or scientific equations quickly in standard written notation. Even the most-complex calculations can be understandable when displayed correctly. E=mc2.

LibreOffice also comes configured with a PDF file creator, meaning you can distribute documents that you’re sure can be opened and read by users of almost any computing device or operating system.

Download LibreOffice now and try it out today.


SAS announcement in education initiatives

From the Research Triangle, some pleasant and positive news-

“As a high tech company, SAS depends on a strong educational system for its long-term success,” said SAS CEO Jim Goodnight. “Beyond that, STEM education – developing skills for a knowledge economy – is critical to American competitiveness. Without emphasis on STEM, we sacrifice innovation and export our knowledge jobs to other countries.”

Goodnight and SAS have been active in education for years. The SAS co-founder and his wife, Ann Goodnight, launched college prep school Cary Academy in 1996, and the SAS inSchool program has developed educational software for schools since the mid-1990s. In 2008, Jim Goodnight made SAS Curriculum Pathways available free to all U.S. educators. The web-based service provides content in English, mathematics, social studies, science and Spanish.

SAS is the only Triangle-based company among the Change the Equation corporate partners, but the group includes several other companies with a significant Raleigh-Durham presence: chief among them IBM (NYSE: IBM), GlaxoSmithKline (NYSE: GSK), and Cisco Systems (Nasdaq: CSCO).

Read the full article at


Read more: SAS joins IBM, GlaxoSmithKline, Cisco Systems in Obama education effort – Triangle Business Journal