`Error in y * 0 : non-numeric argument to binary operator'
-- Factor works, but unsure whether factor is handled as discrete classes (via a logistic / multinomial regression) or coerced into continuous numeric (via linear regression)
-- Proposed solution:
Always coerce character into factor
if(class(y) == "character"){
y <- factor(y)
}
Then convert factor into 1-hot encoding of class labels
if(class(y) == "factor"){
keras::to_categorical(as.numeric(y)-1) # <- -1 because keras, being Python, uses zero indexing
}
2-part bug report / question,
-- When using character, error is thrown:
`Error in y * 0 : non-numeric argument to binary operator'
-- Factor works, but unsure whether factor is handled as discrete classes (via a logistic / multinomial regression) or coerced into continuous numeric (via linear regression)
-- Proposed solution:
Always coerce character into factor
Then convert factor into 1-hot encoding of class labels