scholar
scholar copied to clipboard
Bug in Cross-Entropy Implementation inside `Scholar.Linear.LogisticRegression`?
I believe there is a reduction missing (probably Nx.mean/2
) in the implementation of cross-entropy inside Scholar.Linear.LogisticRegression
.
https://github.com/elixir-nx/scholar/blob/975938a4e57704ad2400aa89ec18761cc0e45ce4/lib/scholar/linear/logistic_regression.ex#L188
xs
is a tensor of shape {num_samples, num_features}
, ys
is a tensor of shape {num_samples, num_classes}
(one-hot encoded). Hence, the expression above evaluates to a tensor of shape {num_samples}
. I don't know how exactly does Polaris
handle vectors, but I guess the loss should be a scalar.