Conduct a auto visual inference check with a computer vision model
Source:R/zzz_auto_visual_inference.R
AUTO_VI-cash-check.Rd
This function conducts a visual inference
check with a computer vision model. The result will be stored in
self$check_result
.
Arguments
- null_draws
Integer. Number of simulation draws for
AUTO_VI$null_vss()
.- boot_draws
Integer. Number of simulation draws for
AUTO_VI$boot_vss()
.- 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 rotationAUTO_VI$rotate_resid()
.- 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_data
Boolean. Whether to keep the simulated data.
- keep_plot
Boolean. Whether to keep the simulated plots.
- extract_feature_from_layer
Character/Integer. A layer name or an integer layer index for extracting features from a layer.
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$check()
myvi
}
#> ✔ Generate null data.
#> ✔ Generate null plots.
#> Computing auxiliary inputs ■■■■■■■■■■■ 35% | ETA: 2s
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 95% | ETA: 0s
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% | ETA: 0s
#> ✔ Compute auxilary inputs.
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 89% | ETA: 0s
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% | ETA: 0s
#> ✔ Predict visual signal strength for 100 images.
#> ✔ Generate bootstrapped data.
#> ✔ Generate bootstrapped plots.
#> 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: no non-missing arguments to min; returning Inf
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■■■ 81% | ETA: 0s
#> Computing auxiliary inputs ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% | ETA: 0s
#> ✔ Compute auxilary inputs.
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■ 78% | ETA: 1s
#> Saving images ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% | ETA: 0s
#> ✔ Predict visual signal strength for 100 images.
#> ✔ Predict visual signal strength for 1 image.
#>
#> ── <AUTO_VI object>
#> Status:
#> - Fitted model: lm
#> - Keras model: (None, 32, 32, 3) + (None, 5) -> (None, 1)
#> - Output node index: 1
#> - Result:
#> - Observed visual signal strength: 3.162 (p-value = 0.009901)
#> - Null visual signal strength: [100 draws]
#> - Mean: 1.216
#> - Quantiles:
#> ╔═════════════════════════════════════════════════╗
#> ║ 25% 50% 75% 80% 90% 95% 99% ║
#> ║0.8494 1.2040 1.5359 1.6450 1.7136 1.8727 2.1145 ║
#> ╚═════════════════════════════════════════════════╝
#> - Bootstrapped visual signal strength: [100 draws]
#> - Mean: 2.705 (p-value = 0.009901)
#> - Quantiles:
#> ╔══════════════════════════════════════════╗
#> ║ 25% 50% 75% 80% 90% 95% 99% ║
#> ║2.312 2.831 3.248 3.315 3.411 3.526 3.690 ║
#> ╚══════════════════════════════════════════╝
#> - Likelihood ratio: 0.5975 (boot) / 9.073e-09 (null) = 65853796