0

I built a logistic regression model with penalty with caret and then i try to create an object through DALEX::explain to subsequently analyze the various aspects of the model. Perhaps the problem lies in having a binary classification model.

Here my reproducible code

library(DALEX)
library(modelStudio)

set.seed(10)

data<- as.data.frame(mtcars)
data$vs<- as.factor(data$vs)
set.seed(10)
trc<- trainControl(method = "repeatedcv", number=3,repeats=4, classProbs=FALSE) 
library(caret)
model <- caret::train(vs~., data=data, trControl= trc, family="binomial", method = "regLogistic")

explainer<- DALEX::explain(
  model = model, 
  data= as.data.frame(data[, -which(colnames(data) %in% "vs")]),
  y = as.numeric(as.character(data$vs)),
  predict_function = predict, 
  label = "regLogistic")

modelStudio::modelStudio(explainer)
Gaetano C.
  • 11
  • 5
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Nov 22 '22 at 20:52

0 Answers0