PPRankRLS - ranking regularized least-squares, pairwise preferences

class rlscore.learner.rankrls_with_pairwise_preferences.PPRankRLS(X, pairs_start_inds, pairs_end_inds, regparam=1.0, kernel='LinearKernel', basis_vectors=None, **kwargs)

Bases: rlscore.predictor.predictor.PredictorInterface

Regularized least-squares ranking (RankRLS) with pairwise preferences

Parameters:
X : {array-like, sparse matrix}, shape = [n_samples, n_features]

Data matrix

pairs_start_inds : {array-like}, shape = [n_preferences]

pairwise preferences: pairs_start_inds[i] > pairs_end_inds[i]

pairs_end_inds : {array-like}, shape = [n_preferences]

pairwise preferences: pairs_start_inds[i] > pairs_end_inds[i]

regparam : float, optional

regularization parameter, regparam > 0 (default=1.0)

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)

Other Parameters:
 
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: m = n_samples, d = n_features, p = n_preferences, b = n_bvectors

O(m^3 + dm^2 + p): basic case

O(dm^2 + p): Linear Kernel, d < m

O(bm^2 + p): Sparse approximation with basis vectors

RankRLS algorithm was generalized in [1] to learning directly from pairwise preferences.

References

[1] 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

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

solve(regparam)

Re-trains RankRLS for the given regparam.

Parameters:
regparam : float, optional

regularization parameter, regparam > 0 (default=1.0)