I have, in some sense, an opposite question to Is it okay to use cross entropy loss function with soft labels? which is why is it ok NOT to use soft labels in classification?
Let's say you have a binary classification task you want to solve. Here's how you'd normally go about it. You start with some unknown probability distribution $u(y=1|x)$. You approximate $u(y=1|x)$ by sampling from it to generate a dataset (probability distribution $p(y=1|x)$). Then you create a model $q(y=1|x)$. You then fit the model to probability distribution $p(y=1|x)$ by minimizing cross entropy loss between $q(y=1|x)$ and $p(y=1|x)$.
To compute cross entropy it's commonly assumed that $p(y=1|x)$ is always 1 or 0 even though it's not necessarily true - for example imagine that in our dataset there are two patients with the same weight, height etc but one is ill and the other is not - if so $p(y=1|x) = 1/2$. In contrast, you'd normally set the 1st sample $p(y=1|x)$ as 0 and the 2nd one as 1. Why is it so extremely common to make this assumption? Is it a safe assumption and if so why? In other words why aren't soft labels ALWAYS used for classification tasks?
EDIT: additional clarification. If I have a finite dataset, the $p(y=1|x)$ is a finite probability distribution. I can use the cross entropy formula to measure $q(y=1|x)$ estimator error like so $$ CE(p, q) = \sum_{x \in X} p(y=1|x) log(q(y=1|x)) $$ Let's say my dataset consists of two feature-outcome vectors $(f_1, ... f_p, 0)$ and $(f_1, ..., f_p, 1)$. Then I compute cross entropy like this (I will abbreviate $p(y=1|x)$ as $p(x)$). $$ X = \{x_0\} = \{(f_1, ..., f_p)\} \\ p(x_0) = 0.5 \\ CE(p, q) = \sum_{x \in X} p(x)log(q(x)) = p(x_0)log(q(x_0)) = 0.5log(q(x_0)) $$ On the other hand, here's how people often talk about implementing cross entropy (example)
$$ X = \{x_0, x_1\}; \; x_0 = x_1 \\ p(x_0) = 0; \; p(x_1) = 1 \\ x_0 = x_1 \implies q(x_0) = q(x_1) \\ CE(p, q) = \frac{1}{|X|}\sum_{x \in X}p(x)log(q(x)) = \frac{1}{2}(0 \cdot log(q(x_0)) + 1 \cdot log(q(x_1))) = 0.5log(q(x_0)) $$ I have three problems with this:
- It is not mathematically sound to say that $p(x_0) = 0$ and $p(x_1) = 1$ because $x_0 = x_1 \implies p(x_0) = p(x_1)$
- In this case I ended up with the same number but I don't know if it's always the case.
- I don't know how to relate one definition to the other (this is very similar to this unanswered question
p(y=1|x) = 1/2
as an observation? When you look at the data, you have one feature-outcome vector of $(f_1, \dots, f_p, 0)$ and another of $(f_1, \dots, f_p, 1)$, agreed? $\endgroup$p(y=1|x) = 1/2
as an observation". What I meant to say is I have two observations (samples) from which I can deduct thatp(y=1|x) = 1/2
. These observations are $(f_1, ..., f_p, 0)$ and $(f_1, ..., f_p, 1)$ exactly like you said. $\endgroup$