EthanRosenthal / spacecutter

Ordinal regression models in PyTorch
https://www.ethanrosenthal.com/2018/12/06/spacecutter-ordinal-regression/
MIT License
136 stars 16 forks source link

some question about the code #15

Closed Shu-HowTing closed 1 month ago

Shu-HowTing commented 2 months ago
class OrdinalLogisticModel(nn.Module):
"""
 Parameters
    ----------
    predictor : nn.Module
        When called, must return a torch.FloatTensor with shape [batch_size, 1]
"""

hello , thank u for sharing! I have a question here. why return a torch.FloatTensor with shape [batch_size, 1]. Shouldn't it be return a torch.FloatTensor with shape [batch_size, num_class - 1]?

Shu-HowTing commented 2 months ago

oh,sorry,maybe you are right, no matter what the value of $num\_class$, the predictor output the logit value of the sample. it should be a scalar. just like the linear regression!

EthanRosenthal commented 2 months ago

Yup, exactly!