Skip to contents

This function simulates null plots from the null hypothesis distribution, and predicts the visual signal strength.

Usage

AUTO_VI$null_vss(
  draws = 100L,
  fitted_model = self$fitted_model,
  keras_model = self$keras_model,
  null_method = self$null_method,
  node_index = self$node_index,
  keep_null_data = FALSE,
  keep_null_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.

null_method

Function. A method to simulate residuals from the null hypothesis distribution. For lm, the recommended method is residual rotation AUTO_VI$rotate_resid().

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_null_data

Boolean. Whether to keep the simulated null data.

keep_null_plot

Boolean. Whether to keep the simulated null 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$null_vss()
}
#>  Generate null data.
#>  Generate null plots.
#> Computing auxiliary inputs ■■■■■■■■■■■                       35% | ETA:  2s
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■           72% | ETA:  1s
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s
#>  Compute auxilary inputs.
#> Saving images ■■■■■■■■■■■■■■■■■■■■              64% | ETA:  1s
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s
#>  Predict visual signal strength for 100 images.
#> # A tibble: 100 × 1
#>      vss
#>    <dbl>
#>  1 3.00 
#>  2 0.608
#>  3 0.971
#>  4 1.15 
#>  5 1.21 
#>  6 1.03 
#>  7 0.918
#>  8 1.30 
#>  9 1.25 
#> 10 1.22 
#> # ℹ 90 more rows