Learning Probability and Statistics

The AI Winter is a distant memory.  Machine Learning and AI are finally making tangible progress. (Siri, Alexa, cars, Wall Street). Statistics is the foundation of the current progress in machine learning.

I started learning some probability and statistics in 2017. I watched the entire Stats 131a class by Michael C Cranston’s at UC Irvine.

I took some high-level notes on Github so I could reference certain topics for a deeper dive.  In addition, I have more complete notes for the first four classes:

Lecture 1Lecture 2Lecture 3Lecture 4

Another class that I’ve started is Harvard Stats 110. Joe Blitzstein is lively and provides a lot of intuition in his classes.

I’m gathering all of my resources in one Github repo

Finally, to help me better absorb the material, I’m planning on writing several blog posts on probability, statistics, and machine learning.


Voice as a User Interface is Almost Here

Talking to your computer to interact with it has been science fiction fantasy for over 50 years. It will soon be a reality.

Amazon made voice activated devices popular with its Echo devices . Google responded with the Google Home.

We now have an arm’s race between these two giants.  Amazon or Google should get us over the finish line.

Apple has Siri, of course, but it’s currently in third place in capabilities, and it does’t offer cheap $30 Siri devices. Nevertheless, look for Siri improvements too.

One concern with these devices that’s always mentioned is that of privacy. Your request, along with your voice, is transmitted to the cloud for processing. That’s where all the computational power and most recent machine learning algorithms live. Apple’s data is anonymous, which I believe slows their ability to improve Siri’s abilities. Alexa and Google, for example, can recognize between different people’s voices.

Here’s a review of the Google Home Mini:

Marques also does a great comparison of the voice assistants:

Finally, if you’d like to help crowd source an open source voice solution, the Mozilla Foundation has Mozilla Common Voice where it needs people to both verify and donate their voice. This open source data will be used to help improve voice recognition.

Groundhog Day: Amazon Updates Echo/Someone Rants About Privacy

Whenever Amazon updates the Echo or Google updates their Home Device, someone on Hacker News begins the rant about how they don’t like the intrusion of their privacy.  I certainly can appreciate that they don’t want their information transmitted to a corporate mothership.  Unfortunately, this conversation tends to drown out any other discussion about the products.

The solution seems simple enough: don’t use the product. Stop reading articles about such devices because you’re not going to use them.

The generic version of problem of this exists throughout the Internet. There’s a product that people hate, and will never use, but they feel this insatiable need to tell the world why they will never buy it.  The electric car, is one example that springs to mind.

At any rate, there’s nothing wrong with disliking a product, but it probably doesn’t add anything to the conversation to tell the world why it’s not for you




Stories That Should be Banned from Hacker News: Immortality

Some stories on HN are a complete waste of time.  Little real knowledge is ever included in the threads.  No one learns anything. We just bullshit for a few hours.  And this happens a few times a year for each topic.

My first suggestion is stories related to immortality. Most of the comments immediately turn  philosophical.

“Death gives life meaning”

“It’ll only be for rich people”

“The money should be spent on something better.”

On HN, most people don’t  want to learn anything about aging.  No one discusses the basic science that we might gain by doing the research.  The knowledge gained could have benefits in other areas of medicine like heart disease and cancer, for example.  You aren’t going to want to live forever and have Alzheimer’s.

There are 7 billion people on the planet.  It’s not going to hurt if several thousand people work on basic research to understand aging.  From reading the current news headlines, robots and AI, will  soon leave many people without jobs. Perhaps basic research in all areas of science should be expanded to create jobs?

Finally, let’s not delude ourselves into thinking that death is going to be any easy disease to cure.  Maybe we’ll get a few breakthroughs over the next couple of decades and we’ll figure out how to add a few extra healthy years to the average person.  We definitely need to move beyond long term studies and peer deeper into our bodies.  By the way, the latest study says we need to take 15,000 steps a day to live a longer life.


Using AutoLayout with UIView Subclasses in Playgrounds


Playgrounds on the Mac and iPad are a great way to develop quick prototypes for new classes. Recently I had the need to create a UIView subclass that contained a few labels. Unfortunately, I couldn’t get my labels to display in the playground. When I used a UIViewController instead of a UIView, everything displayed properly. However, when I changed the parent class to UIView and made the few appropriate changes, my background color changed but my labels no longer appeared. So, instead of seeing this:


I was seeing this:


My initial thought was to configure the label in layoutSubviews() but the result was still the same.

It turns out that the labels will not autolayout inline within the playground.  You must use the PlaygroundSupport module and the liveView window:

import UIKit
import PlaygroundSupport

class MyView: UIView {



let v = MyView(frame: CGRect(x: 0, y: 0, width: 200, height: 150))
PlaygroundPage.current.liveView = v

Here’s a complete example:

import UIKit
import PlaygroundSupport

class MyView: UIView {
    let label = UILabel()
    private func setup() {
        self.backgroundColor = UIColor.green

        label.translatesAutoresizingMaskIntoConstraints = false
        label.text = "Hello world"
        label.textAlignment = .center
        let margins = self.layoutMarginsGuide
        label.leadingAnchor.constraint(equalTo: margins.leadingAnchor, constant: 0).isActive = true
        label.trailingAnchor.constraint(equalTo: margins.trailingAnchor, constant: 0).isActive = true
        label.topAnchor.constraint(equalTo: margins.topAnchor, constant: 0).isActive = true
        label.bottomAnchor.constraint(equalTo: margins.bottomAnchor, constant: 0).isActive = true
//    override func layoutSubviews() {
//    }
    override init(frame: CGRect) {
        super.init(frame: frame)

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")

let v = MyView(frame: CGRect(x: 0, y: 0, width: 200, height: 100))
PlaygroundPage.current.liveView = v

Smartwatch Sales Are Tanking

Well, at least if you believe the latest click-bait headline from TechCrunch, the smartwatch revolution could be over before it even started.

The article points out that the new Watch was only available for the last 2 weeks of the quarter, and everyone was waiting for it, so it depressed sales. Fitbit sales are skyrocketing because people want a device to help improve their health:


Apple is trying to entice that market with its new release, so we should expect quite a bit of growth.

Anyway, as I pointed out last year, health and safety will drive sales.

Personally, I’ve used my Watch to help me lose some weight:

Now I’m using my Watch to help train for my first 10k: