qstack.regression.kernel

Kernel matrix computation.

qstack.regression.kernel.kernel(X, Y=None, sigma=32.0, akernel='L', gkernel=None, gdict={'alpha': 1.0, 'normalize': 1, 'verbose': 0})[source]

Compute a kernel between sets A and B (or A and A) using their representations.

Parameters:
  • X (numpy.ndarray) – Representation of A.

  • Y (numpy.ndarray) – Representation of B.

  • sigma (float) – Width of the kernel.

  • 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.

Returns:

A numpy ndarray containing the kernel.

qstack.regression.kernel.main()[source]

Command-line entry point for computing kernel matrices.

Command-line use

This program computes kernel.

usage: python3 -m qstack.regression.kernel [-h] --x REPR [--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 ...]] [--ll]
                                           [--dir DIR]

Named Arguments

--x

path to the representations file

--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}

--ll

if correct for the numper of threads

Default: False

--dir

directory to save the output in

Default: './'

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.