Skip to contents

This function bootstrap the data and refits the model by using AUTO_VI$boot_method(), 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: no non-missing arguments to min; returning Inf
#> 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 ■■■■■■■■■■■■                      38% | ETA:  2s
#> Warning: shull: complete hull invisible, data scaling error, will retry with some jitter
#> Warning: Problem in area computation (Returns NA)
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s
#>  Compute auxilary inputs.
#> Saving images ■■■■■■■■■■■                       32% | ETA:  2s
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■   99% | ETA:  0s
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s
#>  Predict visual signal strength for 100 images.
#> # A tibble: 100 × 1
#>      vss
#>    <dbl>
#>  1  3.56
#>  2  3.07
#>  3  3.24
#>  4  2.44
#>  5  2.84
#>  6  3.56
#>  7  3.52
#>  8  3.08
#>  9  1.99
#> 10  2.82
#> # ℹ 90 more rows