If arena is static it will start calculations for all already pushed observations and global plots. If arena is live, then plots will be calculated on demand, after calling arena_run.

push_model(arena, explainer)

Arguments

arena

live or static arena object

explainer

Explainer created using DALEX::explain

Value

Updated arena object

Examples

library("DALEX") library("arenar") library("dplyr", quietly=TRUE, warn.conflicts = FALSE) # create first model model1 <- glm(m2.price ~ ., data=apartments, family=gaussian) # create a DALEX explainer explainer1 <- DALEX::explain(model1, data=apartments, y=apartments$m2.price, label="GLM gaussian")
#> Preparation of a new explainer is initiated #> -> model label : GLM gaussian #> -> data : 1000 rows 6 cols #> -> target variable : 1000 values #> -> predict function : yhat.glm will be used ( default ) #> -> predicted values : numerical, min = 1781.848 , mean = 3487.019 , max = 6176.032 #> -> model_info : package stats , ver. 4.0.2 , task regression ( default ) #> -> residual function : difference between y and yhat ( default ) #> -> residuals : numerical, min = -247.4728 , mean = 2.093656e-14 , max = 469.0023 #> A new explainer has been created!
# create live arena with only one model arena <- create_arena(live=TRUE) %>% push_model(explainer1) print(arena)
#> ===== Live Arena Summary ===== #> Observations: #> Variables: construction.year, surface, floor, no.rooms, district #> Models: GLM gaussian #> Datasets: #> Remember to start server with run_server(arena)
# create and add next model model2 <- glm(m2.price ~ ., data=apartments, family=Gamma) explainer2 <- DALEX::explain(model2, data=apartments, y=apartments$m2.price, label="GLM gamma")
#> Preparation of a new explainer is initiated #> -> model label : GLM gamma #> -> data : 1000 rows 6 cols #> -> target variable : 1000 values #> -> predict function : yhat.glm will be used ( default ) #> -> predicted values : numerical, min = 2310.017 , mean = 3487.019 , max = 8037.469 #> -> model_info : package stats , ver. 4.0.2 , task regression ( default ) #> -> residual function : difference between y and yhat ( default ) #> -> residuals : numerical, min = -2020.469 , mean = -2.479255e-12 , max = 1029.545 #> A new explainer has been created!
arena <- arena %>% push_model(explainer2) print(arena)
#> ===== Live Arena Summary ===== #> Observations: #> Variables: construction.year, surface, floor, no.rooms, district #> Models: GLM gaussian, GLM gamma #> Datasets: #> Remember to start server with run_server(arena)