DLDA Fails if One Variable Selected
DarioS opened this issue · comments
If feature selection is done before training and prediction in the rare situation the selection step returns only 1 feature, dlda
fails.
Error in colMeans(x[i, ]) :
'x' must be an array of at least two dimensions
This (and perhaps other matrix and data frame subsetting) could be changed to the format x[i, , drop = FALSE]
to ensure endomorphism. It took me a while to realise why the cross-validation loop I made was sometimes crashing after many successful preceding classifications.
@DarioS thanks for opening an issue to let me know. I can't get to this issue today but will by this weekend. PRs welcome.
@DarioS can you give me a reproducible example so that I know specifically what type x
is in your example when dlda
is called?
eh, i guess it doesn't matter as much. it's immediately coerced to as.matrix(x)
.
@DarioS everything should be fixed. please let me know if any other problems pop up.