Skip to content

Commit

Permalink
Non-tibble data frame changes
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Jun 26, 2017
1 parent 2184206 commit 139503f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions models/files/PRIM.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,23 @@ modelInfo <- list(label = "Patient Rule Induction Method",
out
},
fit = function(x, y, wts, param, lev, last, classProbs, ...) {
dat <- if(is.data.frame(x)) x else as.data.frame(x)
out <- supervisedPRIM(x = dat, y = y,
if(!is.data.frame(x) | inherits(x, "tbl_df"))
x <- as.data.frame(x)
out <- supervisedPRIM(x = x, y = y,
peel.alpha = param$peel.alpha,
paste.alpha = param$paste.alpha,
mass.min = param$mass.min,
...)
out
},
predict = function(modelFit, newdata, submodels = NULL){
if(!is.data.frame(newdata) | inherits(newdata, "tbl_df"))
newdata <- as.data.frame(newdata)
predict(modelFit, newdata = newdata, classProb = FALSE)
},
prob = function(modelFit, newdata, submodels = NULL){
if(!is.data.frame(newdata) | inherits(newdata, "tbl_df"))
newdata <- as.data.frame(newdata)
out <- predict(modelFit, newdata = newdata, classProb = TRUE)
out <- data.frame(out, 1 - out)
names(out) <- modelFit$levels[1:2]
Expand Down
Binary file modified pkg/caret/inst/models/models.RData
Binary file not shown.

0 comments on commit 139503f

Please sign in to comment.