diff --git a/NEWS.md b/NEWS.md index 719a986..88d6063 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,7 +12,8 @@ using new `widget_id` argument * TV plot uses boxplots and barplot when the target `y` has only two unique values (classification) [(#76)](https://github.com/ModelOriented/modelStudio/issues/76) * added more checks for input -* added the Residuals vs Feature plot (RV) [#(84)](https://github.com/ModelOriented/modelStudio/issues/84) +* added the Residuals vs Feature plot (RV) [(#84)](https://github.com/ModelOriented/modelStudio/issues/84) +* added model performance measures to the footnote [#(85)](https://github.com/ModelOriented/modelStudio/issues/85) # modelStudio 1.2.0 * remove redundant documentation resources so that the package weights less diff --git a/R/modelStudio.R b/R/modelStudio.R index d5367a3..fb74284 100644 --- a/R/modelStudio.R +++ b/R/modelStudio.R @@ -314,6 +314,7 @@ modelStudio.explainer <- function(explainer, attr(loss_function, "loss_name"), ...) pd_data <- prepare_partial_dependence(pd_n, pd_c, variables = variable_names) ad_data <- prepare_accumulated_dependence(ad_n, ad_c, variables = variable_names) + mp_data <- DALEX::model_performance(explainer)$measures if (eda) { #:# fd_data is used by targetVs and residualsVs plots @@ -411,10 +412,13 @@ modelStudio.explainer <- function(explainer, # prepare footer text and ms title ms_package_version <- as.character(packageVersion("modelStudio")) ms_creation_date <- Sys.time() - footer_text <- paste0("Site built with modelStudio v", - ms_package_version, - " on ", - format(ms_creation_date, usetz = FALSE)) + version_text <- paste0("Site built with modelStudio v", + ms_package_version, + " on ", + format(ms_creation_date, usetz = FALSE)) + measure_text <- paste(names(mp_data), + round(unlist(mp_data), 3), + sep = ": ", collapse=" | ") if (telemetry) { creation_time <- as.character(as.integer(as.numeric(ms_creation_date - start_time)*60)) @@ -441,7 +445,8 @@ modelStudio.explainer <- function(explainer, model_name = label, variable_names = variable_names, facet_dim = facet_dim, - footer_text = footer_text, + version_text = version_text, + measure_text = measure_text, drop_down_data = jsonlite::toJSON(drop_down_data), eda = eda, widget_id = widget_id, diff --git a/inst/d3js/modelStudio.js b/inst/d3js/modelStudio.js index 6d6dae7..1796c38 100644 --- a/inst/d3js/modelStudio.js +++ b/inst/d3js/modelStudio.js @@ -23,7 +23,8 @@ var TIME = options.time, modelName = options.model_name, variableNames = options.variable_names, dim = options.facet_dim, - footerText = options.footer_text, + versionText = options.version_text, + measureText = options.measure_text, dropDownData = options.drop_down_data, EDA = options.eda, WIDGET_ID = options.widget_id, @@ -275,9 +276,15 @@ function initializeStudio() { BOTTOM_G.append("text") .attr("class", "footerTitle") - .attr("x", studioWidth - 15 - getTextWidth(footerText, 12, 'Fira Sans, sans-serif')) + .attr("x", studioWidth - 15 - getTextWidth(versionText, 12, 'Fira Sans, sans-serif')) .attr("y", studioHeight - studioMargin.bottom + 25) - .text(footerText); + .text(versionText); + + BOTTOM_G.append("text") + .attr("class", "footerTitle") + .attr("x", 15) + .attr("y", studioHeight - studioMargin.bottom + 25) + .text(measureText); BOTTOM_G.append("line") .attr("class", "footerLine")