prefopt.model package

Submodules

prefopt.model.binary module

Gaussian-process model for binary preferences.

class prefopt.model.binary.BinaryPreferenceModel(n_iter=500, n_samples=1, sigma_signal=1.0, sigma_noise=1.5, link='logit', lengthscale=1.0, ard=False)

Bases: prefopt.acquisition.base.PreferenceModel

Gaussian-process model for binary preferences.

Depending on the choice of the link function, the model is either a Thurstone-Mosteller (probit) or a Bradley-Terry (logit) model.

Attributes

n_iter (int, optional (default: 500)) The number of optimization iterations.
n_samples (int, optional (default: 1)) The number of samples for calculating stochastic gradient.
sigma_signal (float, optional (default: 1.0)) The variance of the signal.
sigma_noise (float, optional (default: 1.5)) The variance of the observation noise.
link (str, optional (default: probit)) The link function. Can either be probit in which case the model is a Thurstone-Mosteller model or logit in which case the model is a Bradley-Terry model.
lengthscale (float or np.array, optional (default: 1.0)) The lengthscale parameter. Can either be a scalar or vector of size D where D is the number of dimensions of the input space.
ard (bool, optional (default: False)) Use automatic relevance determination (ARD) instead of fixed lengthscales. If True, the value of lengthscale will be ignored.
fit(X, y)

Perfom inference in the preference model.

This will update the mean and variance function of the model.

Parameters:

X : np.array, shape (N, D)

The preference items.

y : dict

Mapping from indices corresponding to items (rows) in X to preferences. For instance, {(0, 1): 1} means that X[0] is preferred over X[1].

mean(X)

The posterior mean function evaluated at points X.

variance(X)

The posterior variance function evaluated at points X.

Module contents