c2st fails when one feature is constant
Baschdl opened this issue · 1 comments
Baschdl commented
Describe the bug
Running c2st
/c2st_scores
with the default z_scores=True
when at least one feature is constant (all data points have the same value for this feature) fails with ValueError: Input X contains NaN. RandomForestClassifier does not accept missing values encoded as NaN natively...
.
This is caused by dividing the data by the standard deviation of this feature (which is zero):
Lines 161 to 165 in 83e122a
To Reproduce
from sbi.utils.metrics import c2st
import torch
X, Y = torch.ones(5,2), torch.zeros(5,2)
c2st(X, Y)