def _update_model_params(
    win_loss: np.ndarray[tuple[int, int], np.dtype[np.number]],
    params: np.ndarray[tuple[int], np.dtype[np.number]]):
  """Update Bradley-Terry model parameters using the Newman 2023 algorithm.

  This function modifies the params array in place.

  Args:
    win_loss: [agents X agents] matrix of win-loss data. The value
      win_loss[i, j] is the number of scenarios where agent i won against agent
      j.
    params: [agents] array of Bradley-Terry model parameters.
  """
  num_agents = params.shape[0]
  for i in range(num_agents):
    numerator_vals_to_sum = []
    denominator_vals_to_sum = []
    for j in range(num_agents):
      if i != j:
        total_rating = params[i] + params[j]
        numerator_vals_to_sum.append(
            win_loss[i, j] * params[j] / total_rating
        )
        denominator_vals_to_sum.append(win_loss[j, i] / total_rating)

    params[i] = sum(numerator_vals_to_sum) / sum(denominator_vals_to_sum)

  geometric_mean = params.prod() ** (1 / num_agents)
  params /= geometric_mean
Update Bradley-Terry model parameters using the Newman 2023 algorithm.

  This function modifies the params array in place.

  Args:
    win_loss: [agents X agents] matrix of win-loss data. The value
      win_loss[i, j] is the number of scenarios where agent i won against agent
      j.
    params: [agents] array of Bradley-Terry model parameters.
  
examples/deprecated/modular/scoring/elo.py