def get_elo_ratings(
    win_loss: np.ndarray[tuple[int, int], np.dtype[np.number]],
    num_iterations: int = _DEFAULT_NUM_ITERATIONS,
) -> np.ndarray[tuple[int], np.dtype[np.number]]:
  """Get Elo scores from win_loss matrix of shape [num_scenarios, num_agents].

  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.
    num_iterations: number of iterations to run the algorithm.

  Returns:
    elo_ratings: [agents] 1-D array of Elo ratings.
  """
  # First initialize parameters since this is an iterative algorithm.
  num_rows, num_columns = win_loss.shape
  if num_rows != num_columns:
    raise ValueError('win_loss matrix must be square.')
  if num_rows < 4:
    raise ValueError('win_loss matrix must contain at least 4 agents.')

  params = np.ones(num_rows)
  # Iteratively update the model parameters.
  for _ in range(num_iterations):
    _update_model_params(win_loss, params)
  # Convert the resulting parameters to Elo ratings.
  elo_ratings = _params_to_elo_ratings(params)
  return elo_ratings
Get Elo scores from win_loss matrix of shape [num_scenarios, num_agents].

  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.
    num_iterations: number of iterations to run the algorithm.

  Returns:
    elo_ratings: [agents] 1-D array of Elo ratings.
  
examples/deprecated/modular/scoring/elo.py