Skip to content
Discussion options

You must be logged in to vote

Why binary uses out_features=1 but multiclass uses out_features=num_classes

The label is always just 1 number in both cases (e.g. 0/1, or 0/1/2/3). What's different is how many numbers the model needs to output before it decides on that label.

Binary (out_features = 1)
Since there are only 2 classes, they're complements of each other. If P(class 1) = 0.91, then P(class 0) is automatically 1 - 0.91 = 0.09. So you only need 1 raw number → pass through sigmoid → that's your probability for class 1.

Think of it like a boolean flag: you don't store is_active and is_inactive separately, one implies the other.

Multiclass (out_features = num_classes)
With 4+ classes there's no complement trick — …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ZaidKhan-git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants