What are Models, Cost Functions and Error in AI?

When you start your journey to master AI, you encounter a term called model. What are models in AI? In AI, we talk about building models, which are shaped by cost functions to measure error. So what does this all mean?

What are models?

Models are an estimation of how reality works. These are not just part of AI; our brains use models every day. 

For example:

while driving, we might be able to estimate how fast our car will accelerate if we push down its accelerator pedal. We have a model in our head of the relationship between the pedal and the speed of the car.

We say this model is an estimation of reality. Because when we think about how fast the car will run:

  • we don’t take into account the position of every atom in the engine, wind resistance, and so on. 
  • In fact, we may know nothing about how a car engine works
  • Yet we can still make good guesses as to how fast we will travel.

AI is the process of building models like this by using data, just like we do in everyday life.

When people learn to drive, they often be surprised at how fast (or slow) the car goes when the accelerator pedal is pushed. 

The model in our head starts off very inaccurately. With experience (data), we improve it more and more, until we can estimate very well how the car will react.

AI works in a similar way. If we give a computer a large amount of data about car speeds when the accelerator is pushed. Then, using AI, the computer can build a model that is more accurate than we are.

What is an error?

Error is a measure of how accurate a model is at estimating or predicting something. 

  • Error=( actual – predicted)

Small amounts of error mean the model is accurate. 

Large amounts of error mean 

  • the model makes a lot of mistakes 
  • that it sometimes makes very bad mistakes

What are cost functions?

We learn from our mistakes, and so does AI. Some mistakes need to be taken a lot more seriously than others, though.

For example:

If we are learning to drive on the open road, and we get the speed wrong by 5 mph, this may not matter at all. When we are more than 5 mph over the speed limit, though, the police may give us a fine of Rs 100. If we are more than 10 mph over the limit, this fine may be Rs 500.

Cost is the number we learn from (e.g. the size of the fine). It is calculated from the error (e.g. how badly we estimate our speed). It is also referred to as the penalty. 

In the example:

  • We are unlikely to learn much when we speed 3 mph over the limit, because we do not get a fine.
  • When we speed 11 mph over the limit, the fine is large, and so we learn very quickly to be more careful with the accelerator pedal.

A cost function is the way we convert error into cost.

The cost function above would be :

cost is Rs 100 if they are more than 5 mph over the limit, Rs 500 if they are more than 10 mph over the limit. If they are between the limit and 5 mph over the limit, the cost is Rs 0”.

In AI, things are a little more mathematical than the examples, but the general concepts are the same.

Note that in AI, cost functions are not in dollars, but in unitless numbers. The example above gives an intuitive understanding of how these work. 

In AI the goal is to minimize error as much as possible – which will make our result as accurate as possible.

Summary

  • Models – in AI, models are software that gives a prediction (or estimation) to an example, using data provided to it. For example, an AI model could predict how fast a car will go based on the type of car and how much the accelerator pedal is pushed.
  • Error – how accurate a model is at predicting something.
  • Cost – the error metric models learn from and try to decrease, calculated from the error.
  • Cost functions – a mathematical formula run by software to determine for us the cost of a model. Different models have different cost functions and they are built into the model for us already.

Hope this article helps to find the answer to “What are models in AI?”.

Check out the table of contents for Product Management and Data Science to explore those topics.

Curious about how product managers can utilize Bhagwad Gita’s principles to tackle difficulties? Give this super short book a shot. This will certainly support my work.

Thanks a ton for visiting this website.

Leave a Comment