Given a prior covariance matrix, returns a Tikhonov matrix
[U, S, V] = np.linalg.svd(PriorCov, full_matrices=False)
Tau = np.dot(np.diag(1. / np.sqrt(S)), U)
Tau = 1. / np.sqrt(np.float(n_samples)) * Tau / Tau.max()
return Tau
After Change
Given a prior covariance matrix, returns a Tikhonov matrix
[U, S, V] = np.linalg.svd(PriorCov, full_matrices=False)
S_ratio = S / S.max()
threshold = 0.0001
nonzero_indices = np.where(S_ratio > threshold)[0]
zero_indices = np.where(S_ratio <= threshold)[0]
S_inv = copy(np.sqrt(S))
S_inv[zero_indices] = threshold
S_inv[nonzero_indices] = 1. / S_inv[nonzero_indices]
Tau = np.dot(np.diag(S_inv), V)
n_features = Tau.shape[0]
Tau = 1. / n_features * Tau