sgdBT: Calculate MAP estimators for Bradley-Terry Model

Description Usage Arguments Details Value References Examples

View source: R/sgdBT.R

Description

This function calculates the MAP estimators for the Bradley-Terry model with adherence (or reliability) parameters (Raman and Thorsten, 2014). The prior on scores is a multivariate normal distribution, and the prior on adherence is an improper, flat prior (on the whole real line).

Usage

1
2
sgdBT(data, mu, sigma, rate, maxiter = 1000,
      tol = 1e-09, start, decay = 1.1)

Arguments

data

a n * m matrix, where n is the number of observers and m is the number of items to rank; each row vector is a partial or complete ranking, with i-th element being the rank assined to item i; the entry where that item is not ranked in the partial ranking is replaced by 0

mu

the mean vector of the normal prior on scores

sigma

the covariance matrix of the normal prior on scores

rate

the learning rate/stepsize

maxiter

the maximal number of iterations

tol

if the L-2 norm of the change of target function values is less than tol, we assert convergence

start

a length m + n vector of the starting value of parameters; the first m elements are the starting values for scores, while the next n elements are the starting values for adherences of observers

decay

the learning rate is divided by decay if the target function value doesn't decrease; this number is set to be 1.1 by default

Details

The original Bradley-Terry model is modified to accommodate an extra adherence parameter, which accounts for each observer's degree of disagreement with the real ranking (Ramam and Thorsten, 2014). We assign a normal prior on the score parameter in order to incorporate the information from the additive relationship matrix. The MAP estimators for scores and adherences are calculated using stochastic gradient descent algorithm.

Value

Return a list with 4 components

value

a vector which stores the value of the target function to optimize over all iterations

niter

number of iterations to reach convergence

score

the MAP estimator for scores

adherence

the MAP estimator for adherences

References

Raman, Karthik, and Thorsten Joachims. "Methods for ordinal peer grading." Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining. ACM, 2014.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#synthetic data with 3 items to rank and 2 observers
#the first observer ranks item 1 \succ item 2
#the second observer ranks item 1 \succ item 3 \succ item 2
data = rbind(c(1, 2, 0), c(1, 3, 2))

#set up the prior
mu = c(1, 1, 1)
sigma = diag(1, 3)

#set up the starting values
start = rep(1, 5)

res = sgdBT(data, mu, sigma, 0.1, 1000, 1e-8, start, 1.1)

res$value
res$niter
res$score
res$adherence

shuxiaoc/agRank documentation built on May 29, 2019, 9:27 p.m.