KernelPairwisePredictor

class rlscore.predictor.pairwise_predictor.KernelPairwisePredictor(A, inds_K1training=None, inds_K2training=None, weights=None)

Bases: object

Pairwise kernel predictor

Parameters:
A : {array-like}, shape = [n_train_pairs]

dual coefficients

inds_K1training : list of indices, shape = [n_train_pairs], optional

maps dual coefficients to instances of of type 1, not needed if learning from complete data (i.e. n_train_pairs = n_samples1*n_samples2)

inds_K2training : list of indices, shape = [n_train_pairs], optional

maps dual coefficients to instances of of type 2, not needed if learning from complete data (i.e. n_train_pairs = n_samples1*n_samples2)

weights : {list, tuple, array-like}, shape = [n_kernels], optional

weights used by multiple pairwise kernel predictors

Attributes:
A : {array-like}, shape = [n_train_pairs]

dual coefficients

inds_K1training : list of indices, shape = [n_train_pairs] or None

maps dual coefficients to instances of of type 1, not needed if learning from complete data (i.e. n_train_pairs = n_samples1*n_samples2)

inds_K2training : list of indices, shape = [n_train_pairs] or None

maps dual coefficients to instances of of type 2, not needed if learning from complete data (i.e. n_train_pairs = n_samples1*n_samples2)

weights : {list, tuple, array-like}, shape = [n_kernels], optional

weights used by multiple pairwise kernel predictors

predict(K1pred=None, K2pred=None, inds_K1pred=None, inds_K2pred=None, pko=None)

Computes predictions for test examples.

Parameters:
K1pred : {array-like, list of equally shaped array-likes}, shape = [n_samples1, n_train_pairs]

the first part of the test data matrix

K2pred : {array-like, list of equally shaped array-likes}, shape = [n_samples2, n_train_pairs]

the second part of the test data matrix

inds_K1pred : list of indices, shape = [n_test_pairs], optional

maps rows of K1pred to vector of predictions P. If not supplied, predictions are computed for all possible test pair combinations.

inds_K2pred : list of indices, shape = [n_test_pairs], optional

maps rows of K2pred to vector of predictions P. If not supplied, predictions are computed for all possible test pair combinations.

Returns:
P : array, shape = [n_test_pairs] or [n_samples1*n_samples2]

predictions, either ordered according to the supplied row indices, or if no such are supplied by default prediction for (K1[i], K2[j]) maps to P[i + j*n_samples1].