prefopt.presenter package

Submodules

prefopt.presenter.input module

Input presenter.

class prefopt.presenter.input.FunctionInputPresenter(func)

Bases: prefopt.experiment.InputPresenter

Presenter for utility functions.

The presenter maps the latent utility function to a preference relation.

Parameters:

func : function

Utility function to be maximized.

get_choice(a, b)

Present the user with a pair of items and return their choice.

Parameters:

a : tuple

Query point.

b : tuple

Comparison point.

Returns:

choice : int

The user preference for the choice a vs. b. Possible values are: 1 (a preferred over b); 0 (a is equivalent to b); -1 (b preferred over a).

prefopt.presenter.output module

Output presenter.

class prefopt.presenter.output.StdoutPresenter

Bases: prefopt.experiment.OutputPresenter

Present to stdout.

FMT = 'iteration {i}: {xn} vs {xb} -> {choice}'
present(i, xn, xb, choice)

Present the output of a single iteration of the experiment.

Parameters:

i : int

The current iteration.

xn : tuple

The new query point.

xb : tuple

The incumbent against which the new query point is compared.

choice : int

The user preference for the choice xn vs. xb.

present_valuations(valuations)

Present the current valuations of the model.

Parameters:

valuations : iterable

Iterable of (item, valuation) tuples.

Module contents