qstack.regression.condition¶
Kernel matrix condition number.
- qstack.regression.condition.condition(X, read_kernel=False, sigma=32.0, eta=1e-05, akernel='L', gkernel=None, gdict={'alpha': 1.0, 'normalize': 1, 'verbose': 0}, test_size=0.2, idx_test=None, idx_train=None, sparse=None, random_state=0)[source]¶
Compute kernel matrix condition number.
- Parameters:
X (numpy.ndarray[Nsamples,...]) – Array containing the representations of all Nsamples.
read_kernel (bool) – If ‘X’ is a kernel and not an array of representations.
sigma (float) – Width of the kernel.
eta (float) – Regularization strength for matrix inversion.
akernel (str) – Local kernel (‘L’ for Laplacian, ‘G’ for Gaussian, ‘dot’, ‘cosine’).
gkernel (str) – Global kernel (None, ‘REM’, ‘avg’).
gdict (dict) – Parameters of the global kernels.
test_size (float or int) – Test set fraction (or number of samples).
random_state (int) – The seed used for random number generator (controls train/test splitting).
idx_test (numpy.1darray) – List of indices for the test set (based on the sequence in X).
idx_train (numpy.1darray) – List of indices for the training set (based on the sequence in X).
sparse (int) – The number of reference environnments to consider for sparse regression.
- Returns:
Condition number.
- Return type:
float
- Raises:
RuntimeError – If ‘X’ is a kernel and sparse regression is chosen.
- qstack.regression.condition.main()[source]¶
Command-line entry point for computing kernel matrix condition numbers.
Command-line use¶
This program computes the condition number for the kernel matrix.
usage: python3 -m qstack.regression.condition [-h] --x REPR [--eta ETA]
[--sigma SIGMA]
[--akernel {G,L,dot,cosine,G_sklearn,G_custom_c,L_sklearn,L_custom_c,L_custom_py,myG,myL,myLfast}]
[--gkernel {avg,rem}]
[--gdict [GDICT ...]]
[--test TEST_SIZE] [--ll]
[--readkernel] [--sparse SPARSE]
[--random_state RANDOM_STATE]
Named Arguments¶
- --x
path to the representations file
- --eta
eta hyperparameter
Default:
1e-05- --sigma
sigma hyperparameter
Default:
32.0- --akernel
Possible choices: G, L, dot, cosine, G_sklearn, G_custom_c, L_sklearn, L_custom_c, L_custom_py, myG, myL, myLfast
local kernel type: “G” for Gaussian, “L” for Laplacian, “dot” for dot products, “cosine” for cosine similarity. “G_{sklearn,custom_c}”, “L_{sklearn,custom_c,custom_py}” for specific implementations. “L_custompy” is suited to open-shell systems
Default:
'L'- --gkernel
Possible choices: avg, rem
global kernel type: “avg” for average, “rem” for REMatch
- --gdict
dictionary like input string to initialize global kernel parameters, e.g. “–gdict alpha=2 normalize=0”
Default:
{'alpha': 1.0, 'normalize': 1, 'verbose': 0}- --test
test set fraction
Default:
0.2- --ll
if correct for the numper of threads
Default:
False- --readkernel
if X is kernel
Default:
False- --sparse
regression basis size for sparse learning
- --random_state
seed for test / train splitting
Default:
0
Note
If you built those docs yourself and the command-line section is empty, please make sure you have installed the right components of qstack.