CGKronRLS - Kronecker kernel RLS for pairwise data with incomplete (sparse) training set¶
-
class
rlscore.learner.cg_kron_rls.
CGKronRLS
(**kwargs)¶ Bases:
rlscore.predictor.pairwise_predictor.PairwisePredictorInterface
Regularized least-squares regression with paired-input (dyadic) data and Kronecker kernels. Iterative solver for incomplete data set.
Parameters: - pko : {rlscore.utilities.PairwiseKernelOperator}, shape = [n_samples1, n_samples1], alternative to X1, X2, etc.
Linear operator that determines the type of the Kronecker product kernel (for kernel CGKronRLS)..
- Y : {array-like}, shape = [n_train_pairs]
Training set labels.
- regparam : float, optional
regularization parameter, regparam > 0 (default=1.0)
- X1 : {array-like}, shape = [n_samples1, n_features1]
Data matrix 1 (for primal CGKronRLS)
- X2 : {array-like}, shape = [n_samples2, n_features2]
Data matrix 2 (for primal CGKronRLS)
- label_row_inds : {array-like, list of equal length array-likes}, shape = [n_train_pairs]
row indices from X1, corresponding to labels in Y
- label_col_inds : {array-like, list of equal length array-likes}, shape = [n_train_pairs]
row indices from X2, corresponding to labels in Y
- weights : {list, tuple, array-like}, shape = [n_kernels], optional
weights used by multiple pairwise kernel predictors
- maxiter : int, optional
maximum number of iterations (default: no upper limit)
Notes
Computational complexity of training:
TODO
KronRLS implements the iterative algorithm described in [1], making use of an efficient sampled Kronecker product algorithm.
References
[1] Tapio Pahikkala. Fast gradient computation for learning with tensor product kernels and sparse training labels. Structural, Syntactic, and Statistical Pattern Recognition (S+SSPR). volume 8621 of Lecture Notes in Computer Science, pages 123–132. 2014.
Attributes: - predictor : {LinearPairwisePredictor, KernelPairwisePredictor}
trained predictor
-
predict
(X1=None, X2=None, inds_X1pred=None, inds_X2pred=None, pko=None)¶ Computes predictions for test examples.
Parameters: - X1 : {array-like}, shape = [n_samples1, n_features1]
first test data matrix
- X2 : {array-like}, shape = [n_samples2, n_features2]
second test data matrix
- inds_X1pred : array of indices, optional
rows of X1, for which predictions are needed
- inds_X2pred : array of indices, optional
rows of X2, for which predictions are needed
Notes
If using kernels, give kernel matrices K1 and K2 as arguments instead of X1 and X2