Skip to content

Commit

Permalink
fix cran
Browse files Browse the repository at this point in the history
  • Loading branch information
hbaniecki committed Sep 10, 2020
1 parent ed3c700 commit 85b6927
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 66 deletions.
9 changes: 5 additions & 4 deletions R/modelStudio.R
Original file line number Diff line number Diff line change
Expand Up @@ -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}}.
Expand Down Expand Up @@ -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")
Expand All @@ -98,7 +98,8 @@
#'
#' # make a studio for the model
#' modelStudio(explainer_titanic,
#' new_observations)
#' new_observations,
#' N = 200, B = 5) # faster example
#'
#' \donttest{
#'
Expand Down
4 changes: 2 additions & 2 deletions R/ms_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
9 changes: 5 additions & 4 deletions R/ms_update_observations.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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")
Expand All @@ -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{
#'
Expand Down
7 changes: 4 additions & 3 deletions R/ms_update_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

-------------------------------

Expand All @@ -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.

Expand Down Expand Up @@ -111,7 +111,7 @@ modelStudio(explainer,

</details>

### 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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -224,7 +224,7 @@ modelStudio(explainer, B = 5,

</details>

### 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.

Expand Down Expand Up @@ -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)

Expand Down
9 changes: 5 additions & 4 deletions man/modelStudio.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/ms_options.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions man/ms_update_observations.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/ms_update_options.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/testthat/test_2_0.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]]))
Expand Down
48 changes: 29 additions & 19 deletions tests/testthat/test_modelStudio.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
})
Loading

0 comments on commit 85b6927

Please sign in to comment.