To answer my question, I will use three types of models -
- KNN Regression
- Regression Trees
- Complex models like NN or SVM
KNN Regression
It is a non-parametric regression model, and the confidence might be explicitly modeled using mean absolute error or mean squared error. At the test time, for a given instance, K nearest instances will be found, and depending on their average distance with the given instance, we can compute mean absolute error or mean squared error. We can estimate the confidence using these metrics. A higher mean absolute error or mean squared error would result in a lower confidence value and vice versa.
Regression Trees
When building the tree during the training time, we make the leaf nodes by assigning the average target value of the associated instances to the node. While doing so, we can also assign and maintain the average mean absolute error or mean squared error between the average target value and the target values of the associated instances of the node. Similar to taking the standard deviation of the target values of the instances of that node. So, at the test time, for a given instance, when the tree reaches a specific leaf node, along with the regression target value, we will also get the mean absolute error or mean squared error we can expect for instances that end up at these nodes. And as explained in KNN regression, we can model confidence accordingly.
Complex models like NN or SVM
These simple techniques discussed above could be applied to these models as well. Just like KNN regression, at the test time, for a test instance, we might be able to find the nearest K instances from the training set and compute mean absolute error or mean squared error to get estimated confidence. But, there is a lot more we can do. You can read more on this thread (https://stats.stackexchange.com/questions/247551/how-to-determine-the-confidence-of-a-neural-network-prediction) where people discuss something very similar that you might find useful.