ratingslib.ratings.accurate module

AccuRate Rating System

class AccuRate(version: str = ratings.ACCURATE, starting_point: float = 0)

Bases: RatingSystem

This class implements the ratingslib.ratings.RatingSystem abstract class using an approach called AccuRate for the computation of rating values as described in the paper 1

Parameters
  • version (str, default=ratings.ACCURATE) – A string that shows the version of rating system. The available versions can be found in ratingslib.utils.enums.ratings class.

  • starting_point (int) – the value where the initial rating starts

References

1

Kyriakides, G., Talattinis, K., & Stephanides, G. (2017). A Hybrid Approach to Predicting Sports Results and an AccuRATE Rating System. International Journal of Applied and Computational Mathematics, 3(1), 239–254.

Examples

The following example demonstrates Accurate rating system for a simple soccer competition where only two teams participate, team “Good” and team “Better”.

>>> from ratingslib.datasets.filenames import dataset_path, FILENAME_ACCURATE_PAPER_EXAMPLE
>>> from ratingslib.ratings.accurate import AccuRate
>>> filename = dataset_path(FILENAME_ACCURATE_PAPER_EXAMPLE)
>>> AccuRate().rate_from_file(filename)
     Team    rating  ranking
0  Better  1.681793        1
1    Good -1.587401        2
create_rating_vector(data: DataFrame, items_df: DataFrame, columns_dict: Optional[Dict[str, Any]] = None) ndarray

Calculates ratings according to pairs of items data.

computation_phase()

Nothing to compute, all the calculations are made in ratingslib.ratings.accurate.AccuRate.create_rating_vector() method

preparation_phase(data_df: DataFrame, items_df: DataFrame, columns_dict: Optional[Dict[str, Any]] = None)

To be overridden in subclasses.

rate(data_df: DataFrame, items_df: DataFrame, sort: bool = False, columns_dict: Optional[Dict[str, Any]] = None) DataFrame

This method computes ratings for a pairwise data. (e.g. soccer teams games). To be overridden in subclasses.

Parameters
  • data_df (pandas.DataFrame) – The pairwise data.

  • items_df (pandas.DataFrame) – Set of items (e.g. teams) to be rated

  • sort (bool, default=True.) – If true, the output is sorted by rating value

  • columns_dict (Optional[Dict[str, str]]) – The column names of data file. See ratingslib.datasets.parameters.COLUMNS_DICT for more details.

Returns

items_df – The set of items with their rating and ranking.

Return type

pandas.DataFrame