Hello oasjd7!



 oasjd7:

The Ground Truth label is [0.0,1.0]. And I want to predict this scalar value.


If by this you mean that each individual training sample is assigned a
ground-truth target of either 0.0 or 1.0, I would call this a binary
value (although still technically a scalar).


In this case, What losses can be used ?


For a binary classification problem BCEWithLogitsLoss will be your
best choice for the loss function.


Can I use MSE loss with nn.Linear(input_dim, 1)?


You could, but general experience shows that for binary classification
MSELoss won’t work nearly as well as BCEWithLogitsLoss.
If your ground-truth target value were a (morally speaking) continuous
variable, then MSELoss would be the sensible choice.
For example, if you were training a network to predict the price of used
cars (given, say, model, miles, age, rust, etc.) and your training data
included known prices, the MSELoss would be the natural choice.
Best.
K. Frank