Fork me on GitHub

bolero.utils.ranking_svm.RankingSVM

class bolero.utils.ranking_svm.RankingSVM(n_iter=-1, epsilon=1.0, c_base=6.0, c_pow=2.0, c_sigma=1.0, random_state=None)[source]

Ranking Support Vector Machine.

A trained ranking SVM model will predict rank-preserving values for each sample.

The constraint violation cost will be computed according to

\[C_i = 10^{C_{base}} (N_{training} - i)^{C_{pow}}, \text{ for} i = 1, \ldots, N_{training}\]

so that top-ranked samples have higher violation costs.

Parameters:
n_iter : int, optional (default: 50000 * sqrt(n_features))

Number of training iterations

epsilon : float, optional (default: 1.0)

Tolerance ranking value error

c_base : float, optional (default: 6)

Base for constraint violation cost

c_pow : float, optional (default: 2)

Exponent for constraint violation cost

c_sigma : float, optional (default: 1)

The sigma of the RBF kernel will be set to c_sigma times the average distance of training samples

random_state : optional, int

Seed for the random number generator

__init__(n_iter=-1, epsilon=1.0, c_base=6.0, c_pow=2.0, c_sigma=1.0, random_state=None)[source]
fit(X)[source]

Fit ranking SVM.

Parameters:
X : array, shape (n_samples, n_features)

Training data, sorted, highest rank first

predict(X)[source]

Predict ranking values for new data.

Parameters:
X : array, shape (n_test, n_features)

Test data

Returns:
y : array, shape (n_test,)

Ranking values