Skip to contents

This function bootstrap the data and refits the model, then predicts the visual signal strength of the bootstrapped residual plots.

Usage

AUTO_VI$boot_vss(
  draws = 100L,
  fitted_model = self$fitted_model,
  keras_model = self$keras_model,
  data = self$get_data(),
  node_index = 1L,
  keep_boot_data = FALSE,
  keep_boot_plot = FALSE,
  extract_feature_from_layer = NULL
)

Arguments

draws

Integer. Number of simulation draws.

fitted_model

Model. A model object, e.g. lm.

keras_model

Keras model. A trained computer vision model.

data

Data frame. The data used to fit the model. See also AUTO_VI$get_data().

node_index

Integer. An index indicating which node of the output layer contains the visual signal strength. This is particularly useful when the keras model has more than one output nodes.

keep_boot_data

Boolean. Whether to keep the bootstrapped data.

keep_boot_plot

Boolean. Whether to keep the bootstrapped plots.

extract_feature_from_layer

Character/Integer. A layer name or an integer layer index for extracting features from a layer.

Value

A tibble.

Examples

keras_model <- try(get_keras_model("vss_phn_32"))
if (!inherits(keras_model, "try-error")) {
  myvi <- auto_vi(lm(dist ~ speed, data = cars), keras_model)

  myvi$boot_vss()
}
#>  Generate bootstrapped data.
#>  Generate bootstrapped plots.
#> Warning: Problem in area computation (Returns NA)
#> Computing auxiliary inputs ■■■■■■■■■■                        29% | ETA:  2s
#> Warning: shull: complete hull invisible, data scaling error, will retry with some jitter
#> Warning: shull: complete hull invisible, data scaling error, will retry with some jitter
#> Warning: shull: complete hull invisible, data scaling error, will retry with some jitter
#> Warning: no non-missing arguments to min; returning Inf
#> Warning: shull: complete hull invisible, data scaling error, will retry with some jitter
#> Warning: Problem in area computation (Returns NA)
#> Warning: shull: complete hull invisible, data scaling error, will retry with some jitter
#> Warning: no non-missing arguments to min; returning Inf
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s
#>  Compute auxilary inputs.
#> Saving images ■■■■■■■■■■                        29% | ETA:  2s
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■    98% | ETA:  0s
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s
#>  Predict visual signal strength for 100 images.
#> # A tibble: 100 × 1
#>      vss
#>    <dbl>
#>  1 2.86 
#>  2 0.876
#>  3 2.29 
#>  4 3.20 
#>  5 3.11 
#>  6 2.73 
#>  7 3.53 
#>  8 3.24 
#>  9 2.58 
#> 10 2.93 
#> # ℹ 90 more rows