DALEXtra
DALEXtra copied to clipboard
H2O multiclass error
Hello,
I am not sure if this is an error but when I am using -following- default yhat function
` "H2OMultinomialModel" = { if (!inherits(newdata, "H2OFrame")) { newdata <- h2o::as.h2o(newdata) } ret <- as.data.frame(h2o::h2o.predict(X.model, newdata = newdata)) colnames(ret) <- normalize_h2o_names(colnames(ret))
if (!is.null(attr(X.model, "predict_function_target_column"))) {
return(ret[,attr(X.model, "predict_function_target_column")])
}
ret[,-1]
}`
With this prediction function, predict_parts function gives an error related to dimensions.
So I checked yhatranger source code which returns a matrix. So I made the following custom yhat function, and now predict_parts works normally.
`new_custom <- function(X.model, newdata) {
if (!inherits(newdata, "H2OFrame")) {
newdata <- h2o::as.h2o(newdata)
}
ret <- as.data.frame(h2o::h2o.predict(X.model, newdata = newdata))
colnames(ret) <- normalize_h2o_names(colnames(ret))
if (!is.null(attr(X.model, "predict_function_target_column"))) {
return( **as.matrix(**ret[,attr(X.model, "predict_function_target_column")]))
}
**as.matrix**(ret[,-1])
}`
Hi,
thanks for letting me know about potential issues! Could you please show me a reproducible example (possibly on some dummy date) so I could explore this myself? Would like to check what exactly went wrong
Facing this issue. @ditopcu can you please give a complete solution please or a PR maybe ?