LeavePairOutRankRLS - GlobalRankRLS with leave-pair-out regularization parameter selection¶
-
class
rlscore.learner.global_rankrls.
LeavePairOutRankRLS
(X, Y, kernel='LinearKernel', basis_vectors=None, regparams=None, **kwargs)¶ Bases:
rlscore.predictor.predictor.PredictorInterface
RankRLS: Regularized least-squares ranking. Wrapper code for selecting the regularization parameter automatically with leave-pair-out cross-validation.
Parameters: - X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Data matrix
- Y : {array-like}, shape = [n_samples] or [n_samples, n_labels]
Training set labels
- kernel : {‘LinearKernel’, ‘GaussianKernel’, ‘PolynomialKernel’, ‘PrecomputedKernel’, …}
kernel function name, imported dynamically from rlscore.kernel
- basis_vectors : {array-like, sparse matrix}, shape = [n_bvectors, n_features], optional
basis vectors (typically a randomly chosen subset of the training data)
- regparams : {array-like}, shape = [grid_size] (optional)
regularization parameter values to be tested, default = [2^-15,…,2^15]
Other Parameters: - Typical kernel parameters include:
- bias : float, optional
LinearKernel: the model is w*x + bias*w0, (default=1.0)
- gamma : float, optional
GaussianKernel: k(xi,xj) = e^(-gamma*<xi-xj,xi-xj>) (default=1.0) PolynomialKernel: k(xi,xj) = (gamma * <xi, xj> + coef0)**degree (default=1.0)
- coef0 : float, optional
PolynomialKernel: k(xi,xj) = (gamma * <xi, xj> + coef0)**degree (default=0.)
- degree : int, optional
PolynomialKernel: k(xi,xj) = (gamma * <xi, xj> + coef0)**degree (default=2)
Notes
Computational complexity of training and model selection: m = n_samples, d = n_features, l = n_labels, b = n_bvectors, r = grid_size
O(dm^2 + rlm^2 + rm^3): basic case
O(rlm^2 + rdm^2): Linear Kernel, d < m
O(rlm^2 + rbm^2): Sparse approximation with basis vectors
RankRLS algorithm is described in [1,2].
References
[1] Learning to rank with pairwise regularized least-squares. In Thorsten Joachims, Hang Li, Tie-Yan Liu, and ChengXiang Zhai, editors, SIGIR 2007 Workshop on Learning to Rank for Information Retrieval, pages 27–33, 2007.
[2] Tapio Pahikkala, Evgeni Tsivtsivadze, Antti Airola, Jouni Jarvinen, and Jorma Boberg. An efficient algorithm for learning to rank from preference graphs. Machine Learning, 75(1):129-165, 2009.
Attributes: - predictor : {LinearPredictor, KernelPredictor}
trained predictor
- cv_performances : array, shape = [grid_size]
leave-pair-out performances for each grid point
- regparam : float
regparam from grid with best performance
-
predict
(X)¶ Predicts outputs for new inputs
Parameters: - X : {array-like, sparse matrix}, shape = [n_samples, n_features]
input data matrix
Returns: - P : array, shape = [n_samples, n_tasks]
predictions