Machine Learning for Hackers – Analyzing & displaying data using R – #bookreview #in #programming

Machine Learning for Hackers
By Drew Conway and John Myles White
(O’Reilly,
paperback, list price $39.99; Kindle edition, list price $31.99)

The word “hacker has a very bad reputation in many parts of the computer world.

This book’s two authors, however, offer a different and much more positive view. “Far from the stylized depictions of nefarious teenagers or Gibsonian cyber-punks portrayed in pop culture, “they write, “we believe a hacker is someone who likes to solve problems and experiment with new technologies.”

In their view: “If you’ve ever sat down with the latest O’Reilly book on a new computer language and knuckled out coded until you were well past ‘Hello, World,’ then you’re a hacker. “ You’re also a hacker, in their view, “if you’ve dismantled a new gadget until you understood the entire machinery’s architecture….”

As for machine learning, they define it “[a]t the highest level of abstraction…as a set of tools and methods that attempt to infer patterns and extract insight from a record of the observable world.” In more concrete terms, machine learning “blends concepts and techniques from many different traditional fields, such as mathematics, statistics, and computer science.” At the computer programming level, machine learning is defined as “a toolkit of algorithms that enables computers to train themselves to automate useful tasks.”

Conway’s and White’s new book, Machine Learning for Hackers, is rich with challenges for experienced programmers who love to crunch data. Its code examples use the R programming language, a “software environment for statistical computing and graphics.” It can be downloaded free for Windows, MacOS, or a variety of UNIX platforms from The R Project for Statistical Computing.

What you don’t get in this book is an R language tutorial. Instead of “Hello, World!” in the introductory chapter, you jump straight into working with a very interesting data set and generating histograms dealing with distributions of UFO sightings.

It is assumed that you have done some programming, and the authors note that you can find basic R tutorials online or in other books.

With a case-studies approach, each chapter of the 303-page book focuses on a particular problem in machine learning, and the authors show how to analyze sample databases and create simple machine learning algorithms.

The chapters are:

  1. Using R
  2. Data Exploration
  3. Classification: Spam Filtering
  4. Ranking: Priority Inbox
  5. Regression: Predicting Page Views
  6. Regularization: Text Regression
  7. Optimization: Breaking Codes
  8. PCA [principal components analysis]: Building a Market Index
  9. MDS [multidimensional scaling]: Visually Exploring US Senator Similarity
  10. kNN [The k-Nearest Neighbors algorithm]: Recommended Systems
  11. Analyzing Social Graphs
  12. Model Comparison

Some of the other projects the authors present include: using linear progression to predict the number of page views for 1,000 top websites; doing statistical comparisons and contrasts of U.S. Senators based on their voting records; and building “a ‘who to follow’ recommendation engine” for Twitter that doesn’t violate Twitter’s terms of service or its API’s “strict rate limit.”

Conway and White offer some fairly heady and challenging learning experiences for those who would like to work with pattern recognition algorithms and big piles of data.

“The notion of observing data, learning from it, and then automating some process of recognition is at the heart of machine learning,” the authors note, “forms the primary arc of this book.”

#

Si Dunn is a novelist, screenwriter, freelance book reviewer, and former software technical writer and software/hardware QA test specialist. He also is a former newspaper and magazine photojournalist. His latest book is Dark Signals, a Vietnam War memoir. He is the author of an e-book detective novel, Erwin’s Law, now also available in paperback, plus a novella, Jump, and several other books and short stories.

 

Mac Attack! Three new books for Macintosh users – #bookreview

No Starch Press and O’Reilly Media recently have released three new books aimed at Macintosh users.

One is for Mac newcomers. Another is for those who want to learn a lot more about the Mac OS X Lion operating system without having to read “tersely written” Apple help screens. And the third is for programmers who want “to build native Mac OS X applications with a sleek, developer-friendly  alternative to Objective-C….”

Taking it easy first…

Doing ‘Simple Projects’ with a Mac

My New Mac Lion Edition: Simple Projects to Get You Started
By Wallace Wang
(No Starch Press, paperback, list price $29.95 ; Kindle edition, list price $9.99)

If you are computer newbie or switching over from Windows or other operating systems, here is a good book to help you put your new Mac to work in a hurry.

My New Mac Lion Edition shows how to do practical stuff such as connecting to the Web, playing and burning CDs and DVDs, pulling digital photos off your camera so you can edit and share them, and working with the Mac’s security features.

Given today’s risky Internet and office computing environment, it might have been better to describe the security features much earlier in the book, well before the working-online chapters. But as a practical guide to learning and using the Mac’s key features, this 472-page how-to guide is written well and has plenty of illustrations and clear lists of steps. It even describes several ways to eject a stuck CD or DVD.

The 56 chapters are grouped into seven parts:

  • Part 1: Basic Training – Everything from using the mouse to opening apps.
  • Part 2: Wrangling Files and Folders – Finding files, storing files, sharing files.
  • Part 3: Making Life Easier – Shortcut commands, controls, updating software, saving and retrieving contact information, using appointment calendar, and typing in foreign languages.
  • Part 4: Playing Music and Movies – Playing audio CDs, ripping and burning audio CDs, playing a DVD, listening to online programs and free college lectures, and editing videos with iMovie.
  • Part 5: The Digital Shutterbug – Transferring, editing and displaying digital photographs.
  • Part 6: Surfing and Sharing on the Internet – Numerous things web and email, plus instant messaging with iChat.
  • Part 7: Maintaining Your Mac – Energy conservation, ejecting stuck CDs/DVDs, password protecting  your Mac, encrypting your data, and configuring your firewall.

The author, Wallace Wang, has written several best-selling computer books. He’s also an ongoing career as a standup comic.

More IS Better: What to Do with 50+ Programs and 250 New Features

Mac OS X Lion: The Missing Manual
By David Pogue
(O’Reilly, paperback, list price $34.99)

David Pogue created the popular Missing Manual series, and the New York Times technology columnist definitely knows how to put together a good how-to book.

His 909-page Mac OS X Lion: The Missing Manual is exactly what you need to become (over time and with diligent effort, of course) a Mac power user. It’s also what you need if you’d rather settle for being a well-informed user who likes having a handy source  for looking up information about a Mac feature or program.

In this book, you begin well beneath the “Hello, World!” level by learning to say “oh-ess-ten,” not “oh-ess-ex.” Once you master that, you get to move into “The New Lion Landscape,” where you are informed that “Apple’s overarching design philosophy in creating Mac OS X was: ‘Make it more like an iPad.'”

Then, you quickly learn how to use “Full Screen Mode, Safari” and “Full Screen Apps, Mission Control.” And, by the way, you are still officially in Chapter 0 at this point (that’s “zero,” not “oh”).

Pogue’s book is smoothly written. (You don’t, after all, just luck into writing for the Times.) It has a good array of screenshots and other illustrations. And it offers plenty of tips and notes amid the instructional paragraphs.

The book’s six parts (with seven chapters each) are focused as follows:

  • Part 1: The Mac OS X Desktop – “[C]overs everything you see on the screen when you turn on a Mac OS X computer….”
  • Part 2: Programs in Mac OS X – Describes “how to launch them, switch among them, swap data between them, use them to create and open files, and control them using the AppleScript and Automator automation tools.”
  • Part 3: The Components of Mac OS X – “[A]n item-by-item discussion of the individual software nuggets that make up this operating system–the 29 panels of System Preferences and the 50-some programs in your Applications and Utilities folders.”
  • Part 4: The Technologies of Mac OS X – “Networking, file sharing, and screen sharing…” plus “fonts, printing, graphics, handwriting recognition…sound, speech, movies…” and even some looks at how to use “Mac OS X’s Unix underpinnings.”
  • Part 5: Mac OS X Online – “[C]overs all of the Internet features of Mac OS X.” Everything from email to chatting to working in the cloud, and even “connecting to, and controlling, your Mac from across the wires — FTP, SSH, VPN, and so on.”
  • Part 6: Appendixes – These include a Windows-to-Mac dictionary (for Windows refugees), information on installing Mac OS X, troubleshooting information, and “a thorough master list of all the keyboard shortcuts and trackpad/mouse gestures in Lion.”

If you’re serious about using your Mac and weary of opening endless not-so-helpful help screens, you should seriously consider owning this book.

A Programmer’s Guide to MacRuby

MacRuby: The Definitive Guide
By Matt Aimonetti
(O’Reilly, paperback, list price $39.99; Kindle edition, list price $31.99)

“MacRuby,” the author says, “is Apple’s implementation of the Ruby programming language on top of the Objective-C technology stack.”

His book is a straightforward, no-nonsense guide intended to show developers how “to write native applications for the Cocoa environment using the popular Ruby syntax as well as the well-known and robust Objective-C and C libraries.”

He declares his work “neither a Ruby book nor a Cocoa book,” but states that “it should provide you with enough information to understand the MacRuby environment and create rich applications for the OS X platform.”

MacRuby: The Definitive Guide is segmented into two major parts. Part 1 (“MacRuby Overview”) introduces MacRuby, including what it is, how it’s installed, how it works, what you can do with it, and how it relates to what you already probably know. Part 2 (titled “MacRuby in Practice”)  “covers concrete examples of applications you might want to develop in MacRuby.”

Using short, concise code examples, Matt Aimonetti helps the reader dive straight into MacRuby, beginning at the classic “Hello, World!” entry point, with a little twist.

In just 35 lines of code, you learn how to build a graphical user interface (GUI) application that displays the words “MacRuby: The Definitive Guide” in a window with a button. The window shows “Hello World!” within a box, and your computer speaks “Hello, world!” when you click on the button.

The first eight chapters focus on topics such as: introduction, fundamentals, foundation, application kit, Xcode, core data, and getting deeper into the process of “developing complex apps.”

The topics of the final five chapters are: (1) creating an Address Book example; (2) creating an application that “uses the user’s geographical location and a location web service”; (3) using MacRuby in Objective-C projects; (4) using Objective-C code in MacRuby apps; and (5) using Ruby third-party libraries. 

Before reading this book and tackling the code, the author recommends having some programming experience and basic familiarity with object-oriented programming. You also should get a basic overview of the Ruby language by visiting its main website.

Si Dunn 

Head First HTML5 Programming – #javascript #html5 #programming #bookreview

Head First HTML5 Programming: Building Web Apps with JavaScript
By Eric Freeman and Elisabeth Robson
(O’Reilly, list price $49.99, paperback)

This is not your father’s turgid programming textbook.

Indeed, even if you are not interested whatsoever in messing around with JavaScript and learning how to be an HTML5 programmer, you may still enjoy reading this book and studying how it is put together.

Head First HTML5 Programming is a fun and entertaining mixture of graphics, text and coding examples. But, more than that, this “multi-sensory learning experience” has been put together “[u]sing the latest research in cognitive science and learning theory….”

How often have you heard someone say a computer programming book is “fun and entertaining”?

Yes, Head First HTML5 Programming is still a how-to book, and it is one that focuses on creating web apps using JavaScript — not exactly a fertile field for comedy.

But the book promises “to start by going from zero to HTML5 in 3.8 pages (flat)” — and delivers. By the third page, you begin using a whimsical “HTML5-O-Matic” to update standard HTML to HTML5. And by the bottom of the fourth page, you are “officially certified to upgrade any HTML to HTML5.”  (It takes just three steps and a bonus round to get there, by the way.)

Even the book’s table of contents is zany, amusing and informative, with funny graphics and snarky summaries of what you will find in each chapter and appendix. 

And don’t be intimidated by this book’s physical size. It has 574 pages, but it presents information in small, manageable chunks, surrounded by eye-pleasing white space and lots of illustrations that will make you grin or chuckle even as you learn something new.

By the way, you don’t have to know JavaScript to use this book. The first few chapters provide  an excellent and palatable JavaScript overview.

However, if you think you are serious about becoming an HTML5 programmer but don’t yet have any experience in  HTML markup and CSS  (cascading style sheets), the two writers recommend that you tackle one other book first: Head First HTML with CSS & XHTML (list price, $39.99 paperback. There is also a Kindle edition.)  

Whether you know HTML, CSS and JavaScript or not, however, you should plan on doing the book’s exercises. Cutting “class” is not an option with this book. “Some of (the exercises) are to help with memory, some are for understanding, and some will help you apply what you’ve learned,” the writers point out.

They add: “Most reference books don’t have retention and recall as a goal, but this book is about learning, so you’ll see some of the same concepts come up more than once.”

The software and hardware requirements for writing HTML5 and JavaScript code are minimal: “[Y]ou need a text editor, a browser, and, sometimes, a web server (it can be locally hosted on your personal desktop).”

They recommend that you use more than one browser while learning HTML5 and JavaScript. And, to use some HTML5 features and JavaScript APIs, you will have to “serve files from a real web server rather than loading a file….” But they explain how to do this.

Head First HTML5 Programming advertises that it will promises to help “load HTML5 and JavaScript straight into your brain,” and it seems to start doing that right after you open its pages — as long as you keep an open mind about using a programming book that is actually enjoyable and fun to read while it instructs.

Si Dunn

Revolution in the Valley: How the Mac Was Made (2nd Revised Edition) – #bookreview #macintosh

Revolution in the Valley: The Insanely Great Story of How the Mac Was Made
By Andy Hertzfeld
(O’Reilly Media, list price $24.99, paperback)

My wife swears by her Mac. I, however, just swear at it when I am forced to use it.

I have been using anything-but-Apple computers since the early 1980s, starting with a Sinclair ZX80 and moving up through a ragged assortment of Trash-80s, Osbornes,  Kaypros, PC-XTs, PC-ATs, and PCs that run Windows 7.

During a short semi-career in specialized hardware and software development, I tested programs that ran exclusively on machines running Windows. So I have that bias.

Nonetheless, Andy Hertzfeld’s book, Revolution in the Valley: The Insanely Great Story of How the Mac Was Made, is fascinating and entertaining reading, even for those of us who have avoided Apple computers and sometimes still bristle at the smug, superior attitudes exhibited by many Macintosh users. (Don’t tell my wife I said that.)

Hertzfeld was one of the main authors of the Macintosh system software, including the User Interface Toolbox and many of the Mac’s original desk accessories. He later joined Google and is one of the primary creators of Google +.

Originally published in 2004, Revolution in the Valley recently has been brought back into print again by O’Reilly Media as a second revised edition.

The book is drawn mainly from Hertzfeld’s adventures, misadventures, reflections and perspectives. But it is not All Hertzfeld All the Time. Refreshingly, it also includes stories written by “other key original Mac team members”—Steve Capps, Donn Denman, Bruce Horn and Susan Kare.

Their stories recount the chaotically creative and frequently high-pressured race to design and deliver “an easy-to-use, low-cost, consumer-oriented computer…featuring a revolutionary graphical user interface (GUI).”

Hertzfeld and his co-contributors focus on “the development of the original Macintosh computer, from its inception in the summer of 1979, through its triumphant introduction in January 1984, until May 31, 1985, when Steve Jobs was forced off the Macintosh team.

Revolution in the Valley is divided into five parts and follows a somewhat chronological path. However, it makes frequent and refreshing use of short anecdotes that are easy and enjoyable to read, no matter what your computer bias might be. It also has a nice assortment of photographs, drawings, screenshots and other illustrations from the development period.

Speaking (again) of smug attitudes, one amusing incident in the book involves the Macintosh team’s April 1981 encounter at a computer show with Adam Osborne, creator of the Osborne 1, “a low-cost, one-piece, portable computer complete with a suite of bundled applications.”

According to Hertzfeld: “As Macintosh elitists, we were suitably grossed out by the character-based CP/M applications, which seemed especially clumsy on the tiny, scrolling screen.” When Osborne realized he was talking to the Macintosh development team, he told them his Osborne 1 would outsell the Apple II “by a factor of 10” and added that they should “tell Steve Jobs that the Osborne 1 is going to outsell the Apple II and the Macintosh combined!”

When Steve Jobs heard what Adam Osborne had said, he called the founder of the Osborne Computer Company and left two messages. The first message was simple and basic, that Osborne was “an asshole.” Jobs’ second message was: “Tell him the Macintosh is so good that he’s probably going to buy a few for his children even though it put his company out of business.”

And the rest, of course, is computer history.

Revolution in the Valley has drawn strong praise from Steve Wozniak, who co-founded Apple with Steve Jobs in 1976.

“It’s chilling to recall how this cast of young and inexperienced people who cared more than anything about doing great things created what is perhaps the key technology of our lives,” he notes in the book’s foreword. “ Their own words and images take me back to those rare days when the rules of innovation were guided by internal rewards, and not by money.”

Si Dunn

Here’s the book scaring me this Halloween: America the Vulnerable – #bookreview #data #security

Subtitled “Inside the New Threat Matrix of Digital Espionage, Crime, and Warfare,” America the Vulnerable is written by Joel Brenner, former inspector general at the National Security Agency.

Brenner has recent experience at the highest levels in national intelligence, counterintelligence and data security. And he has studied firsthand many of the threats and attacks against our national, corporate and personal interests.

“During my tenure in government,” he writes, “I came to understand how steeply new technology has tipped the balance in favor of those–from freelance hackers to Russian mobsters to terrorists to states like China and Iran–who want to learn the secrets we keep, whether for national, corporate, or personal security.” He adds: “The truth I saw was brutal and intense: Electronic thieves are stripping us blind.”

Everything from Social Security numbers to technological secrets that cost billions to develop are being taken — stolen from military and corporate data networks and individual computers, possibly including yours.

His book will leave you wide-eyed and wondering who is surreptitiously poking around inside your computer right at this moment and what they are taking or “borrowing” for sinister purposes.

 Likely the Chinese and the Iranians and Russian mobsters and others, including hackers, are in there or have been there recently.

And Brenner explains how you may be unknowingly helping them find and transfer sensitive and vital information, even when you do something seemingly innocuous as plugging in a thumb drive to your laptop.

You won’t need to watch any monster movies to get scared this Halloween. Brenner’s book or its Kindle version can give you a very serious case of chills and frights. 

Si Dunn

The Art of R Programming: A Tour of Statistical Software Design – #programming #bookreview

The Art of R Programming: A Tour of Statistical Software Design
By Norman Matloff
(No Starch Press, list price $39.95, paperback)

What? You haven’t heard of R, the programming language?

“R is a scripting language for statistical data manipulation and analysis,” writes Norman Matloff, an experienced and widely published writer who is a professor of computer science at the University of California, Davis. He is also a former statistics professor.

R, he notes in this excellent overview of the programming language, has a rather complicated past.

“It was inspired by, and is mostly compatible with the statistical language S developed by AT&T. The name S, for statistics, was an allusion to another programming language with a one-letter name developed at AT&T—the famous C language. S later was sold to a small firm, which added a graphical user interface (GUI) and named the result S-plus.”

According to Matloff, “R has become more popular than S or S-plus, both because it’s free and because more people are contributing to it. R is sometimes called GNU S, to reflect its open source nature. (The GNU Project is a major collection of open source software.)”

So much for its history. Who uses R? A lot of people involved in statistics and data science. “It is widely used,” Matloff reports, “in every field where there is data—business, industry, government, medicine, academia, and so on.”

Here’s the good news about his good book. If you’ve never heard of R or if it’s something you’ve only recently considered trying, Matloff shows you how to get started quickly both in interactive mode and batch mode.

And you don’t begin by tiresomely displaying “Hello, world.” You start at the heart of R. You make a simple data set, which, in R parlance, is called a vector. You concatenate three numbers, in this case 1, 2 and 4.

“More precisely,” Matloff states, “we are concatenating three one-element vectors that consist of those numbers.” He adds: “It’s hard to imagine R code, or even an interactive R session, that doesn’t involve vectors.”

From there, his book smoothly delves into a wide range of R topics, including basic types, data structures, closures, recursion, anonymous functions, object-oriented programming, and interfacing R to other programming languages.

The Art of R Programming is rich with short, instructive code examples, including examples that initially have bugs but are corrected and given explanations for why the first try went awry.

The book’s marketing materials note that archaeologists use R to trace how ancient civilizations spread, and drug companies use it to try to figure out which medications are safe and effective. And actuaries use it, of course, to “assess financial risks and keep markets moving smoothly.”

But R can be used in much more commonplace settings, as well. You don’t have to know statistics, and you don’t have to be a professional programmer. You can be a beginner wanting to become expert. Or you can be, and remain, a hobbyist programmer.

R commands typically are submitted “by typing in a terminal window rather than clicking a mouse in a GUI, and most R users do not use a GUI,” Matloff cautions.

But: “This doesn’t mean that R doesn’t do graphics. On the contrary, it includes tools for producing graphics of great utility and beauty, but they are used for system output, such as plots, not for user input.”

Never fear, however. A number of free GUIs are available for R, and Matloff gives links to several.

Two appendices in Matloff’s book cover downloading, installing and running R. The place to begin is the Comprehensive R Archive Network (CRAN), where “thousands of user-written packages” are available. And there are “precompiled binaries for Windows, Linux, and Mac OS X on CRAN,” Matloff points out.

No Starch Press, the book’s publisher, pledges that it delivers “the finest in geek entertainment.” Many readers likely will say this handsome, well-structured and well-written R overview meets that promise.

Si Dunn

CoffeeScript: Accelerated JavaScript Development – #bookreview #programming

CoffeeScript: Accelerated JavaScript Development
By Trevor Burnham
(Pragmatic Bookshelf, $29.00, paperback)

JavaScript was thrown together in 10 days and “was never meant to be the most important programming language in the world,” says Trevor Burnham, a web developer and founder of DataBraid, a startup focused on “developing data analysis and visualization tools.”

Yet, JavaScript was “understood by all major browsers,” despite their numerous differences, and it quickly became the “lingua franca of the Web,” he says in his well-written new book.

JavaScript also became a headache for many programmers struggling to learn it well enough to provide support and develop new applications.

“JavaScript is vast…[and] offers many of the best features of functional languages while retaining the feel of an imperative language,” Burnham notes. “This subtle power is one of the reasons that JavaScript tends to confound newcomers: functions can be passed around as arguments and returned from other functions; objects can be passed around as arguments and returned from other functions; objects can have new methods added at any time; in short, functions are first-class objects.”

Unfortunately, “JavaScript doesn’t have a standard interpreter,” he adds. “Instead, hundreds of browsers and server-side frameworks run JavaScript in their own way. Debugging cross-platform inconsistencies is a huge pain.”

Enter CoffeeScript, first released on Christmas Day, 2009 as “JavaScript’s less ostentatious kid brother.”

Coding in CoffeeScript requires fewer characters and fewer lines. And “the compiler tries its best to generate JavaScript Lint-compliant output, which is a great filter for common human errors and nonstandard idioms,” Burnham writes.

Another benefit: “CoffeeScript code and JavaScript code can interact freely,” he notes.

His book, aimed at CoffeeScript newcomers, assumes you have at least a little knowledge of JavaScript. But you don’t have to be a JavaScript Ninja, he assures.

He starts at the classic “Hello, world” level of CoffeeScript, including installing the CoffeeScript compiler, deciding which text editors are best, and learning how to write and debug simple CoffeeScript code.

From there, he moves quickly into showing you how to put CoffeeScript to work and develop a simple multiplayer game.

There are several different ways to run CoffeeScript, and there are different requirements, depending on whether your machine is Mac, Windows or Linux. Burnham describes these in his text and in an appendix, and he gives links to more information.

He also shows how to use a browser-based compiler for developing his book’s example application. But he does not recommend using the browser-based compiler for production work.

His book has six chapters and four appendices:

  • Chapter 1 – Getting Started
  • Chapter 2 – Functions, Scope, and Context
  • Chapter 3 – Collections and Iteration
  • Chapter 4 – Modules and Classes
  • Chapter 5 – Web Interactivity with jQuery
  • Chapter 6 – Server-Side Apps with Node.js
  • A1 – Answers to Exercises
  • A2 – Ways of Running CoffeeScript
  • A3 – Cheat Sheet for JavaScripters
  • A4 – Bibliography

CoffeeScript: Accelerated JavaScript Development offers a focused blend of examples and exercises to help speed up basic competency with CoffeeScript. In learning how to build the multiplayer game application, you use CoffeeScript to write both the client (with jQuery) and the server (with Node.js).

Since CoffeeScript and JavaScript are intertwined, you also can gain a better understanding of JavaScript by learning to code in CoffeeScript, ” Burnham promises.

In a foreword to the book, CoffeeScript’s creator, Jeremy Ashkenas, hails Burnham’s work as “a gentle introduction to CoffeeScript led by an expert guide.”

It lives up to that good billing, with many short code examples and many short tutorials and exercises that can lead quickly to building both a working app and a working understanding of CoffeeScript.

Si Dunn