AUTO_VI$feature_pca {autovi}R Documentation

Conduct principal component analysis for features extracted from keras model

Description

This function conducts principal component analysis for features extracted from keras model.

Usage

AUTO_VI$feature_pca(
  feature = self$select_feature(self$check_result$observed),
  null_feature = self$select_feature(self$check_result$null),
  boot_feature = self$select_feature(self$check_result$boot),
  center = TRUE,
  scale = TRUE
)

Arguments

feature

Dataframe. A data frame where columns represent features and rows represent observations. It should have only one row.

null_feature

Dataframe. A data frame where columns represent features and rows represent observations. These features are extracted during the evaluation of null plots.

boot_feature

Dataframe. A data frame where columns represent features and rows represent observations. These features are extracted during the evaluation of bootstrapped plots.

center

Boolean. Whether to subtract the mean from the feature.

scale

Boolean. Whether to divide the feature by its standard deviation.

Details

Features need to be extracted while running the method AUTO_VI$check() and AUTO_VI$lineup_check() by providing the argument extract_feature_from_layer. Features with zero variance will be ignored from the analysis. See also stats::prcomp().

Value

A tibble of the raw features and the rotated features with attributes sdev and rotation representing the standard deviation of the principal components and the rotation matrix respectively.

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$lineup_check(extract_feature_from_layer = "global_max_pooling2d")
  myvi$feature_pca()
}


[Package autovi version 0.4.0 Index]