Skip to content

Commit 91da18c

Browse files
committed
v3.1.0
1 parent a909856 commit 91da18c

9 files changed

+90
-59
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: modelStudio
22
Title: Interactive Studio for Explanatory Model Analysis
3-
Version: 3.0.0.9000
3+
Version: 3.1.0
44
Authors@R:
55
c(person("Hubert", "Baniecki", role = c("aut", "cre"),
66
email = "[email protected]",

NEWS.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# modelStudio (development)
1+
# modelStudio 3.1.0
2+
* changed y-axis variable labels in `SV` to the same as in `BD`
23
* 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`)
4+
* added new options to `ms_options()`: `**_axis_title`, which allow changing plot-specific axis title (default varies)
35

46
# modelStudio 3.0.0
57
* **BREAKING CHANGES**:

R/modelStudio.R

+4-3
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,8 @@ modelStudio.explainer <- function(explainer,
350350
variable_splits_type=variable_splits_type),
351351
"ingredients::accumulated_dependence (categorical)", show_info, pb, N/30)
352352
}
353-
354-
fi_data <- prepare_feature_importance(fi, max_features_fi, options$show_boxplot,
355-
attr(loss_function, "loss_name"), ...)
353+
354+
fi_data <- prepare_feature_importance(fi, max_features_fi, options$show_boxplot, ...)
356355
pd_data <- prepare_partial_dependence(pd_n, pd_c, variables = variable_names)
357356
ad_data <- prepare_accumulated_dependence(ad_n, ad_c, variables = variable_names)
358357
mp_ret <- calculate(
@@ -495,6 +494,8 @@ modelStudio.explainer <- function(explainer,
495494
if (is.null(options$ms_title)) options$ms_title <- paste0("Interactive Studio for ", label, " Model")
496495
if (!is.null(options$ms_subtitle)) options$ms_margin_top <- options$ms_margin_top + 40
497496
if (is.null(options$margin_left)) options$margin_left <- max(105, 7*max(nchar(variable_names)))
497+
if (is.null(options$fi_axis_title)) options$fi_axis_title <-
498+
ifelse(is.null(attr(loss_function, "loss_name")), "drop-out loss", attr(loss_function, "loss_name"))
498499

499500
options <- c(list(time = time,
500501
model_name = label,

R/ms_options.R

+18-7
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,19 @@
3333
#' \item{default_color}{\code{#371ea3} for Break Down bar and highlighted line.}
3434
#' }
3535
#' }
36-
#' \subsection{Plot specific options:}{
36+
#' \subsection{Plot-specific options:}{
3737
#' \code{**} is a two letter code unique to each plot, might be
3838
#' one of \code{[bd,sv,cp,fi,pd,ad,rv,fd,tv,at]}.\cr
3939
#'
4040
#' \describe{
41-
#' \item{**_title}{Plot specific title. Default varies.}
42-
#' \item{**_subtitle}{Plot specific subtitle. Default is \code{subtitle}.}
43-
#' \item{**_bar_width}{Plot specific width of bars. Default is \code{bar_width},
41+
#' \item{**_title}{Plot-specific title. Default varies.}
42+
#' \item{**_subtitle}{Plot-specific subtitle. Default is \code{subtitle}.}
43+
#' \item{**_axis_title}{Plot-specific axis title. Default varies.}
44+
#' \item{**_bar_width}{Plot-specific width of bars. Default is \code{bar_width},
4445
#' ignored when \code{scale_plot = TRUE}.}
45-
#' \item{**_line_size}{\code{line_size} Plot specific width of lines. Default is \code{line_size}.}
46-
#' \item{**_point_size}{Plot specific point radius. Default is \code{point_size}.}
47-
#' \item{**_*_color}{Plot specific \code{[bar,line,point]} color. Default is \code{[bar,line,point]_color}.}
46+
#' \item{**_line_size}{Plot-specific width of lines. Default is \code{line_size}.}
47+
#' \item{**_point_size}{Plot-specific point radius. Default is \code{point_size}.}
48+
#' \item{**_*_color}{Plot-specific \code{[bar,line,point]} color. Default is \code{[bar,line,point]_color}.}
4849
#' }
4950
#' }
5051
#'
@@ -131,18 +132,21 @@ ms_options <- function(...) {
131132
default_color = "#371ea3",
132133
bd_title = "Break Down",
133134
bd_subtitle = NULL,
135+
bd_axis_title = "contribution",
134136
bd_bar_width = NULL,
135137
bd_positive_color = NULL,
136138
bd_negative_color = NULL,
137139
bd_default_color = NULL,
138140
sv_title = "Shapley Values",
139141
sv_subtitle = NULL,
142+
sv_axis_title = "contribution",
140143
sv_bar_width = NULL,
141144
sv_positive_color = NULL,
142145
sv_negative_color = NULL,
143146
sv_default_color = NULL,
144147
cp_title = "Ceteris Paribus",
145148
cp_subtitle = NULL,
149+
cp_axis_title = "prediction",
146150
cp_bar_width = NULL,
147151
cp_line_size = NULL,
148152
cp_point_size = 3,
@@ -151,34 +155,41 @@ ms_options <- function(...) {
151155
cp_point_color = "#371ea3",
152156
fi_title = "Feature Importance",
153157
fi_subtitle = NULL,
158+
fi_axis_title = NULL,
154159
fi_bar_width = NULL,
155160
fi_bar_color = NULL,
156161
pd_title = "Partial Dependence",
157162
pd_subtitle = NULL,
163+
pd_axis_title = "average prediction",
158164
pd_bar_width = NULL,
159165
pd_line_size = NULL,
160166
pd_bar_color = NULL,
161167
pd_line_color = NULL,
162168
ad_title = "Accumulated Dependence",
163169
ad_subtitle = NULL,
170+
ad_axis_title = "accumulated prediction",
164171
ad_bar_width = NULL,
165172
ad_line_size = NULL,
166173
ad_bar_color = NULL,
167174
ad_line_color = NULL,
168175
rv_title = "Residuals vs Feature",
169176
rv_subtitle = NULL,
177+
rv_axis_title = "residuals",
170178
rv_point_size = NULL,
171179
rv_point_color = NULL,
172180
fd_title = "Feature Distribution",
173181
fd_subtitle = NULL,
182+
fd_axis_title = "count",
174183
fd_bar_width = NULL,
175184
fd_bar_color = NULL,
176185
tv_title = "Target vs Feature",
177186
tv_subtitle = NULL,
187+
tv_axis_title = "target",
178188
tv_point_size = NULL,
179189
tv_point_color = NULL,
180190
at_title = "Average Target vs Feature",
181191
at_subtitle = NULL,
192+
at_axis_title = "average target",
182193
at_bar_width = NULL,
183194
at_line_size = NULL,
184195
at_point_size = 3,

R/prepare.R

-2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ prepare_ceteris_paribus <- function(x, variables = NULL) {
286286
}
287287

288288
prepare_feature_importance <- function(x, max_features = 10, show_boxplot = TRUE,
289-
x_title = NULL,
290289
margin = 0.15, digits = 3, rounding_function = round,
291290
...) {
292291
### Return the object for the FeatureImportance plot ###
@@ -357,7 +356,6 @@ prepare_feature_importance <- function(x, max_features = 10, show_boxplot = TRUE
357356
ret$x <- new_x
358357
ret$m <- m
359358
ret$x_min_max <- min_max
360-
ret$x_title <- ifelse(is.null(x_title), "drop-out loss", x_title)
361359
ret$desc <- data.frame(type = "desc",
362360
text = gsub("\n","</br>", desc))
363361

0 commit comments

Comments
 (0)