Skip to contents

This function predicts the visual signal strength.

Usage

AUTO_VI$vss(
  p = self$plot_resid(),
  auxiliary = NULL,
  keras_model = self$keras_model,
  node_index = self$node_index,
  extract_feature_from_layer = NULL
)

Arguments

p

ggplot/List/Data.frame/Array/Numpy array/String. The input can be

  1. a ggplot,

  2. a list of ggplot,

  3. a data.frame containing .resid (residuals) and .fitted (fitted values) that can be passed to AUTO_VI$plot_resid(),

  4. a 3D array representing an image,

  5. a 4D array representing one or more images,

  6. a path to an image,

  7. a vector or a list of paths to images,

  8. a numpy array.

auxiliary

Dataframe. A dataframe of auxiliary values. This is only used when the keras model has multiple inputs. If it is not provided, the values will be automatically computed based on the residual plot of the fitted model. See also AUTO_VI$auxiliary().

keras_model

Keras model. A trained computer vision model.

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.

extract_feature_from_layer

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

Value

A tibble. The first column is vss which is the prediction, the rest of the columns are features extracted 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$vss()
}
#>  Predict visual signal strength for 1 image.
#> # A tibble: 1 × 1
#>     vss
#>   <dbl>
#> 1  3.16