leaderbot.models.BradleyTerry.predict#
- BradleyTerry.predict(x=None)#
Predict outcome between competitors.
- Parameters:
- xnp.ndarray, list, zip, or leaderbot.data.DataType
A 2D array (or equivalent list or zip) of integers with the shape
(n_pairs, 2)
where each row consists of indices[i, j]
representing a match between a pair of agents with the indicesi
andj
. Alternatively, a dictionary of the typeleaderbot.data.DataType
can be provided. If None, theX
variable from the input data is used.
- Returns:
- probnp.array
An array of the shape
(n_agents, )
where each entry represents the following codes:+1
: agenti
winsj
.0
: agenti
tiesj
.-1
: agenti
losses toj
.
- Raises:
- RuntimeError
If the model is not trained before calling this method.
See also
Examples
>>> from leaderbot.data import load >>> from leaderbot.models import Davidson >>> # Create a model >>> data = load() >>> model = Davidson(data) >>> # Train the model >>> model.train() >>> # Make prediction >>> x = list(zip((0, 1, 2), (1, 2, 0))) >>> pred = model.predict(x)