claremarieegan Mar/ 21/ 2019 | 0

Hey everyone! Welcome back! Today I want to talk about mathematical models. It seems like everywhere we go, someone is talking about mathematical models! Models created through machine learning techniques are all the rage today, but these are not the only kinds of mathematical models out there.

Mathematical models can come in many forms - they can be complicated models developed from neural networks or they can be simple models like determining the volume of an object.

Volume = Length x Width x Height - yes, as simple as that is, that is a mathematical model!

Mathematical models can describe all difference types of phenomena - in subjects ranging from physics to sociology to economics and beyond. I’ve said it before, and I’ll say it again - math impacts all aspects of our lives! One of the reasons this is true is because so many things in our lives can be described using mathematical models.

So let’s talk about model specifics. First of all, what is a mathematical model?

A mathematical model is basically a description of a phenomenon that uses mathematical concepts.

Now that might be a bit of a vague definition, but I think sometimes it’s a good thing to think about math in somewhat general terms. If we started going through code that created different models using machine learning, you might think, wait, no - I can’t understand that. But you can!

The key is start with the basics and slowly work your way towards the more complicated stuff. The good thing though, is that the complicated stuff is also the interesting stuff!

But back to the basics. So, let’s say you have some phenomena, some process or some problem in your life that you want to define using mathematical concepts. What do you do?

Let’s choose something super simple: we want to create a model that describe the cost of an object using its volume. So where do we start?

First, let’s talk about the building blocks of any mathematical model - variables, equations, and constraints.

Variables: these are the different parameters you want to include in your model.

Based on the description of our model: cost using volume, we already have the two variables - cost and volume. Cost is our output variable - this is what the model will give us at the end. And volume is our input variable that has a relationship to cost.

Equations: these explain the relationships between our variables.

We all know what equations look like, and sometimes equations can be difficult to understand and make math a painful experience. So thinking about equations as descriptors of relationships can help give you a new way to understand them.

Let’s say our object is aluminum, and aluminum costs \$3.30 / cubic centimeter (totally making this up by the way, I do not have knowledge on aluminum pricing, but this will do for now). We can take \$3.30 and create an equation to describe the relationship between our output variable Cost and our input variable Volume.

This is what we end up with:

Cost = \$3.30 x Volume

So that’s already a good looking mathematical model, but let’s look at our last building block: Constraints. Constraints are things that limit our model in some way. In this example, we might not have any constraints, but what if I told you that the most expensive object that the model can describe is one that costs \$50. This would be a constraint.

Along with constraints, you can also have assumptions that you are presuming your model will follow. For example, a model model could assume that Volume is at least 10 cubic centimeters (maybe because otherwise the price of aluminum will change). These are all things you need to take into account.

So we’ve just made a very simple mathematical model, but these same building blocks carry over into more complicated models as well!

Now let’s talk about what we do when we are done building our model. We need same way to determine how good of a model it is. We need to be able to evaluate its performance. How do we go about doing this?

There are a ton of different ways to evaluate model performance, but I am going to talk about the most basic implementation of a popular technique called cross-validation.

Cross-validation has to do with taking the data you used to create your model and splitting it up into training data and test data.

Let’s look at how this works. To start, let’s talk about our model using \$3.30 / cubic centimeter of aluminum. Before I just made a blanket statement that this was our price, but in real life, you don’t just make up model coefficients. You use data and various mathematical and statistical techniques to determine these what these coefficients are.

So let’s make a sample data set with 6 aluminum objects and give them each data for price and volume.

 Object Price Volume Price / Cubic Centimeter A \$66 20 \$3.30 B \$46.20 14 \$3.30 C \$75.90 22 \$3.45 D \$49.50 15 \$3.30

To use the cross-validation technique, we split our data set into a training set and test set. Our training set - let’s say objects A and B - is the data we use to build our model. So when we build our model, we totally ignore objects C and D.

From objects A and B, we get our cost model: Cost = \$3.30 x Volume.

Now, we want to use our test set to evaluate model performance. When talking about model performance, the key question we are trying to ask: how good will the model be at predicting the cost of some other aluminum object E?

We plug in our data for objects C and D (our test set) into our model.

For object C, volume = 22 cubic centimeters. Plugging this into our cost model, we get:

22 x 3.30 = \$72.60

For object D, volume = 15, so we have:

15 x 3.30 = \$49.50

Clearly, for object D, our model was correct, but for object C our model was off. Now, in real life, we would use statistical metrics to determine the error of our model, but even without doing that, we can see that we might want to revise our model to accommodate for objects that don’t have \$3.30 as the price / cubic centimeter.

This is the essence of cross-validation. Build your model with some of your data, and then test it’s performance on the rest of your data to see how well your model does in the real world. In fact, more complex implementations of cross-validation are used to evaluate model performance of machine learning algorithms!

There is so much more to discuss about mathematical models, but for this post, I just wanted to touch on the basics. Hopefully, you can start to get an idea of how the basics translate into more sophisticated mathematical models.

That’s the great thing about math. Its all about mastering the building blocks and once you can do that, the complicated stuff won’t be complicated anymore.