When People and Machine (Learning) collide

Interview with Mathias Brandewinder

Author of the book “Machine Learning Projects for .NET Developers”, Mathias Brandewinder is 360° expert of all the things Microsoft, F# and Machine Learning.
He’s a board member of the F# Software Foundation, and he’s been involved in exploring the correlation between functional programming and machine learning. Feeling curious? Read on! Avanscoperta: Hello Mathias! Good to be talking to you. Can you tell us the story of your initiation to the world of technology?

Mathias: Sure! I am a late bloomer in technology. As a kid, I wanted to be an architect, which somehow lead me to study economics, applied math and decision analysis, and to California. At that time, my plan was to teach, but California tends to turn people into software engineers, and this is what happened.
My first real job was to build risk models for pharmaceuticals. After building insane Excel spreadsheets for a while, I came to the realization that perhaps this wasn’t the right tool, and started picking up software engineering.
In the end, the whole trajectory is perhaps less random than it seems – the common theme being modelling and understanding complex systems, software being a playful way to do that.

Avanscoperta: How did you fall in love with Professeur Tournesol? 🙂

Professeur Tournesol aka Mathias’ profile image on Twitter

Mathias: Tintin was a big thing for me growing up! I love Hergé’s graphical style, and among his characters, Tournesol always had a special place in my heart, with the way he would get completely absorbed in seemingly random projects, as well as his interest in the martial art of Savate. I initially picked him as an avatar out of internet shyness, and since then, it stuck 🙂

Avanscoperta: Let there be F#, and there was F#! How did you end up being so passionate (and a renowned expert) about this particular language?

Mathias: Like many things in my life, I fell into F# entirely by accident, around 2010. At the time, I was working primarily in C#, and had no idea what the term “functional programming” even meant.
Someone told me “you should learn a new language every year”, which sounded like a good idea. F# had just been officially released, so I tried it out.

Raise your hand if Morpheus never shared any life-changing revelations with you!

After a bit of struggle, things clicked, and I haven’t looked back since. I love the simplicity and expressiveness of the language; instead of fighting the code, the language helps me clarify my thoughts, and… it’s just plain fun.

Avanscoperta: What other functional programming languages do you like exploring and why? Is there one which stands out?

Mathias: One lesson F# taught me was that after years of working as a software engineer, I had never even heard of something as important as functional programming.
Learning F# suddenly showed me that code could be written in a completely different way from the one I knew. Since then, I have been keeping my eyes open for other things people might not have told me about code.
As a result, I have been dabbling in a couple of other languages (Racket, Erlang, Prolog), functional or not, mostly looking for paradigms that are as different as possible from what I am familiar with.

Just some of the characteristics that make Functional Programming so special!

Avanscoperta: Is there any particular field in the economy in which F# is going strong? Any sectors where the adoption of F# represented a small revolution?

Mathias: Historically, the financial sector has been an early adopter, I believe because the language helps keep complex logic clear, and avoid bugs that can be quite costly. Since then, F# has blossomed in a few different directions, not necessarily industry specific.
Two areas where the language shines are moving and analyzing data, using Type Providers (which is crucial in machine learning), and domain modelling in a DDD style. There has also been a recent surge of activity around web development, driven by compilation from F# to JavaScript.

Avanscoperta: Can you tell us about the first time you came across Don Syme, and what influence he’s had in shaping your passion for F#?

Don Syme, the man who got F# started!

Mathias: One morning I woke up to find that someone had left a comment on one of my blog posts; that someone was Don Syme, commenting on my code – which was both terrifying and very exciting. I have since had the chance to meet him in person a couple of times. I greatly admire the way Don just reaches out to people, showing genuine interest, and providing encouragement. Beyond the language itself, the warmth and generosity of the F# community is something that has drawn me in, and he is a big reason for that.

Avanscoperta: Mathias, you’re a name that one finds quite often in the conference circuit. If one looks for the videos of your talks online, it’s impressive to notice the variety of topics you talk about. From Azure to serverless, agile, .NET and functional programming, going through TDD, machine learning and dojo… How do these topics relate to each other? What’s the fil rouge among them?

Mathias: That’s a great question! One aspect I find interesting in software is that it gives great freedom to create complex “things”, but that, in spite of scientific appearances, the development process (and its result) is usually quite haphazard.
So part of it revolves around trying to tame the beast, and get more clarity around what it is we are building, and how to build it in a more methodical fashion.
Part of it is simply general curiosity – I have a tendency to get very absorbed in random problems, which lead wherever they lead.

Mathias during Progressive F# Tutorials 2016 – London

Avanscoperta: Can you tell us about the first public talk you ever gave, and how did it go?

Mathias: That’s a trip down memory lane! I have been active for a long time in local meetups and communities, which are a great place to meet like-minded people and learn from each other.
I think my first talk was about TDD; I suspect it was not great, but it was fun, and I enjoyed the process of having to distill my current understanding of a particular question, which is still one of the reasons I love to give talks today.

Avanscoperta: You’re the author of a workshop called “Practical Machine Learning with Functional Programming”. What do we mean by Machine learning, and why is it relevant in our daily lives?

Mathias: One definition I like for Machine Learning is along these lines: it’s about writing a program to perform a task, in such a way that the program will improve when it gets more data.
In other words, first, it is about programming, and then, the goal is to write a program that gets better as it accumulates experience – without changing the program itself. I think that makes it relevant virtually everywhere – wherever someone has to make a repeated decision and data can be recorded, Machine Learning could help. And, unlike humans, machines are quite good at processing a lot of data, and, once trained, their “knowledge” can be directly transfered and replicated into different machines.

Avanscoperta: When did you discover there was such a link between F# and Machine learning? What could you describe as the Eureka moment?

Mathias: It has been more of a gradual realization than a proper Eureka. I have been interested in machine learning related techniques for a while, so when I started diving into F#, I began porting over some algorithms. As I did so, two things struck me.

First, typically, the code ended up looking surprisingly close to the way a human would describe the algorithm in mathematical terms. It also made re-arranging an algorithm into variations very easy.

Then, preparing data to work with was ridiculously easy. That second part is actually quite important in practice: it’s the least glamorous aspect of machine learning, but it’s where practitioners end up spending most of the time.

In hindsight, though, the idea that functional programming and machine learning would fit well together is fairly reasonable.
From a certain perspective, machine learning is all about composing a function from many smaller ones, and tuning it to reduce another function, the prediction error. As composition and functions are both central to functional programming, it’s not surprising that the two would be a good match

Avanscoperta: Where do you see the evolution of machine learning taking the humanity to?

Mathias: On the bright side, I see great potential in solving problems as complex as automatic translation, medical diagnosis, or automation, hopefully enabling people to focus on more interesting questions.
On the dark side, with the amount of personal data being collected, it has disquieting social implications – I am hoping to see more discussions take place around ethics in that domain.
That being said, machine learning teaches you that predictions should be taken with a big grain of salt, so you’ve been warned. 🙂

Are we already living these times?

Avanscoperta: Back to your workshop now. What’s the main takeaway for a potential attendee?

Mathias: From my perspective, the main takeaway is that, in spite of looking quite intimidating from the outset, machine learning is at its core built on fairly simple ideas. Of course, if you dive deep, some technical aspects become quite tricky.
In the end, though, while machine learning produces results that can appear nearly magical, once you open a bit the black box and investigate, you realize that it relies on a couple of techniques only, which can be used in a lot of places to make better use of data.

Avanscoperta: I know nothing about F# or machine learning but I’m intrigued by the title and description as I need to solve real-life problems (and wanna have fun!)… convince me I should attend your workshop. 🙂

Mathias: I can’t promise the workshop will solve your real-life problems, but I will promise that you will have a fun time, and learn some new ideas that will expand your thinking.
Rather than taking an abstract, mathematical view on machine learning, we will start from a few real datasets, and write code from the ground up to solve problems seemingly as different as recognizing numbers in images, detecting what language a piece of text is written in, or predicting how good a wine is based on its chemical profile.
By working on real code, interactively, you will get to experiment and get a direct feel for what is happening. And, as we work through the problems, you will learn to recognize what differences to look for, and the similarities between approaches.
And, perhaps most importantly, you will learn how to methodically organize your work, avoid potential pitfalls, and get the vocabulary and tools you need to evaluate what various libraries bring to the table.

Mathias during one of his workshops… helping others get the most out of it!

Avanscoperta: What are you currently working on?

Mathias: At the moment, besides consulting and mentoring work during the day, I am working on building an F# API over the CNTK deep-learning library. I have this hope that perhaps, I can use this to create machine learned music, in the style of past artists. It’s likely going to be terrible, but… you don’t know until you try, and in the past, I learnt the most from rather random projects with no obvious utility.

Avanscoperta: We said you’re a very busy person, travelling the world and speaking at conferences quite frequently. What do you like doing in your spare time?

Mathias: Spare time? What’s that? One of the activities that helps me stay sane is Muay Thai, or Thai boxing. There is nothing quite like a big red glove coming towards your face to take your mind off whatever problems you might have had that day.

Discipline, precision, dedication… how many similarities can you draw between Thai Boxe and Software development?

Avanscoperta: It’s been a huge pleasure Mathias, thanks for your time and hope to see you soon in Italy! 🙂

Mathias: Looking forward to it! In spite of being a Frenchman, I will have to admit that Italy is a place that knows a thing or two about pleasant living, and even food and wine 😉

Pics credits: Skills Matter – Ed Telling, Daniel Faggella, Rainer Grimm, Justin Ng and NASA on Unsplash.

Learn with Mathias Brandewinder

Mathias is the trainer of the Practical Machine Learning with Functional Programming Workshop.

Check out the full list of our upcoming training courses: Avanscoperta Workshops.

Mathias Brandewinder

Mathias has been writing code professionally for the past 10 years or so, and enjoying most of it. He used to work mostly in C#, until he discovered F# and fell in love with it.

Enrico Meloni

Roadie @ Avanscoperta.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.