Deep Learning

deepLearningAI500I recently attended a Deep Learning (DL) meetup hosted by Nervana Systems. Deep learning is essentially a technique that allows machines to interpret sensory data. DL attempts to classify unstructured data (e.g. images or speech) by mimicking the way the brain does so with the use of artificial neural networks (ANN).

A more formal definition of deep learning is:

DL is a branch of machine learning based on a set of algorithms that attempt to model high-level abstractions in data by using multiple processing layers with complex structures,

I like the description from Watson Adds Deep Learning to Its Repertoire:

Deep learning involves training a computer to recognize often complex and abstract patterns by feeding large amounts of data through successive networks of artificial neurons, and refining the way those networks respond to the input.

This article also presents some of the DL challenges and the importance of its integration with other AI technologies.

From a programming perspective constructing, training, and testing DL systems starts with assembling ANN layers.

For example, categorization of images is typically done with Convolution Neural Networks (CNNs, see Introduction to Convolution Neural Networks). The general approach is shown here:

Construction of a similar network using the neon framework looks something like this:

Properly training an ANN involves processing very large quantities of data. Because of this, most frameworks (see below) utilize GPU hardware acceleration. Most use the NVIDIA CUDA Toolkit.

Each application of DL (e.g. image classification, speech recognition, video parsing, big data, etc.) have their own idiosyncrasies that are the subject of extensive research at many universities. And of course large companies are leveraging machine intelligence for commercial purposes (Siri, Cortana, self-driving cars).

Popular DL/ANN frameworks include:

Many good DL resources are available at: Deep Learning.

Here's a good introduction: Deep Learning: An MIT Press book in preparation

Posted in Programming, Technology | Tagged , , | Leave a comment

Creating a Minimally Sized Docker Image

dockerThis is a follow up to the Publishing a Static AngularJS Application with Docker post.

Relative to the size of a standard Ubuntu Docker image I thought the 250MB CoreOS image was "lean". Earlier this month I went to a Docker talk by Brian DeHamer and learned that there are much smaller Linux base images available on DockerHub. In particular, he mentioned Alpine which is only 5MB and includes a package manager.

Here are the instructions for building the same Apache server image from the previous post with Alpine.

The Dockerfile has significant changes:

Explanation of differences:

line 2: The base image is alpine:latest.

lines 4-5: Unlike the CoreOS image, the base Apline image does not include Apache. These lines use the apk package manager to install Apache2 and clean up after.

lines 6-7: Runs the exec form of the Dockerfile ENTRYPOINT command. This will run httpd in the background when the image is started.

line 8: The static web content is copied to a different directory.

Building and pushing the image to DockerHub is the same as before:

Because of the exec additions to the Dockerfile, the command line for starting the Docker image is simpler:

The resulting Docker image is only 10MB as compared to 290MB for the same content and functionality. Nice!

UPDATE (12-Jun-17): Here's an even smaller image: Stuffing Angular into a Tiny Docker Container (< 2 MB)

Posted in Programming, Tools | Tagged | 3 Comments

Empires of Medical Devices

Even the IoT (Internet of Things) world is concerned about interoperability: Do We Really Want Empires of Connected Things?

Here are a couple of key quotes:

...little hope for open standards or a universal language for how they do that. It's time for regulatory guidance to make that happen.

...one analyst observed that the industry seems to be forming "walled gardens" rather than a coherent network that encourages openness and interoperability.

Sound familiar? This is the same medical device interoperability struggle that has been going on for over 25 years.  The IoT is still in its infancy and I sure hope they have better luck developing a "common carrier" than we did.

Posted in Interoperability, Medical Devices | Leave a comment

Melon Headband — Android Beta

About 2 years ago (May 2013) I backed this Kickstarter project:  Melon: A Headband and Mobile App to Measure Your Focus. I received the hardware (headband and accessories) about a month ago.
melon-as-shipped

The Android application became available yesterday.

melon-training   melon-voltage
I'm having trouble focusing (according to the Melon anyway), but at least the device and software seem to be functioning. As expected, the software needs a lot of work. No use in bashing beta software though.

I just downloaded the alpha SDK. Now the real fun begins...

Company link: Melon

Posted in EEG | Tagged | 4 Comments

EEG Dating

eeg-datingI've been tracking EEG-related stories for many years. This perfect Valentine’s Day technology story: 'EEG Dating' matches people based on their brainwave data is certainly worth adding to the catalog. The end goal:

Many dating services ask countless questions. With EEG matching, there should be no need for the questions that most people shade the truth with.

I have no idea what this 'Color Spectrum Analysis of EEG Data' (from Biometric Dating) is, but it's sure pretty:biometricdating

Granted, they are in the process of testing their theory by using data from long-term married couples. I sure hope they're using happily married couples, otherwise the consequences could be disastrous!

Oh, and don't forget to try: Computers can read your mind! (still amazing!).

Posted in EEG | Tagged | Leave a comment

Software Doesn’t Have An MD

Core O.S., core, Photo: Alex Washburn / WIREDI got a kick out of this Andreessen Horowitz piece: Digital Health/SOFTWARE DOESN'T HAVE AN MD.

I'm sure 'the kid in the garage without a degree' is no dummy, but this premise:

And so that large percentage of medicine that is effectively being practiced by non-MDs is going to expand.

is simply ludicrous.

There's a big difference between creating health and wellness appliances and mobile applications and diagnosing and treating patients. The distinction is outlined in FDA clarifies the line between wellness and regulated medical devices.  If you claim your product acts like a doctor (treat or diagnose) or doesn't fall into the "low risk" category, then your company will have to follow FDA regulatory controls.

Posted in FDA, Medical Devices | Leave a comment

Fast Healthcare Interoperability Resources (FHIR)

fhir-logoThe HL7 FHIR (pronounced “fire”) standard has been under development for a while. It became a Draft Standard for Trial Use (see DSTU Considerations) in Jan 2014. The recent announcement of the vendor collaboration Argonaut Project has fueled some "interoperability excitement"™.

The best technical overview I've read is this whitepaper: The HL7 Games Catching FHIR. In particular, it does a good job of comparing FHIR with HL7 v3. Summay:

HL7’s FHIR™ standard has learned from the mistakes of HL7 v3, and is surprisingly delightful.

 

Posted in HL7, Interoperability | Leave a comment

Publishing a Static AngularJS Application with Docker

Introduction

The most common use for JavaScript frameworks is to provide dynamic client-side user interface functionality for a web site. There are situations where a JS application does not require any services from its host server (see example unhosted apps). One of the challenges for this type of application is how to distribute it to end users.

This post will walk through creating a static AngularJS application (i.e. no back-end server) and how to create and publish a lean Docker container that serves the application content.  I will mention some tooling but discussion of setting up a JS development environment is beyond the scope of this article. There are many resources that cover those topics.

Also note that even though I'm using AngularJS, any static web content can be distributed with this method.

Side Note on AngularJS

One of the major advantages of using AngularJS over the many JavaScript framework alternatives is its overwhelming popularity. Any question or issue you may encounter will typically be answered with a simple search (or two).

angularjs-trends

With the recent AngularJS 2.0 controversy it will be interesting to see if this trend continues.

Creating an AngularJS application

The easiest way to create a full-featured Angular application is with Yeoman.  Yeoman is a Node.js module (npm) and along with its Angular generator creates a project that includes all of the build and test tools you'll need to maintain an application.

Generate the Angular application with yo. Accepting all the defaults will include "Bootstrap and some AngularJS recommended modules."  There's probably more functionality included then you'll need, but modules can be removed later.

The yo command will take a little while to complete because it has to download Angular and all of the modules and dependencies.

Start the server with Grunt (which needs to be installed separately).

The application can be viewed in a browser at http://localhost:9000/#/:

yeoman-default

Building the Application Distribution

After removing the 'Allo, Allo' cruft and creating your custom application create a distribution with:

This will create a dist directory that contains the static application content.

Creating and Publishing the Docker Container

The prerequisite is of course to install Docker and create a Docker Hub account (free). See Docker Installation Documentation.

A typical Ubuntu Docker container requires more than a 1GB download. A leaner Linux distribution is CoreOs. The coreos/apache container has a standard Apache server and is only ~250MB.

Add a Dockerfile file to the myapp directory:

The key here is the COPY command which copies the content of the dist directory to the container /var/www directory. This is where the Apache server will find index.html and serve it on port 80 by default.  No additional Apache configuration is required.

Create the docker container:

Output:

docker-build

Now push the container to your Docker hub account:

The dockeruser/myapp Docker container is now available for anyone to pull and run on their local machine or a shared server.

Starting the Application with Docker

The application can be started on a client system by downloading the running the dockeruser/myapp container.

The run command will download the container and dependencies if needed. The -d option runs the Docker process in the background while apache2ctrl is run in the container in the foreground. The application will be running on http://localhost:9001/#/.

To inspect the Apache2 logs on the running Docker instance:

To stop the server:

If you've pushed a new version of the application to Docker hub, users can update their local version with:

This example shows how Docker containers can provide a consistent distribution medium for delivering applications and components.

Posted in Programming | Tagged , | 3 Comments

Americans Killed by Medical Errors Today

Current events have sparked popular tweets like this:

deaths-today

As referenced by the West Health To Err is Human: Interoperability is Divine article, based on a 300,000 annual death rate, the following could be added to the list:

Americans killed by medical errors today: 822

This shocking statistic positions medical errors as the third leading cause of death in the United States, behind heart disease and cancer.

Also see Deaths by medical mistakes hit records. Pretty depressing.

This is a complex problem to solve, but reducing preventable deaths with improved patient safety technology should be a priority. No duh!

Posted in EMR, Interoperability | Leave a comment

The Bumpy Road to a New Development Laptop

My 6 year old Lenovo T400 finally gave up the ghost. It didn't totally die (it probably never will, thank you IBM), but the screen was starting to flicker and it reliably rebooted itself whenever I was doing something useful. Very annoying.

Grief

I went though the standard 5 stages of grief:

  1. Denial: All T400's do this.
  2. Anger: "Damn it, why does this thing keep crashing? I'm sick of this sh*t!".
  3. Bargaining: Maybe if I update to 14.04 it will stop doing this.
  4. Depression: "This sucks!"
  5. Acceptance: OK, time to buy a new laptop.

I'm fine now, but that was a rough 30 minutes!

Decision Process

I'm not going to detail all of my system requirements or decision making process, but here's a high level outline:

  • I primarily need a Ubuntu development machine. My T400 is a dual boot 12.04/XP.  In recent years I've rarely used Windows, but there are some tools that are nice to have around (e.g. Visual Studio).
  • I looked hard at the MacBook Pro but at the end of the day I just couldn't bring myself to go that route. Besides the higher hardware cost/performance ratio re: the alternatives, I guess I'm just not a Mac person.
  • I really wanted to get an Ultrabook form factor. Not only for the portability, but I'm not ashamed to say that the 'cool factor' played a part in the decision.
  • I looked at all of the standard Ultrabook offerings: Lenovo, ASUS, Dell, System76, Acer, etc. No touch, no 'convertible' (if you need a tablet, buy a tablet), no Windows 8. The deciding factor for me was reliability. Besides the T400, I have a T60 in the closet that still runs fine.
  • So Lenovo it is. The history of the X1 Carbon (see The 2014 Lenovo X1 Carbon: Lenovo Giveth, And Lenovo Taketh Away and Lenovo ThinkPad X1 Carbon 2014 review)  goes back to 2011. The latest version (2014, or Carbon 2) has taken a lot of heat over the keyboard, function keys, and trackpad changes. I'm sure these opinions have merit, but I just want a fast machine that works!

Buying Experience (not good!)

Beware of the Lenovo Outlet. I purchased a 'ThinkPad X1 Carbon 2 - New':

x1-carbon-2-new

Here's the condition definition (my highlight):

Products that are discontinued, overstocked, or returned unopened. These items are in their original factory sealed packaging and have never been used or opened.

Boy was I disappointed when the package arrived! First, the only thing in the box was the laptop. No AC power adapter, no docs, no nothing. To my amazement, the machine was in suspend mode. When I opened the lid it came out of hibernation to a Win7 user password prompt! I didn't even try to guess a password. I couldn't believe it!

The machine was in pretty good shape physically, a little dirty and missing a foot pad, but no dents or scratches. Certainly opened and used!  At least the BIOS confirmed that I got the correct hardware (i7, 8G RAM, 256G SSD).

After many calls to multiple Lenovo service centers I got nowhere. No return, no exchange. Maybe I should write a letter to The Haggler, but even then I probably wouldn't return the machine anyway. I got a great price (much better than what I could find on eBay) and the Lenovo Outlet no longer has any i7 X1 Carbon's listed.  Also, I'm a techie so disk partitioning and re-installed OS's is not a problem.

I'm thinking now that Lenovo might have screwed up a repair shipment and I ended up wiping some poor schmuck's SSD. Oh well.

Anyway, as unpleasant as this was, I now have a development laptop that should meet my needs for many years to come.

Installation Notes

  • Dual boot. Here's the right way: WindowsDualBoot, but because I installed Ubuntu first (mistake) here's what I did:
    1. Used GParted  to partition the disk to my liking. Don't forget to add a Linux swap partition (8G for me). The Ubuntu installer will complain if it's not there and find it automatically if it is.
    2. Created a Ubuntu 14.04 bootable USB stick: How to create a bootable USB stick on Windows. Install Ubuntu on the ext4 partition.
    3. Created a bootable Windows 7 USB stick. The Universal USB Installer above works fine for this. Install Windows 7 on the Windows partition.
    4. After Step #3 the system will only boot Windows. Use Boot-Repair (option #2) to re-install GRUB.
  • Ubuntu 14.04 seems to work flawlessly on the X1. There were only two hardware compatibility issues that I read about:
    1. Not waking up from suspend mode. This is resolved by updating the BIOS firmware.  Upgrading from v1.09 to v1.15 fixed it for me. The Lenovo firmware only comes as a CD image (.iso) or a Windows update application. Because the X1 does not have a CDROM drive the only reasonable way to upgrade is via Windows. People have upgraded the firmware via USB (see BIOS Upgrade/X Series), but it's really ugly.
    2. Fingerprint reader. Haven't tried to use it, and probably won't.

Happy Ending (I hope)

Like most things in life, nothing is ever perfect. This experience was no exception.

I have a JRuby/Rails project with some Rspec tests that take 80 seconds to complete on the T400 and 20 seconds on the X1. I can live with that improvement. 🙂

Hopefully the X1 will last as long the T400 did.

Posted in Programming, Technology, Tools | Tagged , | Leave a comment