bradleyterry: Index | Examples | Files

package bradleyterry

import ""



Package Files


func Model Uses

func Model(data []Pair) map[string]float64

Model takes in a dataset of Pairs that describe the winner and loser of multiple match-ups. The model will return a map[string]float64 that contains the preference/relevance of each given element.


var data = []Pair{
    {Winner: "Player 2", Loser: "Player 1"},
    {Winner: "Player 2", Loser: "Player 3"},
    {Winner: "Player 3", Loser: "Player 2"},
    {Winner: "Player 3", Loser: "Player 2"},

output := Model(data)
fmt.Printf("Player 1: %.2f\n", output["Player 1"])
fmt.Printf("Player 2: %.2f\n", output["Player 2"])
fmt.Printf("Player 3: %.2f\n", output["Player 3"])


Player 1: 0.00
Player 2: 0.33
Player 3: 0.67

type Pair Uses

type Pair struct {
    Winner string
    Loser  string

Pair is a struct combining the outcome of a single match, and contains the name of the winner and the name of the loser.

Package bradleyterry imports 2 packages (graph). Updated 2019-05-07. Refresh now. Tools for package owners.