sug_basis {cheem}R Documentation

Suggest a 1D Basis

Description

Extract and formats the 1D attribution basis from the provided local explanation.

Usage

sug_basis(attr_df, rownum)

Arguments

attr_df

A data frame of local explanation attributions.

rownum

The rownumber of the observation. Typically primary or comparison observations.

Value

A matrix of the 1D basis.

See Also

radial_cheem_tour()

Other cheem utility: as_logical_index(), color_scale_of(), contains_nonnumeric(), is_discrete(), is_diverging(), linear_tform(), logistic_tform(), problem_type(), rnorm_from(), sug_manip_var()

Examples

library(cheem)

## Attribution basis of the primary instance
sug_basis(ames_rf_shap, rownum = 1)


## This can be used to find a basis to start the radial tour.
# ?radial_cheem_tour

## Regression setup:
dat  <- amesHousing2018_NorthAmes
X    <- dat[, 1:9]
Y    <- dat$SalePrice
clas <- dat$SubclassMS

## radial_cheem_tour()
ames_rf_chm <- cheem_ls(X, Y, ames_rf_shap, ames_rf_pred, clas,
                        label = "North Ames, RF, SHAP")
bas <- sug_basis(ames_rf_shap, 1)
mv  <- sug_manip_var(ames_rf_shap, 1, 2)
ggt <- radial_cheem_tour(ames_rf_chm, basis = bas, manip_var = mv)
if(interactive()){
  ## As a plotly html widget
  spinifex::animate_plotly(ggt)
  
  ## As a gganimation
  spinifex::animate_gganimate(ggt, render = gganimate::av_renderer())
}
## radial_cheem_tour is also used in: ?run_app()

[Package cheem version 0.4.0.0 Index]