athena.active.ActiveSubspaces._sample_inactive¶
-
ActiveSubspaces.
_sample_inactive
(reduced_input, n_points)[source]¶ Sample inactive variables.
Sample values of the inactive variables for a fixed value of the active variables when the original variables are bounded by a hypercube.
- Parameters
reduced_input (numpy.ndarray) – the value of the active variables.
n_points (int) – the number of inactive variable samples,
- Returns
n_points-by-(inactive_dim) matrix that contains values of the inactive variable that correspond to the given reduced_input.
- Return type
Note
The trick here is to sample the inactive variables z so that -1 <= W1*y + W2*z <= 1, where y is the given value of the active variables. In other words, we need to sample z such that it respects the linear inequalities W2*z <= 1 - W1*y, -W2*z <= 1 + W1*y. These inequalities define a polytope in R^(inactive_dim). We want to sample N points uniformly from the polytope. This function first tries a simple rejection sampling scheme, which finds a bounding hyperbox for the polytope, draws points uniformly from the bounding hyperbox, and rejects points outside the polytope. If that method does not return enough samples, the method tries a “hit and run” method for sampling from the polytope. If that does not work, it returns an array with N copies of a feasible point computed as the Chebyshev center of the polytope.