Regrssion problem #7461
-
I am building a script that has two models: the first model is a standard binary classification; the second is regression. My dataset contains three y values, the first two are for the binary class the second is the float for the regression. The problem is that for the binary classes containing 0, the regression value is an empty array. For instance, in the raw data, we classify something as being able to perform function x, if yes, class 1, if not, class 0. If it gets class 1, give me its regression value. Now, if the model predicts a false 1, its going to see no regression value, or an nan etc. Any suggestions? At the moment, my second issue is that in my dataset creation, its not giving the regression value at all because I used an if statement. I was trying to produce a dataset that where only the graphs that had
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You would probably want to give this invalid regression values a loss1 = F.binary_cross_entropy(...)
mask = y == 1
loss2 = F.mse_loss(out_reg[mask], y_reg[mask]) Thus, avoiding making use of |
Beta Was this translation helpful? Give feedback.
You would probably want to give this invalid regression values a
float('NaN')
when creating your tensor. Afterwards, I think your training loss function looks asThus, avoiding making use of
NaN
ground-truth values during training.