Episode 97: [Value Boost] Mathematical Modelling as a Gateway to ML Success
Download MP3[00:00:00] Dr Genevieve Hayes: Hello and welcome to Your Value Boost from Value Driven Data Science, the podcast that helps data scientists transform from technical implementers to strategic experts by contributing to the decisions that really matter. I am Dr. Genevieve Hayes, and I'm here again with Dr. Tim Varelmann, founder of Bluebird Optimization to boost your strategic impact in less time than it takes to grab a coffee.
[00:00:29] In this episode, you'll learn how to use mathematical modeling as a foundation for machine learning work that delivers reliable business value and sets you up for project success. Welcome back, Tim.
[00:00:42] Dr Tim Varelmann: Hello. Hello. Great to be back.
[00:00:44] Dr Genevieve Hayes: In our previous episode, we talked about combining machine learning and optimization to amplify business value.
[00:00:51] However, there's actually an additional step which you talk about in your writing that can come before either of those to increase your chances of project success. Mathematical modeling from first principles. Now, to be clear, machine learning models are a type of mathematical model, but that's not what we're talking about here.
[00:01:12] Tim, can you explain what you mean when you refer to mathematical models as distinct from machine learning models?
[00:01:20] Dr Tim Varelmann: I think mathematical models in the sense that I use the term is a description of the real world in mathematical terms that computers can understand. 'cause when we as humans describe the real world with just language such as English, there is always an element of ambiguity in it. And we don't have that in mathematics.
[00:01:42] That makes mathematical models very powerful.
[00:01:44] Dr Genevieve Hayes: So would this be something like Newton's three laws of motion being a mathematical model of the movement of objects in the real world?
[00:01:55] Dr Tim Varelmann: Yes, absolutely. Those are fundamental engineering principles and they can be formulated as equations. And equations is some language that computers all over the world understand unambiguously.
[00:02:06] Dr Genevieve Hayes: Okay. Could you give some other examples of the sorts of mathematical models that you're thinking of?
[00:02:11] Dr Tim Varelmann: Close to the new nut axioms. We have simple balance equations, you know that we have mass balances, we have energy balances, and the reason we have these things, and they're so useful in engineering is. Mass doesn't really vanish, neither does energy.
[00:02:28] For energy, we can create energy balances and say, Hey, all of the energy that's coming into some system is also the energy that's leaving it. And the same is true with mass. Those are other fundamental things that we can describe as equations and that we do a lot in engineering related mathematical models.
[00:02:47] Dr Genevieve Hayes: So when you talk about building a model from first principles, these would be the first principles you are referring to. Things like four sequels, mass times acceleration.
[00:02:55] Dr Tim Varelmann: I think the balance equations would actually be the very first level of scaffolding, and then things like force equals mass times acceleration is the second level.
[00:03:06] Dr Genevieve Hayes: Okay? So all of these principles we've just described, these are. Things that you would find in any high school physics textbook. But suppose you're dealing with a field that you're not familiar with. Where do you find these first principles to build your models upon?
[00:03:25] Dr Tim Varelmann: Energy conservation and mass conservation are very basic things. You would be quite hard pressed to find application areas where these don't apply. That's why they are the first level of the scaffolding, in fact, because they are so broadly applicable. But it happens. In our past episode last week, I had an example where I worked with an internet company and they didn't have any physical model for the behavior of their users, but they did have some data. In that case, machine learning is the best way to describe what is going on in the real world. So. This engineering kind of approach based on balance equations is not the and or be all.
[00:04:00] But in the physical world, we often have energy conservation, we often have mass conservation, and therefore that's super, super valuable. And then just broadly applicable, let's say.
[00:04:09] Dr Genevieve Hayes: I get this. So in situations where you don't have these first principles that you'd find in physics textbooks, you would just jump straight to machine learning, but. In situations where these principles apply, this can add an extra layer to the scaffolding, which can make your models more robust.
[00:04:29] Dr Tim Varelmann: Yes, that's absolutely right, and that leads to modularization of your models.
[00:04:33] Dr Genevieve Hayes: Okay. So when you talk about modularization, what do you mean by that?
[00:04:39] Dr Tim Varelmann: As I mentioned, we have these different levels of scaffolding. We start with the balance equations, then we add basic physical laws such as neutrons laws, and we can. Increase the level of resolution with which we describe the real world to a computer, because you might have heard the term that all models are wrong, but some are useful.
[00:05:00] And of course, that's fundamental thing that we need to worry about when we do mathematical optimization. So we want our models to be useful representations of the real world that a computer can work with, and we are never gonna grasp the entirety of the real world. Often we don't need to, when we just do production planning, we don't need to tell a computer what emotions are, for example,
[00:05:23] but you can gradually increase the level of sophistication of your mathematical model. And typically you start with just balance equations for math and for energy. Then you have some basic physics equations, and then. You can have some tiny things where you can say, Hey, I'm in a bathtub and I want to release all of the water that I have in it.
[00:05:43] And you might have seen this, that you have this whirlpool effect when you remove water from the bathtub, and that's a very complex thing for which you have a lot more complex physical. Principles that govern how this happens.
[00:05:58] And you can choose to model this at the full resolution, or you can just choose to say, Hey. At this point, let's just say that doesn't really matter how exactly this is going on. Let's just say we have a constant outflow of mass of water from this bathtub, and that would be a low resolution model of the real world.
[00:06:20] The benefit of that being that the computational cost to solve this model is obviously a lot lower than if we were to fully resolve and do a full computational fluid dynamics analysis of how the water leaves your bathtub.
[00:06:34] Dr Genevieve Hayes: Okay. So these first principles models are your low resolution models, and then machine learning would allow for. A higher resolution? Is that what you're saying?
[00:06:43] Dr Tim Varelmann: Yes. I think it's one way of introducing a higher level resolution. So typically these balance equations, they always have flows, they always deal with, flows somehow you have energy coming in, that's a flow, energy leaving that's also a flow of energy. And the way you describe these flows is subject to super simplicity or to very high sophistication.
[00:07:06] You can just say this flow is constant. Maybe you can assume that the temperature that you have outside of some tank where you store hot water as an energy tank is just constant and therefore you have whatever temperature flux or energy flux outwards. You can achieve from this, and you can also model this with a higher resolution and.
[00:07:27] For a simple tank, you can often get away with a very precise description of the real world when you just assume the outside temperature to be constant of all times. Whereas if you model, let's say, solar collectors, so we're not talking about photo of all tide, but actual solar collectors, which collect a solar beam and produce heat from it, then you have lots of physical phenomena happening.
[00:07:50] You have convection building and you really need. A lot more sophistication in how much your energy outflux from this beam collector is to precisely more to what's going on in the reality. You can't just assume that the outside has constant temperature because you have so high intense solar beams coming into this one point, and that lots of things are going on.
[00:08:13] And yeah, that would just be not accurate.
[00:08:15] Dr Genevieve Hayes: How do you identify when and where machine learning should be added?
[00:08:18] Dr Tim Varelmann: I'd say first of all, obviously always start with something simple, and then you iteratively move to more sophistication because you see that something seems to be working somewhere in the computer, where in the real world it's more difficult than that.
[00:08:32] And then you look at, Hey, where am I simplifying too much? And. Then maybe some of these fluxes of energy outward of a complicated system, maybe machine learning would be a good thing to do there. Or maybe just another approach that is not necessarily machine learning, but just another approach for a more complicated equation to use.
[00:08:52] It doesn't necessarily have to be learned data from machine learning, but you can also do more sophisticated mathematical equations than just assuming some temperature to be constant, let's say.
[00:09:03] Dr Genevieve Hayes: So this is basically a practical example of that old data science saying, which is the first rule of machine learning is don't start with machine learning.
[00:09:13] Dr Tim Varelmann: Definitely true. Yeah.
[00:09:15] Dr Genevieve Hayes: So for data scientists who are interested in incorporating this approach into their workflow, what's one step that they can take tomorrow to get started?
[00:09:23] Dr Tim Varelmann: So I think thinking about modularization really helps in multiple ways. If you have a big model that is comprised of different modules, then it's a lot easier to understand what is really going on. Because at a first glimpse, you can just say, Hey, we have these seven modules.
[00:09:41] They do A, B, and C and here's how they're connected. And that gives your model a structure whereas if you didn't have any modules and you just write everything down in one giant file of computer code, then you would have to deal with 5,000 lines of code and you can't really see anything. But if you have seven different high level entities, and if you say, Hey, I'm actually interested only in two of them, then you can open those two files and they will just have a couple hundred lines of code and that will make your life tremendously easier.
[00:10:10] Dr Genevieve Hayes: So decompose things as much as possible, both at the model level and at the computer code level.
[00:10:16] Dr Tim Varelmann: Absolutely,
[00:10:16] Dr Genevieve Hayes: and that's a wrap for today's value boost. But if you want more insights from Tim, you're in luck. We've got a longer episode with Tim where you'll learn practical strategies for combining machine learning and optimization to boost the business impact of your modeling solutions. And it's packed with practical advice for moving from technical execution to real strategic impact.
[00:10:41] You can find it now wherever you found this episode or at your favorite podcast platform. Thanks for joining me again, Tim. And for those in the audience, thanks for listening. I'm Dr. Genevieve Hayes, and this has been a value driven data science.
Creators and Guests