lightning.ranking.KernelPRank

class lightning.ranking.KernelPRank(n_iter=10, shuffle=True, random_state=None, kernel='linear', gamma=None, degree=3, coef0=1, kernel_params=None)[source]

Kernelized online algorithm for learning an ordinal regression model.

Parameters
  • n_iter (int) – Number of iterations to run.

  • shuffle (boolean) – Whether to shuffle data.

  • random_state (RandomState or int) – The seed of the pseudo random number generator to use.

  • kernel ("linear" | "poly" | "rbf" | "sigmoid" | "cosine" | "precomputed") – Kernel. Default: “linear”

  • degree (int, default=3) – Degree for poly kernels. Ignored by other kernels.

  • gamma (float, optional) – Kernel coefficient for rbf and poly kernels. Default: 1/n_features. Ignored by other kernels.

  • coef0 (float, optional) – Independent term in poly and sigmoid kernels. Ignored by other kernels.

  • kernel_params (mapping of string to any, optional) – Parameters (keyword arguments) and values for kernel passed as callable object. Ignored by other kernels.

dual_coef_

Estimated weights.

Type

array, shape=[n_samples]

thresholds_

Estimated thresholds.

Type

array, shape=[n_classes]

References

Pranking with Ranking Koby Crammer, Yoram Singer NIPS 2001

property classes_
fit(X, y)[source]

Fit model according to X and y.

Parameters
  • X (array-like, shape = [n_samples, n_features]) – Training vectors, where n_samples is the number of samples and n_features is the number of features.

  • y (array-like, shape = [n_samples]) – Target values.

Returns

self – Returns self.

Return type

classifier

get_params(deep=True)

Get parameters for this estimator.

Parameters

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

dict

n_nonzero(percentage=False)
predict(X)[source]
score(X, y)
set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters

**params (dict) – Estimator parameters.

Returns

self – Estimator instance.

Return type

estimator instance