Skip to content

Commit 7c91928

Browse files
committed
Wine challenge does not accepts empty excellent category as a solution.
1 parent a0de3f5 commit 7c91928

File tree

1 file changed

+4
-1
lines changed
  • inst/shiny/C03Ca_ml_wine

1 file changed

+4
-1
lines changed

inst/shiny/C03Ca_ml_wine/app.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ score_model <- function(x, reference = wine2quality) {
5757
c("autre", "excellent")[(as.character(x) == "excellent") + 1]
5858
wine_true2 <-
5959
c("autre", "excellent")[(as.character(reference) == "excellent") + 1]
60+
# If there is no excellent in the result, the model is rejected
61+
if (!sum(wine_true2 == "excellent"))
62+
return(structure(NA,
63+
message = "Il faut classer au moins un vin dans 'excellent', or il n'y en a aucun dans votre solution. Corrigez et resoumettez !"))
6064
res <- summary(confusion(as.factor(wine_pred2), as.factor(wine_true2)))
61-
#res
6265
# Precision for 'excellent' must by higher than 25%
6366
prec <- res["excellent", "Precision"]
6467
if (prec < 0.25)

0 commit comments

Comments
 (0)