diff --git a/R/modelStudio.R b/R/modelStudio.R index fccd0e2..3ee197e 100644 --- a/R/modelStudio.R +++ b/R/modelStudio.R @@ -42,7 +42,7 @@ #' @param eda Compute EDA plots and Residuals vs Feature plot, which adds the data to the dashboard. Default is \code{TRUE}. #' @param show_info Verbose a progress on the console. Default is \code{TRUE}. #' @param parallel Speed up the computation using \code{parallelMap::parallelMap()}. -#' See \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html#parallel-computation}{\bold{vignette}}. +#' See \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#parallel-computation}{\bold{vignette}}. #' This might interfere with showing progress using \code{show_info}. #' @param options Customize \code{modelStudio}. See \code{\link{ms_options}} and #' \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#additional-options-1}{\bold{vignette}}. @@ -74,8 +74,8 @@ #' } #' #' @seealso -#' Vignettes: \href{https://modeloriented.github.io/modelStudio/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} -#' and \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} +#' Vignettes: \href{https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} +#' and \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} #' #' @examples #' library("DALEX") @@ -98,7 +98,8 @@ #' #' # make a studio for the model #' modelStudio(explainer_titanic, -#' new_observations) +#' new_observations, +#' N = 200, B = 5) # faster example #' #' \donttest{ #' diff --git a/R/ms_options.R b/R/ms_options.R index 3b41ec3..dda37be 100644 --- a/R/ms_options.R +++ b/R/ms_options.R @@ -57,8 +57,8 @@ #' } #' #' @seealso -#' Vignettes: \href{https://modeloriented.github.io/modelStudio/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} -#' and \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} +#' Vignettes: \href{https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} +#' and \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} #' #' @examples #' library("DALEX") diff --git a/R/ms_update_observations.R b/R/ms_update_observations.R index df04ea7..f64f0ae 100644 --- a/R/ms_update_observations.R +++ b/R/ms_update_observations.R @@ -15,7 +15,7 @@ #' See \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#more-calculations-means-more-time}{\bold{vignette}} #' @param show_info Verbose a progress on the console. Default is \code{TRUE}. #' @param parallel Speed up the computation using \code{parallelMap::parallelMap()}. -#' See \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html#parallel-computation}{\bold{vignette}}. +#' See \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#parallel-computation}{\bold{vignette}}. #' This might interfere with showing progress using \code{show_info}. #' @param widget_id Use an explicit element ID for the widget (rather than an automatically generated one). #' Useful e.g. when using \code{modelStudio} with Shiny. @@ -37,8 +37,8 @@ #' } #' #' @seealso -#' Vignettes: \href{https://modeloriented.github.io/modelStudio/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} -#' and \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} +#' Vignettes: \href{https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} +#' and \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} #' #' @examples #' library("DALEX") @@ -53,7 +53,8 @@ #' y = titanic_imputed$survived) #' #' # make a studio for the model -#' ms <- modelStudio(explainer_titanic) +#' ms <- modelStudio(explainer_titanic, +#' N = 200, B = 5) # faster example #' #' \donttest{ #' diff --git a/R/ms_update_options.R b/R/ms_update_options.R index d2551b8..0c21feb 100644 --- a/R/ms_update_options.R +++ b/R/ms_update_options.R @@ -23,8 +23,8 @@ #' } #' #' @seealso -#' Vignettes: \href{https://modeloriented.github.io/modelStudio/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} -#' and \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} +#' Vignettes: \href{https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} +#' and \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} #' #' @examples #' library("DALEX") @@ -39,7 +39,8 @@ #' y = titanic_imputed$survived) #' #' # make a studio for the model -#' ms <- modelStudio(explainer_titanic) +#' ms <- modelStudio(explainer_titanic, +#' N = 200, B = 5) # faster example #' #' # update the options #' new_ms <- ms_update_options(ms, diff --git a/README.md b/README.md index 9c1e995..b1f7d40 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,11 @@ explainer <- explain(model, modelStudio(explainer) ``` -[Save the output](http://modelstudio.drwhy.ai/#save--share) in the form of a HTML file - [**Demo Dashboard**](https://modeloriented.github.io/modelStudio/demo.html). +[Save the output](http://modelstudio.drwhy.ai/#save--share) in the form of a HTML file - [**Demo Dashboard**](https://modelstudio.drwhy.ai/demo.html). ![](man/figures/long.gif) -## R & Python Examples [more](http://modelstudio.drwhy.ai/articles/ms-r-python-examples.html) +## R & Python Examples [more](https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html) ------------------------------- @@ -69,7 +69,7 @@ install.packages("DALEX") install.packages("DALEXtra") ``` -### mlr [dashboard](https://modeloriented.github.io/modelStudio/mlr.html) +### mlr [dashboard](https://modelstudio.drwhy.ai/mlr.html) Make a studio for the regression `ranger` model on `apartments` data. @@ -111,7 +111,7 @@ modelStudio(explainer, -### xgboost [dashboard](https://modeloriented.github.io/modelStudio/xgboost.html) +### xgboost [dashboard](https://modelstudio.drwhy.ai/xgboost.html) Make a studio for the classification `xgboost` model on `titanic` data. @@ -173,7 +173,7 @@ Use `pickle` Python module and `reticulate` R package to easily make a studio fo install.packages("reticulate") ``` -### scikit-learn [dashboard](https://modeloriented.github.io/modelStudio/scikitlearn.html) +### scikit-learn [dashboard](https://modelstudio.drwhy.ai/scikitlearn.html) Make a studio for the regression `Pipeline SVR` model on `fifa` data. @@ -224,7 +224,7 @@ modelStudio(explainer, B = 5, -### lightgbm [dashboard](https://modeloriented.github.io/modelStudio/lightgbm.html) +### lightgbm [dashboard](https://modelstudio.drwhy.ai/lightgbm.html) Make a studio for the classification `Pipeline LGBMClassifier` model on `titanic` data. @@ -339,9 +339,9 @@ If you use `modelStudio`, please cite our [JOSS article](https://joss.theoj.org/ - Theoretical introduction to the plots: [Explanatory Model Analysis: Explore, Explain and Examine Predictive Models](https://pbiecek.github.io/ema) - - Vignettes: [modelStudio - perks and features](https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html) and [modelStudio - R & Python examples](https://modeloriented.github.io/modelStudio/articles/ms-r-python-examples.html) + - Vignettes: [modelStudio - perks and features](https://modelstudio.drwhy.ai/articles/ms-perks-features.html) and [modelStudio - R & Python examples](https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html) - - Changelog: [NEWS](https://modeloriented.github.io/modelStudio/news/index.html) + - Changelog: [NEWS](https://modelstudio.drwhy.ai/news/index.html) - Conference poster: [MLinPL2019](https://github.com/ModelOriented/modelStudio/blob/master/misc/MLinPL2019_modelStudio_poster.pdf) diff --git a/man/modelStudio.Rd b/man/modelStudio.Rd index 5863caf..d9ca0b3 100644 --- a/man/modelStudio.Rd +++ b/man/modelStudio.Rd @@ -57,7 +57,7 @@ See \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#more-calc \item{show_info}{Verbose a progress on the console. Default is \code{TRUE}.} \item{parallel}{Speed up the computation using \code{parallelMap::parallelMap()}. -See \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html#parallel-computation}{\bold{vignette}}. +See \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#parallel-computation}{\bold{vignette}}. This might interfere with showing progress using \code{show_info}.} \item{options}{Customize \code{modelStudio}. See \code{\link{ms_options}} and @@ -124,7 +124,8 @@ rownames(new_observations) <- c("Lucas","James") # make a studio for the model modelStudio(explainer_titanic, - new_observations) + new_observations, + N = 200, B = 5) # faster example \donttest{ @@ -192,6 +193,6 @@ modelStudio(explainer_HR, } } \seealso{ -Vignettes: \href{https://modeloriented.github.io/modelStudio/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} -and \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} +Vignettes: \href{https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} +and \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} } diff --git a/man/ms_options.Rd b/man/ms_options.Rd index f8edc3c..9e2e2c4 100644 --- a/man/ms_options.Rd +++ b/man/ms_options.Rd @@ -104,6 +104,6 @@ modelStudio(explainer_apartments, } } \seealso{ -Vignettes: \href{https://modeloriented.github.io/modelStudio/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} -and \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} +Vignettes: \href{https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} +and \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} } diff --git a/man/ms_update_observations.Rd b/man/ms_update_observations.Rd index 77741c3..4f9eac7 100644 --- a/man/ms_update_observations.Rd +++ b/man/ms_update_observations.Rd @@ -37,7 +37,7 @@ See \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#more-calc \item{show_info}{Verbose a progress on the console. Default is \code{TRUE}.} \item{parallel}{Speed up the computation using \code{parallelMap::parallelMap()}. -See \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html#parallel-computation}{\bold{vignette}}. +See \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#parallel-computation}{\bold{vignette}}. This might interfere with showing progress using \code{show_info}.} \item{widget_id}{Use an explicit element ID for the widget (rather than an automatically generated one). @@ -69,7 +69,8 @@ explainer_titanic <- explain(model_titanic, y = titanic_imputed$survived) # make a studio for the model -ms <- modelStudio(explainer_titanic) +ms <- modelStudio(explainer_titanic, + N = 200, B = 5) # faster example \donttest{ @@ -102,6 +103,6 @@ ms } } \seealso{ -Vignettes: \href{https://modeloriented.github.io/modelStudio/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} -and \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} +Vignettes: \href{https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} +and \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} } diff --git a/man/ms_update_options.Rd b/man/ms_update_options.Rd index 90a3759..70055dd 100644 --- a/man/ms_update_options.Rd +++ b/man/ms_update_options.Rd @@ -70,7 +70,8 @@ explainer_titanic <- explain(model_titanic, y = titanic_imputed$survived) # make a studio for the model -ms <- modelStudio(explainer_titanic) +ms <- modelStudio(explainer_titanic, + N = 200, B = 5) # faster example # update the options new_ms <- ms_update_options(ms, @@ -90,6 +91,6 @@ new_ms } } \seealso{ -Vignettes: \href{https://modeloriented.github.io/modelStudio/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} -and \href{https://modeloriented.github.io/modelStudio/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} +Vignettes: \href{https://modelstudio.drwhy.ai/articles/ms-r-python-examples.html}{\bold{modelStudio - R & Python examples}} +and \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html}{\bold{modelStudio - perks and features}} } diff --git a/tests/testthat/test_2_0.R b/tests/testthat/test_2_0.R index 67bad90..633550a 100644 --- a/tests/testthat/test_2_0.R +++ b/tests/testthat/test_2_0.R @@ -40,7 +40,8 @@ testthat::expect_true(!isTRUE(case1$x$options$telemetry)) case2 <- testthat::expect_silent( modelStudio::modelStudio(exp_fifa, data_fifa[1:2,], max_vars = 5, rounding_funtion = signif, - digits = 3, show_info = v)) + digits = 3, + N = 5, B = 2, show_info = v)) testthat::expect_true( all(c("mse:", "rmse:", "r2:", "mad:") %in% strsplit(case2$x$options$measure_text, split=" ")[[1]])) diff --git a/tests/testthat/test_modelStudio.R b/tests/testthat/test_modelStudio.R index 40b90f1..cb5cb98 100644 --- a/tests/testthat/test_modelStudio.R +++ b/tests/testthat/test_modelStudio.R @@ -2,71 +2,76 @@ context("Check modelStudio() function") source("test_objects.R") +N = 10 +B = 2 + ms1 <- testthat::expect_silent(modelStudio::modelStudio(explain_glm, new_observation = titanic_test[1,-9], show_info = v)) ms4 <- testthat::expect_silent(modelStudio::modelStudio(explain_glm_numerical, new_observation = titanic_test[1:2, c(2,6,7,8)], - N = 50, B = 10, + N = N, B = B, show_info = v)) ms5 <- testthat::expect_silent(modelStudio::modelStudio(explain_glm_not_numerical, new_observation = titanic_test[1:2, c(1,3,4,5)], - N = 50, B = 10, + N = N, B = B, show_info = v)) ms6 <- testthat::expect_silent(modelStudio::modelStudio(explain_model_small, new_observation = titanic_test[1:2, c(1,2)], - N = 50, B = 10, + N = N, B = B, show_info = v)) ms_readme <- testthat::expect_silent(modelStudio::modelStudio(explain_titanic_glm, new_observations, - facet_dim = c(2,2), N = 200, B = 20, time = 0, + facet_dim = c(2,2), + N = N, B = B, time = 0, show_info = v)) ms_rf_apartments <- testthat::expect_silent(modelStudio::modelStudio(explain_rf, new_observation = apartments[1:2,-1], - N = 50, B = 10, facet_dim = c(3,3), + N = N, B = B, facet_dim = c(3,3), time = 50, max_features = 4, show_info = v)) both_without_target <- testthat::expect_silent(modelStudio::modelStudio(explain_both_without_target, new_observation = nx, - N = 10, - B = 2, + N = N, + B = B, show_info = v)) both_full <- testthat::expect_silent(modelStudio::modelStudio(explain_both_full, new_observation = nz, - N = 10, - B = 2, + N = N, + B = B, show_info = v)) obs_without_target_data_full <- testthat::expect_silent(modelStudio::modelStudio(explain_obs_without_target_data_full, new_observation = nx, - N = 10, - B = 2, + N = N, + B = B, show_info = v)) obs_full_data_without_target <- testthat::expect_silent(modelStudio::modelStudio(explain_obs_full_data_without_target, new_observation = nz, - N = 10, - B = 2, + N = N, + B = B, show_info = v)) ms_big <- testthat::expect_silent(modelStudio::modelStudio(explain_artifficial, - new_observation = artifficial[1:2,], N = 5, B = 2, + new_observation = artifficial[1:2,], + N = N, B = B, facet_dim = c(3,3), show_info = v)) ms_parallel <- modelStudio::modelStudio(explain_glm, new_observation = titanic_test[1:2,-9], - N = 5, B = 2, parallel = TRUE, + N = N, B = B, parallel = TRUE, show_info = v) ms_parallel_rf <- modelStudio::modelStudio(explain_rf, new_observation = apartments[1:5,-1], - N = 5, B = 2, parallel = TRUE, + N = N, B = B, parallel = TRUE, show_info = v) # tests @@ -115,13 +120,18 @@ testthat::test_that("parallel rf", { }) testthat::test_that("show_info_and_new_observation_y", { - testthat::expect_is(modelStudio::modelStudio(explain_glm), "r2d3") + testthat::expect_is(modelStudio::modelStudio(explain_glm, + titanic_test[1:2,-9], + titanic_test[1:2, 9], + N = N, B = B, show_info = TRUE), "r2d3") }) testthat::test_that("eda = FALSE", { - testthat::expect_is(modelStudio::modelStudio(explain_glm, eda = FALSE), "r2d3") + testthat::expect_is(modelStudio::modelStudio(explain_glm, eda = FALSE, + N = N, B = B, show_info = v), "r2d3") }) testthat::test_that("xgboost matrix", { - testthat::expect_is(modelStudio::modelStudio(explainer_xgb), "r2d3") + testthat::expect_is(modelStudio::modelStudio(explainer_xgb, + N = N, B = B, show_info = v), "r2d3") }) diff --git a/vignettes/ms-perks-features.Rmd b/vignettes/ms-perks-features.Rmd index c1c6305..7c1ce74 100644 --- a/vignettes/ms-perks-features.Rmd +++ b/vignettes/ms-perks-features.Rmd @@ -172,7 +172,7 @@ to calculate local explainers faster. It is really useful when using `modelStudi complicated models, vast datasets or **many observations are being processed**. All options can be set outside of the function call. -[How to use parallelMap](https://github.com/berndbischl/parallelMap#being-lazy-configuration). +[How to use parallelMap](https://github.com/mlr-org/parallelMap#being-lazy-configuration). ```{r eval = FALSE} # set up the cluster @@ -194,7 +194,7 @@ modelStudio(explainer, Customize some of the `modelStudio` looks by overwriting default options returned by the `ms_options()` function. -[Full list of options](http://modelstudio.drwhy.ai/reference/ms_options.html). +[Full list of options](https://modelstudio.drwhy.ai/reference/ms_options.html). ```{r eval = FALSE} # set additional graphical parameters diff --git a/vignettes/ms-r-python-examples.Rmd b/vignettes/ms-r-python-examples.Rmd index fa4a44d..d6c70f3 100644 --- a/vignettes/ms-r-python-examples.Rmd +++ b/vignettes/ms-r-python-examples.Rmd @@ -31,7 +31,7 @@ install.packages("DALEX") install.packages("DALEXtra") ``` -### mlr [dashboard](https://modeloriented.github.io/modelStudio/mlr.html) +### mlr [dashboard](https://modelstudio.drwhy.ai/mlr.html) In this example we will make a studio for the `ranger` model on `apartments` data. @@ -68,7 +68,7 @@ modelStudio(explainer, new_observation) ``` -### mlr3 [dashboard](https://modeloriented.github.io/modelStudio/mlr3.html) +### mlr3 [dashboard](https://modelstudio.drwhy.ai/mlr3.html) In this example we will make a studio for the `ranger` model on `titanic` data. @@ -109,7 +109,7 @@ modelStudio(explainer, new_observation) ``` -### xgboost [dashboard](https://modeloriented.github.io/modelStudio/xgboost.html) +### xgboost [dashboard](https://modelstudio.drwhy.ai/xgboost.html) In this example we will make a studio for the `xgboost` model on `titanic` data. @@ -150,7 +150,7 @@ modelStudio(explainer, options = ms_options(margin_left = 140)) ``` -### caret [dashboard](https://modeloriented.github.io/modelStudio/caret.html) +### caret [dashboard](https://modelstudio.drwhy.ai/caret.html) In this example we will make a studio for the `gbm` model on `titanic` data. @@ -189,7 +189,7 @@ modelStudio(explainer, new_observation) ``` -### h2o [dashboard](https://modeloriented.github.io/modelStudio/h2o.html) +### h2o [dashboard](https://modelstudio.drwhy.ai/h2o.html) In this example we will make a studio for the `h2o.automl` model on `titanic` data. @@ -236,7 +236,7 @@ modelStudio(explainer, h2o.shutdown(prompt = FALSE) ``` -### parsnip [dashboard](https://modeloriented.github.io/modelStudio/parsnip.html) +### parsnip [dashboard](https://modelstudio.drwhy.ai/parsnip.html) In this example we will make a studio for the `ranger` model on `apartments` data. @@ -269,7 +269,7 @@ explainer <- explain(model, modelStudio(explainer) ``` -### tidymodels [dashboard](https://modeloriented.github.io/modelStudio/tidymodels.html) +### tidymodels [dashboard](https://modelstudio.drwhy.ai/tidymodels.html) In this example we will make a studio for the `ranger` model on `titanic` data. @@ -334,7 +334,7 @@ Use `pickle` Python module and `reticulate` R package to easily make a studio fo install.packages("reticulate") ``` -### scikit-learn [dashboard](https://modeloriented.github.io/modelStudio/scikitlearn.html) +### scikit-learn [dashboard](https://modelstudio.drwhy.ai/scikitlearn.html) In this example we will make a studio for the `Pipeline SVR` model on `fifa` data. @@ -380,7 +380,7 @@ modelStudio(explainer, B = 5, options = ms_options(margin_left = 160)) ``` -### lightgbm [dashboard](https://modeloriented.github.io/modelStudio/lightgbm.html) +### lightgbm [dashboard](https://modelstudio.drwhy.ai/lightgbm.html) In this example we will make a studio for the `Pipeline LGBMClassifier` model on `titanic` data. @@ -455,7 +455,7 @@ library(modelStudio) modelStudio(explainer) ``` -### keras/tensorflow [dashboard](https://modeloriented.github.io/modelStudio/keras.html) +### keras/tensorflow [dashboard](https://modelstudio.drwhy.ai/keras.html) In this example we will make a studio for the `Pipeline KerasClassifier` model on `titanic` data.