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 ■■■■■■■■■■■                       32% | ETA:  2s
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■     93% | ETA:  0s
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s
#>  Compute auxilary inputs.
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■         80% | ETA:  1s
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  100% | ETA:  0s
#>  Predict visual signal strength for 100 images.
#> # A tibble: 100 × 1
#>      vss
#>    <dbl>
#>  1 0.740
#>  2 1.17 
#>  3 0.756
#>  4 0.689
#>  5 1.62 
#>  6 0.643
#>  7 0.621
#>  8 1.74 
#>  9 1.81 
#> 10 1.69 
#> # ℹ 90 more rows