|
152 | 152 | table$addColumnInfo(name = "smoothing", title = gettext("Smoothing"), type = "number")
|
153 | 153 | } else if (type == "logistic") {
|
154 | 154 | table$addColumnInfo(name = "family", title = gettext("Family"), type = "string")
|
| 155 | + table$addColumnInfo(name = "link", title = gettext("Link"), type = "string") |
155 | 156 | }
|
156 | 157 | # Add common columns
|
157 | 158 | table$addColumnInfo(name = "nTrain", title = gettext("n(Train)"), type = "integer")
|
|
324 | 325 | table$title <- gettext("Model Summary: Multinomial Regression Classification")
|
325 | 326 | }
|
326 | 327 | family <- classificationResult[["family"]]
|
| 328 | + link <- classificationResult[["link"]] |
327 | 329 | row <- data.frame(
|
328 | 330 | family = paste0(toupper(substr(family, 1, 1)), substr(family, 2, nchar(family))),
|
| 331 | + link = paste0(toupper(substr(link, 1, 1)), substr(link, 2, nchar(link))), |
329 | 332 | nTrain = nTrain,
|
330 | 333 | nTest = classificationResult[["ntest"]],
|
331 | 334 | testAcc = classificationResult[["testAcc"]]
|
|
585 | 588 | levels(predictions) <- unique(dataset[, options[["target"]]])
|
586 | 589 | } else if (type == "logistic") {
|
587 | 590 | if (classificationResult[["family"]] == "binomial") {
|
588 |
| - fit <- glm(formula, data = dataset, family = "binomial") |
| 591 | + fit <- glm(formula, data = dataset, family = stats::binomial(link = "logit")) |
589 | 592 | predictions <- as.factor(round(predict(fit, grid, type = "response"), 0))
|
590 | 593 | levels(predictions) <- unique(dataset[, options[["target"]]])
|
591 | 594 | } else {
|
592 |
| - fit <- VGAM::vglm(formula, data = dataset, family = "multinomial") |
| 595 | + fit <- VGAM::vglm(formula, data = dataset, family = VGAM::multinomial()) |
593 | 596 | logodds <- predict(fit, newdata = grid)
|
594 | 597 | ncategories <- ncol(logodds) + 1
|
595 | 598 | probabilities <- matrix(0, nrow = nrow(logodds), ncol = ncategories)
|
|
743 | 746 | fit <- e1071::naiveBayes(formula = formula, data = typeData, laplace = options[["smoothingParameter"]])
|
744 | 747 | score <- max.col(predict(fit, test, type = "raw"))
|
745 | 748 | } else if (type == "logistic") {
|
746 |
| - fit <- glm(formula, data = typeData, family = "binomial") |
| 749 | + fit <- glm(formula, data = typeData, family = stats::binomial(link = "logit")) |
747 | 750 | score <- round(predict(fit, test, type = "response"), 0)
|
748 | 751 | }
|
749 | 752 | pred <- ROCR::prediction(score, actual.class)
|
|
1164 | 1167 | }
|
1165 | 1168 |
|
1166 | 1169 | .calcAUCScore.logisticClassification <- function(AUCformula, test, typeData, options, jaspResults, ...) {
|
1167 |
| - fit <- glm(AUCformula, data = typeData, family = "binomial") |
| 1170 | + fit <- glm(AUCformula, data = typeData, family = stats::binomial(link = "logit")) |
1168 | 1171 | score <- round(predict(fit, test, type = "response"), 0)
|
1169 | 1172 | return(score)
|
1170 | 1173 | }
|
0 commit comments