# What is the definition of "confidence interval" around a (complicated) function?

Consider the following excerpt from Chapter 5: Machine Learning Basics from the book titled Deep Learning (by Aaron Courville et al.)

Machine learning is essentially a form of applied statistics with increased emphasis on the use of computers to statistically estimate complicated functions and a decreased emphasis on proving conﬁdence intervals around these functions;

This excerpt says that machine learning focuses on estimating complicated functions, but not on proving conﬁdence intervals around those functions. What is meant by or definition for a confidence interval around a complicated function mentioned here?

Off the top of my head, I don't know the very specific definition of confidence interval (or whether it's only defined for the parameters of a model), as I am not a statistician. In any case, intuitively, a confidence interval is an interval (or range) of values where some true value of something (e.g. your parameter) lies. (Confidence intervals are also very related to hypothesis testing, but I will not dwell on this topic here). You can find the specific definition of a confidence interval in any statistics book (e.g. this one).

Having said that, I interpret that statement as saying that most machine learning approaches do not take into account any type of uncertainty about either the true value of the parameters (e.g. of the neural networks) or the predictions or do not deal with hypothesis testing (recall above that I said that hypothesis testing is closely related to confidence intervals). Typically, in machine learning, you will find a lot of approaches that just provide you with a point estimate for the parameters (i.e. you estimate a single number for each parameter). Consequently, your final neural network (or model) just represents a single function, but what if that function is not really correct (which is probably the case given the typically limited amount of data)? In this case, you cannot say anything about your uncertainty of the true target function that you were trying to approximate or about the prediction for a new input.

Here's where probabilistic/Bayesian machine learning (PML) comes into play. Probabilistic machine learning is a relatively new subfield of machine learning that deals with uncertainty quantification/estimation or that uses tools from Bayesian statistics, like the Bayes theorem. If (deep) neural networks are involved, it is also called Bayesian deep learning (BDL).

For a gentle overview of PML, you can read this paper. If you want to know more about Bayesian neural networks (i.e. neural networks that learn a probability distribution over functions that are consistent with the data), you can read this paper.

So, nowadays, I wouldn't say that that statement is "true", although it was probably true when that book was published. More and more, people in the machine learning community do research in PML and, in particular, BDL, because, if you want to adopt neural networks in areas like healthcare, you need to provide the doctors with some kind of uncertainty quantification of the predictions. Let's say that that a doctor needs to take an action, such as giving some kind of medicine to a patient based on the condition of the patient (e.g. temperature). The doctor doesn't just want to know "yes, give the medicine to the patient". The doctor wants to have an idea of how confident or uncertain the model is about its prediction. This is also where another subfield of AI comes into play, i.e. explainable AI, but I will not dwell more on this topic here.

The confidence interval is a way of quantifying expected error in predictions.

For example, lets say you are trying to model your dart throwing scoring metrics. If you play many games, and assume the score obtained follows a normal distribution, you can do a statistical calculation known as maximum likelihood estimation which provides you with parameters of the normal distribution that best fits the data. This allows you to quantify the error more precisely, so you can say things like: "95% of my games will be at least 200 points", or "having a score this good/bad is a 1 in 1000 chance."

Much of machine learning is about outputting best predictions given some input, and not about quantifying error. So in the above example, we might just output a single value that best captures the underlying statistic, which in the above case, would be the mean of all scores, which is confirmed by the maximum likelihood estimate approach in statistics.

A quick online search returns the definition: "the probability that a population parameter will fall between a set of values for a certain proportion of times.", which seems to agree with the above.

Bar graphs with confidence intervals would be a very clear visual intuition of the idea.