SVM - LIME - Error in glm.fit(x = x_fit, y = y, weights = weights, family = gaussian()) :
CBRN-git opened this issue · comments
Hello,
In R : After I got my binary classification SVM model using package e1071. I am trying to get local explanations using R LIME package but this error : Error in glm.fit(x = x_fit, y = y, weights = weights, family = gaussian()) : NAs in V(mu)
after running the explain() function.
Here is the code :
model = svm(Label~., data=train,type="nu-classification",kernel="linear",probability = TRUE,gamma=0.5, cost=1,cross=0)
model_type.svm.formula = function(x, ...) {
return("classification")
}
predict_model.svm.formula <- function(x, newdata, type, ...) {
pred = predict(x,newdata,probability=TRUE)
switch(
type,
prob = as.data.frame(attr(pred, "probabilities"))
)
}
explainer_svm = lime(train,model)
explanation_svm = explain(
x = train,
explainer = explainer_svm,
n_permutations = 5000,
dist_fun = "gower",
kernel_width = .75,
n_features = 5,
feature_select = "auto",
labels= c("1")
)
Can you please provide me any help ?
More informations can be found : https://stackoverflow.com/questions/58312042/svm-lime-error-in-glm-fitx-x-fit-y-y-weights-weights-family-gaus
Best regards, thank you.