Negative values in regression model

username: Uzair
cooked: <p>I have created a GCN-CNN regression model, the main aim is to run the model on a drug database and identify drugs with lowest binding affinity to a protein sequence. The model acquired reasonably good MSE loss during training and made pretty good predictions on test data.<br>
When I used the model on a drug dataset to make predictions, the problem is some of its predictions are negative, I think its perhaps fine for a regression model to output negative predictions, and they are not many (just about 50-60 out of over 1 lac predictions in the drug database). But since my objective is to identify the drugs with lowest binding values, do these negative values mean the predicted binding affinities are very low and actually among the lowest? since these are on top when I sorted the prediction list so should I select them or are these some random predictions and I should ignore them and select the lowest values that are in positive?<br>
I tried getting rid of this using ReLU but that obviously turned these values into 0, another issue is if I use this data in publication, it might look odd if I cite negative values predicted by out model, or even 0.</p>

username: KFrank
cooked: <p>Hi Uzair!</p>
<p>Short story:  Consider training your regression model to predict the <em>log</em> of<br>
your binding affinities.  Binding affinities that are (very) close to zero will map<br>
to log-affinities that are (large) negative numbers, so the fact that your<br>
regression can predict negative values will now be logically consistent.</p>
<aside class="quote no-group" data-username="Uzair" data-post="1" data-topic="197405" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/uzair/48/62230_2.png" class="avatar"> Uzair:</div>
<blockquote>
<p>some of its predictions are negative, I think its perhaps fine for a regression model to output negative predictions</p>
</blockquote>
</aside>
<p>Yes, it is perfectly reasonable for a regression model to predict a negative<br>
value (that is close to zero) when the correct value would have been a<br>
positive value (that is close to zero).</p>
<aside class="quote no-group">
<blockquote>
<p>But since my objective is to identify the drugs with lowest binding values, do these negative values mean the predicted binding affinities are very low and actually among the lowest?</p>
</blockquote>
</aside>
<p>Probably yes.  (Some other problem could be throwing things off, but the<br>
mere fact that the predicted value is negative is not a red flag.)</p>
<aside class="quote no-group">
<blockquote>
<p>since these are on top when I sorted the prediction list so should I select them</p>
</blockquote>
</aside>
<p>Again, probably yes.</p>
<p>However, think about what a binding affinity means.  You might consider<br>
a binding affinity of 0.09 to be only modestly weaker than a binding affinity<br>
of 0.10 (the difference being 0.01).  But you might consider a binding affinity<br>
of 0.000001 to be a lot weaker than a binding affinity of 0.001, even though<br>
it’s “only” about 0.001 smaller.</p>
<p>If you look at things this way, then performing a regression on log-affinities<br>
(using a mean-squared-error loss) is logically the natural thing to do.</p>
<p>Best.</p>
<p>K. Frank</p>