qstack.regression.oos

Out-of-sample prediction.

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

Command-line entry point for out-of-sample predictions.

qstack.regression.oos.oos(X, X_oos, alpha, sigma=32.0, 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]

Perform prediction on an out-of-sample (OOS) set.

Parameters:
  • X (numpy.ndarray[Nsamples,...]) – Array containing the representations of all Nsamples.

  • X_oos (numpy.ndarray[Noos,...]) – Array of OOS representations.

  • alpha (numpy.1darray(Ntrain or sparse)) – Regression weights.

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

  • 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 (list) – List of indices for the test set (based on the sequence in X).

  • idx_train (list) – 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:

predictions on the OOS set

Return type:

np.1darray(Noos)

Command-line use

This program makes prediction for OOS.

usage: python3 -m qstack.regression.oos [-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 ...]]
                                        [--test TEST_SIZE] [--ll]
                                        [--sparse SPARSE]
                                        [--random_state RANDOM_STATE]
                                        --x-oos X_OOS --alpha ALPHA

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}

--test

test set fraction

Default: 0.2

--ll

if correct for the numper of threads

Default: False

--sparse

regression basis size for sparse learning

--random_state

seed for test / train splitting

Default: 0

--x-oos

path to the OOS representations file

--alpha

path to the regression weights file

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.