Decision Mechanics

Insight. Applied.

  • Services
    • Decision analysis
    • Big data analysis
    • Software development
  • Articles
  • Blog
  • Privacy
  • Hire us

Statistical intuition

May 23, 2021 By editor

splash

The Monty Hall problem is a probability puzzle based on an old US game show. You are shown three doors. One contains a car, while the other two contains goats. The game show host invites you to pick a door. He then opens one of the doors containing a goat and asks, "Do you want to stick with your original selection or switch to the remaining door?"

What should you do…assuming that you don’t wish to own a goat?

I’ll take all the fun out of it. You should switch. It doubles your chances of getting the car.

Convinced? Probably not. Even when presented with the solution, many people struggle to accept it. It’s not particularly intuitive.

Martin Johnsson recently discussed this on his blog. He used paper simulation, computer modelling and mathematics to try and satisfy himself of the wisdom of switching. He concluded

…I’m not sure I have convinced myself of the solution to the generalised problem yet.

Reasoning about probabilities is hard. It’s very easy to be led astray by our "gut". As the eminent statistician Sir David Spiegelhalter has noted

…when asked a basic school question using probability, I have to […] try it a few different ways, and finally announce what I hope is the correct answer.

This dereliction of our instincts means that it’s essential to draw on the formal methods of statistics and Monte Carlo simulation when making important decisions.


Photo by Sergiu Vălenaș on Unsplash

Filed Under: Data science Tagged With: intuition, monty hall problem, probability, statistics

Azure SDK for Python (Conda)

May 17, 2021 By editor

Microsoft have released a set of packages to help data scientists provision, manage and use Azure resources from Python application code.

Azure SDK for Python (Conda) is currently in preview.

Filed Under: Data science Tagged With: Azure, Python.

The company you keep…

May 7, 2021 By editor

weird combination

Researchers have demonstrated how objects can be hidden by exploiting correlation bias.

Computer vision systems, like other machine learning technologies, rely on correlation and context. They learn that certain things often appear together–like mice and keyboards. But you don’t expect to see a platypus wielding a chainsaw, for example (…you’ve no idea how much I wanted to find that splash image…).

Artwork can be challenging, for example, as it can depict items that have no business being in the wider context.

This opens up another angle for hacking AI systems. The researchers were able to make a computer vision system fail to recognise a STOP sign by placing it next to fruit—a suitably bizarre combination.

Another example of the brittleness of "intelligence as correlation". The state-of-the-art in machine learning is leading us down the latest AI blind-alley. This one may be a little darker than before.


Photo by celery soup on Unsplash.

Filed Under: Data science, Machine learning Tagged With: AI hacking, correlation bias

The rise of functional programming

May 7, 2021 By editor

Yes, I know functional programming has been around since the 1950s. And, yes—Excel users are functional programmers. There’s nothing particularly new to see here.

Or is there?

There’s been sustained hype around functional languages for a few years now. Yet they have failed to break into the mainstream. Languages such as Haskell, Clojure and F# remaining frustratingly niche.

The top ten programming languages rankings in recent surveys by Stack Overflow and GitHub are devoid of functional programming languages.

Except that they aren’t.

Functional programming is on the rise, but through approach, techniques and style—not language choice.

Mainstream languages are hybridizing—adding functional capabilities to their (predominantly object-oriented) features. C# has LINQ. Java has added Lambda Expressions. JavaScript has many features that support a functional approach—which is actively encourage React, for instance. Rust, Kotlin, Swift…and a host of other modern languages…have a distinctly functional flavour to them.

Functional programming languages have a lot going for them. They encourage (or enforce) functional design principles. And they often bring desirable features with them, such as powerful type inference. However, the real revolution in functional programming is happening through traditional enterprise languages—gradually introducing practising software developers to the ideas without forcing them into a "paradigm shift".

Why does functional programming matter?

Functional programming brings with it skills and concepts that are valuable when building modern applications.

One benefit for data scientists is that functions look like…well…functions. Mathematical functions to be more specific. The closer the code is to the equations you are using, it easier it is to make sure you have the correct implementation. There’s a reason that Excel and R draw heavily on functional ideas.

Today’s applications are increasingly asynchronous. Mobile…web…microservices…functions-as-a-service (FaaS). Asynchronous software is hard to write—and even harder to debug. Functional programming encourages practices such as immutability and isolation of side-effects that make it easier to reason about asynchronous code.

There’s a view, admittedly controversial, that the object-oriented programming (OOP) paradigm that’s dominated software development for over 30 years has retarded progress.

Alan Kay, who coined the term "object-oriented", has long criticised mainstream OOP.

I’m sorry that I long ago coined the term “objects” for this topic because it gets many people to focus on the lesser idea. The big idea is messaging.

He has also expressed his dissatisfaction with major OOP languages.

Java is the most distressing thing to hit computing since MS-DOS.

I invented the term "Object-Oriented" and I can tell you I did not have C++ in mind."

It’s been called the "trillion dollar disaster". Its "three pillars" are a combination of the unremarkable (encapsulation) and positively harmful (inheritance).

OOP’s singular focus on "nouns" has given us an industry of convoluted patterns in an attempt to impose some order–leading to CommandExecutor classes with executeCommand methods.

As we build more complex, asynchronous systems, OOP is failing to scale effectively.

The tools used in functional programming—map, filter, reduce, copy-on-write, etc—are simpler and more generic than OOP patterns. And, as functional programming has a mathematical foundation (lambda calculus), it opens the door to more advanced tooling for automatically diagnosing problems in our code.

Unlike OOP, functional programming encourages us to separate our data from our calculations. This makes our code easier to test and aligns perfectly with today’s data-centric workflows. Data pipelines fit snugly into functional designs.

Can I use functional techniques without adopting a functional programming language?

Yes! That’s the point. Absolutely.

Functional programming is a set of concepts and techniques. It’s a way of thinking about and writing code. Sure, functional languages make it easier to apply those ideas, but you can apply them in any programming language.

And, as mentioned previously, modern languages are increasingly becoming hybrid languages—supporting the use of multiple paradigms.

Focusing on the concepts, rather than language features, will allow you to take your functional programming skills with you as you move from language to language during your career.

I’d argue that it’s worth learning at least one functional-first language as it helps consolidate your ideas, but it’s not essential.

Just start writing functional code. Today. Your customers will thank you for it.

Filed Under: Data science, Software Tagged With: FP, functional programming, object-oriented programming, OOP

GlaxoSmithKline joins the R Consortium

May 5, 2021 By editor

GlaxoSmithKline (GSK) has reaffirmed it’s commitment to R by joining the R Consortium as a silver member.

Andy Nicholls, Senior Director, Head of Statistical Data Sciences at GSK, said

[R] will help us make better decisions, faster; to the benefit of patients everywhere.

Filed Under: Data analysis, Data science Tagged With: GlaxoSmithKline, pharma, R, R Consortium

  • « Previous Page
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 18
  • Next Page »

Copyright © 2026 · Decision Mechanics Limited · info@decisionmechanics.com