Kernel Active Subspaces

Module for Kernel-based Active Subspaces.

References
  • Francesco Romor, Marco Tezzele, Andrea Lario, Gianluigi Rozza. Kernel-based active subspaces with application to computational fluid dynamics parametric problems using discontinuous Galerkin method. International Journal for Numerical Methods in Engineering, 123(23):6000–6027, 2022. doi:10.1002/nme.7099

KernelActiveSubspaces._bootstrap_replicate

Return a bootstrap replicate.

KernelActiveSubspaces._build_decompose_cov_matrix

Build and decompose the covariance matrix of the gradients.

KernelActiveSubspaces._compute_bootstrap_ranges

Compute bootstrap ranges for eigenvalues and subspaces.

KernelActiveSubspaces._partition

Partition the eigenvectors to define the active and inactive subspaces.

KernelActiveSubspaces._reparametrize

Computes the pseudo-gradients solving an overdetermined linear system.

KernelActiveSubspaces.fit

Compute the kernel based active subspaces given the inputs and the gradients of the model function wrt the input parameters, or given the input/outputs couples.

KernelActiveSubspaces.inverse_transform

Abstract method to find points in full space that map to reduced variable points.

KernelActiveSubspaces.plot_eigenvalues

Plot the eigenvalues.

KernelActiveSubspaces.plot_eigenvectors

Plot the eigenvectors.

KernelActiveSubspaces.plot_sufficient_summary

Plot the sufficient summary.

KernelActiveSubspaces.transform

Map full variables to active and inactive variables.

class KernelActiveSubspaces(dim, feature_map=None, n_features=None, method='exact', n_boot=None)[source]

Bases: athena.subspaces.Subspaces

Compute the kernel-based active subspaces given the inputs and the gradients of the model function wrt the input parameters, or given the input/outputs couples. Only two methods are available: ‘exact’ and ‘local’.

Parameters
  • feature_map (FeatureMap) – athena.feature_map.FeatureMap object. See FeatureMap class in feature_map module.

  • n_features (int) – dimension of the feature space.

  • method (str) – method to compute the AS. Possible choices are ‘exact’ when the gradients are provided, or ‘local’ to use local linear models. This approach is related to the sufficient dimension reduction method known sometimes as the outer product of gradient method. See the 2001 paper ‘Structure adaptive approach for dimension reduction’ from Hristache, et al.

  • n_boot (int) – number of bootstrap samples. Default is None.

Variables
  • inputs (numpy.ndarray) – input parameters oriented as rows.

  • outputs (numpy.ndarray) – corresponding outputs oriented as rows.

  • gradients (numpy.ndarray) – n_samples-by-n_params matrix containing the gradient samples oriented as rows.

  • weights (numpy.ndarray) – n_samples-by-1 weight vector, corresponds to numerical quadrature rule used to estimate matrix whose eigenspaces define the active subspace.

  • n_features (int) – dimension of the feature space.

  • features (numpy.ndarray) – n_samples-by-n_features matrix containing the projections of the inputs to the n_features-dimensional feature space.

  • pseudo_gradients (numpy.ndarray) –

  • method (str) – method to compute the AS. Possible choices are ‘exact’ when the gradients are provided, or ‘local’ to use local linear models. This approach is related to the sufficient dimension reduction method known sometimes as the outer product of gradient method. See the 2001 paper ‘Structure adaptive approach for dimension reduction’ from Hristache, et al.

  • n_boot (int) – number of bootstrap samples.

  • metric (numpy.ndarray) – metric matrix for vectorial active subspaces.

_reparametrize(inputs, gradients)[source]

Computes the pseudo-gradients solving an overdetermined linear system.

Parameters
  • inputs (numpy.ndarray) – array n_samples-by-n_params containing the points in the original parameter space.

  • gradients (numpy.ndarray) – array n_samples-by-n_params containing the gradient samples oriented as rows.

Returns

array n_samples-by-output_dim-by-n_params matrix containing the pseudo gradients corresponding to each sample; array n_samples-by-n_features containing the image of the inputs in the feature space.

Return type

numpy.ndarray, numpy.ndarray

fit(inputs=None, outputs=None, gradients=None, weights=None, metric=None)[source]

Compute the kernel based active subspaces given the inputs and the gradients of the model function wrt the input parameters, or given the input/outputs couples. Only two methods are available: ‘exact’ and ‘local’.

Parameters
  • inputs (numpy.ndarray) – array n_samples-by-n_params containing the points in the original parameter space.

  • outputs (numpy.ndarray) – array n_samples-by-1 containing the values of the model function.

  • gradients (numpy.ndarray) – array n_samples-by-n_params containing the gradient samples oriented as rows.

  • weights (numpy.ndarray) – n_samples-by-1 weight vector, corresponds to numerical quadrature rule used to estimate matrix whose eigenspaces define the active subspace.

  • metric (numpy.ndarray) – metric matrix output_dim-by-output-dim for vectorial active subspaces.

Raises

TypeError, ValueError

inverse_transform(reduced_inputs, n_points)[source]

Abstract method to find points in full space that map to reduced variable points. Not implemented, it has to be implemented in subclasses.

Parameters
  • reduced_inputs (numpy.ndarray) – n_samples-by-n_params matrix that contains points in the space of active variables.

  • n_points (int) – the number of points in the original parameter space that are returned that map to the given active variables.

transform(inputs)[source]

Map full variables to active and inactive variables. Points in the original input space are mapped to the active and inactive non-linear subspace.

Parameters

inputs (numpy.ndarray) – array n_samples-by-n_params containing the points in the original parameter space.

Returns

array n_samples-by-active_dim containing the mapped active variables; array n_samples-by-inactive_dim containing the mapped inactive variables.

Return type

numpy.ndarray, numpy.ndarray

Raises

TypeError