2

The problem with Bayesian neural network seems to be that it is primarily working for classification problems. Is it possible to adjust this neural network, or even use a different model if one exists, to predict a continuous value and also provide an uncertainty measure?

If it is of any use - I am attempting to predict the amount of chlorophyll present in a plant based off of a drone image. However, I also want to be able to visualize this uncertainty when I create a heatmap of the predicted chlorophyll for each pixel. My thought was that the predicted value could assume a color from the corresponding heatmap, and then the predictive strength (confidence) of that predicted value being accurate could be transformed to an alpha value. The end result would be then a 'faded' pixel if it has low confidence in its prediction.

If Bayes Linear Regression is a better alternative, is it still providing a confidence value with each associated prediction, or am I misunderstanding how it functions? If there are any known tutorials on the topic that I can be guided to, I think I would be thankful?

tds
  • 23
  • 2

1 Answers1

1

Estimating $\mu$ and $\sigma$ directly

A regular neural net used for regression, but with an output that gives you both $\mu$ and $\sigma$ per sample, would work here.

Rather than training the net with the usual regression losses (MSE for example), the loss function would be the negative log likelihood. For each sample, the net would learn to predict a $\mu$ that tracks $y$, or at least a $\sigma$ that brackets $y$ if it can't pin down $\mu$. You can interpret the latter as an uncertainty measure in the prediction for that particular sample.

Explanation and PyTorch example here, and I think there are others as well using the torch.distributions package.

If it is of any use - I am attempting to predict the amount of chlorophyll present in a plant based off of a drone image.

In this case, since you're predicting a strictly positive quantity, you could take a look at the distributions available in torch.distributions. Which ever one you choose (say gamma, for example), you can access its .log_prob(<target_values>).mean() method, and use the negative of that as the loss function for training the net.

Quantile regression

If you don't want to specify the distribution, you could instead run quantile regression. Suppose you want the net to output the 10%, 50% (median), and 90% quantiles. You would add an output layer with 3 units, and train the model with the pinball loss.


I found these videos instructive: Uncertainty Quantification playlist by DeepFindr

The videos and associated Jupyter notebooks cover the two methods I outlined above, as well as MC dropout and others.