# rapid_models.doe.adaptive_learning

Adaptive learning DOE package for rapid-models.

## Module Contents

### Functions

 AL_McKay92_idx(gp_std_at_lhs, nNew=1) Active learning by McKay 1992 AL_Cohn96_idx(kernel_fn, X_train, X_lhs, nNew=1) Active learning by Cohn 1996 Function for efficient calculation (using either numpy.einsum dotdot_a_b_aT(a, b) Function for efficient calculation (using either numpy.einsum

Active learning by McKay 1992 Return index of nNew point with highest standard deviation

Parameters
• gp_std_at_lhs (list-like, 1D) – List or array of standard deviation predictions from a Gaussian process (GP) model.The sample size should be a suitably large Latin-hypercube sample (LHS) from the entire valid input range (E.g. $$> 100 \times n$$ where $$n$$ is the number of input dimensions)

• nNew (int, default=1) – Number of largest values to return. nNew = 1 will return the index of the largest value of the input, (decending) of the input values.

Returns

tuple containing:

• idxs _(ndarray, 1D)_: Array of indexes of the nNew largest values in the input.

• Timp _(ndarray, 1D)_: Array of improvement metrics (i.e. the nNew largest values sorted descending).

Return type

(tuple)

Active learning by Cohn 1996 Return index of nNew points which gives the largest global variance reduction

Parameters
• kernel_fn (function) – Gaussian process (GP) kernel function

• X_train (array-like, size n x d) – The training features $$\mathbf{X}$$ where n is dimension size while d is number of training features.

• X_lhs (array-like, size n x s) – Latin hypercube sample to estimate the improvement metric over. Number of samples s should be sufficiently large.

• nNew (int, default=1) – Number of largest values to return. nNew = 1 will return the index of the largest improvement metric value, while nNew = len(X_lhs) will return a sorted list (decending) of the estimated improvement metric values.

Returns

tuple containing:

• idxs _(ndarray, 1D)_: Array of indexes of the nNew largest values in the estimated improvement metric.

• Timp _(ndarray, 1D)_: Array of the sorted (descending) improvement metric values of the nNew largest values.

Return type

(tuple)

Function for efficient calculation (using either numpy.einsum or torch.einsum) of row-wize dot(dot(a,b),aT) where aT==a.T as in:

c=[]
for q in range(len(a)):
c.append( np.dot(np.dot(a[q, :], b), aT[:,q]))
return np.array(c)

Parameters
• a (array-like, 2D) –

• b (array-like, 2D) –

Returns

c (ndarray, 2D)

Function for efficient calculation (using either numpy.einsum or torch.einsum) of row-wize dot(dot(a,b),aT) for all combinations of rows in a and cols in aT as in:

c=[]
for q in range(len(a)):
for qq in range(len(a))
c.append( np.dot(np.dot(a[q, :], b), aT[:,qq]))
return np.array(c)

Parameters
• a (array-like, 2D) –

• b (array-like, 2D) –

Returns

c (ndarray, 2D)