Parameter Selection#
- mellon.parameters.compute_L(x, cov_func, landmarks=None, rank=0.999, method='auto', jitter=1e-06)#
Compute an \(L\) such that \(L L^\top \approx K\), where \(K\) is the covariance matrix.
- Parameters:
x (array-like) – The training instances.
cov_func (function) – The Gaussian process covariance function.
landmarks (array-like) – The landmark points. If None, computes a full rank decompostion. Defaults to None.
rank (int or float) – The rank of the approximate covariance matrix. If rank is an int, an \(n \times\) rank matrix \(L\) is computed such that \(L L^\top \approx K\), the exact \(n \times n\) covariance matrix. If rank is a float 0.0 \(\le\) rank \(\le\) 1.0, the rank/size of \(L\) is selected such that the included eigenvalues of the covariance between landmark points account for the specified percentage of the sum of eigenvalues. Defaults to 0.999.
method (str) – Explicitly specifies whether rank is to be interpreted as a fixed number of eigenvectors or a percent of eigenvalues to include in the low rank approximation. Supports ‘fixed’, ‘percent’, or ‘auto’. If ‘auto’, interprets rank as a fixed number of eigenvectors if it is an int and interprets rank as a percent of eigenvalues if it is a float. Defaults to ‘auto’.
jitter (float) – A small amount to add to the diagonal. Defaults to 1e-6.
- Returns:
\(L\) - A matrix such that \(L L^\top \approx K\).
- Return type:
array-like
- mellon.parameters.compute_cov_func(cov_func_curry, ls)#
Computes the Gaussian process covariance function from its generator and length scale.
- Parameters:
cov_func_curry (function or type) – The covariance function generator.
ls (float) – The length scale of the covariance function.
- Returns:
cov_func - The Gaussian process covariance function k(x, y) \(\rightarrow\) float.
- Return type:
function
- mellon.parameters.compute_d(x)#
Computes the dimensionality of the data equal to the size of axis 1.
- Parameters:
x (array-like) – The training instances.
- mellon.parameters.compute_initial_value(nn_distances, d, mu, L)#
Computes the initial value for Maximum A Posteriori optimization with Ridge regression, such that the initial value \(z\) minimizes \(||Lz + mu - mle(nn\text{_}distances, d)|| + ||z||\).
- Parameters:
nn_distances (array-like) – The observed nearest neighbor distances.
d (int) – The local dimensionality of the data.
mu (int) – The Gaussian Process mean.
L (array-like) – A matrix such that \(L L^\top \approx K\), where \(K\) is the covariance matrix.
- Returns:
initial_value - The argmin \(z\).
- Return type:
array-like
- mellon.parameters.compute_landmarks(x, n_landmarks=5000)#
Computes the landmark points as k-means centroids. If n_landmarks is less than 1 or greater than or equal to the number of training instances, returns None.
- Parameters:
x (array-like) – The training instances.
n_landmarks (int) – The number of landmark points.
- Returns:
landmark_points - k-means centroids.
- Return type:
array-like
- mellon.parameters.compute_ls(nn_distances)#
Computes ls equal to the geometric mean of the nearest neighbor distances times a constant.
- Parameters:
nn_distances (array-like) – The observed nearest neighbor distances.
- Returns:
ls - The geometric mean of the nearest neighbor distances times a constant.
- Return type:
float
- mellon.parameters.compute_mu(nn_distances, d)#
Computes mu equal to the 1th percentile of \(mle(nn\text{_}distances, d) - 10\), where \(mle = \log(\text{gamma}(d/2 + 1)) - (d/2) \cdot \log(\pi) - d \cdot \log(nn\text{_}distances)\)
- Parameters:
nn_distances (array-like) – The observed nearest neighbor distances.
- Returns:
mu - The 1th percentile of \(mle(nn\text{_}distances, d) - 10\).
- Return type:
float
- mellon.parameters.compute_nn_distances(x)#
Computes the distance to the nearest neighbor for each training instance.
- Parameters:
x (array-like) – The training instances.
- Returns:
nn_distances - The observed nearest neighbor distances.
- Return type:
array-like