Skip to content

Commit 46024ff

Browse files
committed
add max_features_fi
1 parent bfa9243 commit 46024ff

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# modelStudio (development)
2+
* added new parameter to `modelStudio()`: `max_features_fi = max_features`, which allows displaying a distinctive number of features in `FI` plot (other than in `BD` and `SV`)
3+
14
# modelStudio 3.0.0
25
* **BREAKING CHANGES**:
36
* this version requires `R >=3.6`, `DALEX >=2.2.1`, `ingredients >=2.2.0` and `iBreakDown >=2.0.1`

R/modelStudio.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
#' See \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#instance-explanations}{\bold{vignette}}
3232
#' @param facet_dim Dimensions of the grid. Default is \code{c(2,2)}.
3333
#' @param time Time in ms. Set the animation length. Default is \code{500}.
34-
#' @param max_features Maximum number of features to be included in BD and SV plots.
34+
#' @param max_features Maximum number of features to be included in BD, SV, and FI plots.
3535
#' Default is \code{10}.
36+
#' @param max_features_fi Maximum number of features to be included in FI plot. Default is \code{max_features}.
3637
#' @param max_vars An alias for \code{max_features}. If provided, it will override the value.
3738
#' @param N Number of observations used for the calculation of PD and AD. Default is \code{300}.
3839
#' See \href{https://modelstudio.drwhy.ai/articles/ms-perks-features.html#more-calculations-means-more-time}{\bold{vignette}}
@@ -178,6 +179,7 @@ modelStudio.explainer <- function(explainer,
178179
facet_dim = c(2,2),
179180
time = 500,
180181
max_features = 10,
182+
max_features_fi = NULL,
181183
N = 300,
182184
N_fi = N*10,
183185
N_sv = N*3,
@@ -208,6 +210,7 @@ modelStudio.explainer <- function(explainer,
208210
model_type <- explainer$model_info$type
209211

210212
if (!is.null(max_vars)) max_features <- max_vars
213+
if (is.null(max_features_fi)) max_features_fi <- max_features
211214
if (!is.null(verbose)) show_info <- verbose
212215
if (is.null(N)) stop("`N` argument must be an integer")
213216
#if (identical(N_fi, numeric(0))) N_fi <- NULL
@@ -348,7 +351,7 @@ modelStudio.explainer <- function(explainer,
348351
"ingredients::accumulated_dependence (categorical)", show_info, pb, N/30)
349352
}
350353

351-
fi_data <- prepare_feature_importance(fi, max_features, options$show_boxplot,
354+
fi_data <- prepare_feature_importance(fi, max_features_fi, options$show_boxplot,
352355
attr(loss_function, "loss_name"), ...)
353356
pd_data <- prepare_partial_dependence(pd_n, pd_c, variables = variable_names)
354357
ad_data <- prepare_accumulated_dependence(ad_n, ad_c, variables = variable_names)

man/modelStudio.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)