From bb5a124f0138b8688b66d28dac88ea5007b9d6ab Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 12 Nov 2014 22:30:15 +0100 Subject: * markdownization of documentation --- doc/races.md | 28 ++++++++++++++++++++++++ doc/races.txt | 22 ------------------- doc/results.md | 49 +++++++++++++++++++++++++++++++++++++++++ doc/results.txt | 42 ----------------------------------- doc/sources.md | 20 +++++++++++++++++ doc/sources.txt | 8 ------- doc/sql.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/sql.txt | 59 ------------------------------------------------- 8 files changed, 165 insertions(+), 131 deletions(-) create mode 100644 doc/races.md delete mode 100644 doc/races.txt create mode 100644 doc/results.md delete mode 100644 doc/results.txt create mode 100644 doc/sources.md delete mode 100644 doc/sources.txt create mode 100644 doc/sql.md delete mode 100644 doc/sql.txt (limited to 'doc') diff --git a/doc/races.md b/doc/races.md new file mode 100644 index 0000000..e1966d2 --- /dev/null +++ b/doc/races.md @@ -0,0 +1,28 @@ +Race selection +============== + +Races included in the standings: + + * all World Championship of Drivers races run to Formula One regulations (so no Indianapolis 500 in the 50s) from 1950 to 1980 + * all World Championship of Drivers races run to Formula Two regulations in 1952-53 + * all Formula One World Championship races since 1981 + * all non-championship races run to contemporary or nearly contemporary Formula One regulations since 1950, apart from national championship series (so Races of Champions, International Trophies, Bologna Sprints or non-championship Grands Prix are included, but Aurora F1, Tasman Series or South African F1 races are excluded) + * some of the 1952-53 non-championship Formula Two races (including these with substantial WDC drivers appearence, such as French Formula Two Championship races and some other arbitrary races) + * all post-War, pre-1950 Grandes Épreuves races (which includes some 1946 races from before F1 regulations and excludes majority of F1-compliant races from 1947 onwards) + * races with mixed formula entries (e.g. F1/F2 or F1/FLibre) are separated by class and only F1 class (and F2 class in 1952-53) is scored, apart from joined F1-F2 World Championship races (German Grands Prix from 50s and 60s and 1958 Moroccan GP) + +Race importance factor: + + * WCoD and FOWC race importance constitutes 100% of base value + * all other races get 50% of base value + * qualifying sessions get 10% of the value for respective race + * all races of the same category are scored identically, even if the race has been red-flagged before what would be full points situation + +Heats and aggregates: + + * for multi-heat races with bracket-style heats and a final heats count as qualifying sessions and the final count as a race (except for Bologna Sprints, in which every heat from the full bracket get qualifying importance) + * for multi-heat races with aggregate-style standings the initial grid counts as qualifying and the aggregate results count as a race + +Other remarks: + + * all qualifying sessions are listed as held on the previous day relative to the race - simply to avoid chronology mix-ups and to minimize the chances of two ratings for a driver for one day diff --git a/doc/races.txt b/doc/races.txt deleted file mode 100644 index 2ca20da..0000000 --- a/doc/races.txt +++ /dev/null @@ -1,22 +0,0 @@ -== Race selection == -Races included in the standings: - * all World Championship of Drivers races run to Formula One regulations (so no Indianapolis 500 in the 50s) from 1950 to 1980 - * all World Championship of Drivers races run to Formula Two regulations in 1952-53 - * all Formula One World Championship races since 1981 - * all non-championship races run to contemporary or nearly contemporary Formula One regulations since 1950, apart from national championship series (so Races of Champions, International Trophies, Bologna Sprints or non-championship Grands Prix are included, but Aurora F1, Tasman Series or South African F1 races are excluded) - * some of the 1952-53 non-championship Formula Two races (including these with substantial WDC drivers appearence, such as French Formula Two Championship races and some other arbitrary races) - * all post-War, pre-1950 Grandes Épreuves races (which includes some 1946 races from before F1 regulations and excludes majority of F1-compliant races from 1947 onwards) - * races with mixed formula entries (e.g. F1/F2 or F1/FLibre) are separated by class and only F1 class (and F2 class in 1952-53) is scored, apart from joined F1-F2 World Championship races (German Grands Prix from 50s and 60s and 1958 Moroccan GP) - -Race importance factor: - * WCoD and FOWC race importance constitutes 100% of base value - * all other races get 50% of base value - * qualifying sessions get 10% of the value for respective race - * all races of the same category are scored identically, even if the race has been red-flagged before what would be full points situation - -Heats and aggregates: - * for multi-heat races with bracket-style heats and a final heats count as qualifying sessions and the final count as a race (except for Bologna Sprints, in which every heat from the full bracket get qualifying importance) - * for multi-heat races with aggregate-style standings the initial grid counts as qualifying and the aggregate results count as a race - -Other remarks: - * all qualifying sessions are listed as held on the previous day relative to the race - simply to avoid chronology mix-ups and to minimize the chances of two ratings for a driver for one day diff --git a/doc/results.md b/doc/results.md new file mode 100644 index 0000000..d819ac2 --- /dev/null +++ b/doc/results.md @@ -0,0 +1,49 @@ +Scoring rules +============= + +Every race or ranked qualifying session results for each entry are handed ordinal numbers as "groups" in which the entry was classified. + +For qualifying, a group is simply the qualifying position (not applying any carryover/technical grid drop penalties, but applying disqualification/exclusion/grid penalties for offences during the ranked session). + +For races the following rules apply: + + * race winning entry forms group "1" + * among the drivers classified on the lead lap, other groups are as follows: 2-3 places are group "2", 4-5 places are group "3", 6-10 places are group "4", 11-15 places are group "5", etc. + * for drivers classified outside the lead lap, the groups are formed by the drivers classified with the same numbers of completed laps (each distinct lap number as a separate group) + * non-classified drivers (because of completing not enough laps, but not retiring) form a single separate group, below all the classified drivers + * drivers retiring due to driver-induced accidents form a single separate group, below other drivers + * drivers disqualified from the race form a single separate group, below other drivers + * drivers retiring due to mechanical issues form a special "0" group together with drivers which did not start the race + +After separating session results into groups, all entries from non-"0" groups form a "tournament". All possible entry couples are paired against each other to form "duels". The outcome of the duel may be a win/loss (if the entries are grouped in different groups) or a draw (if entries are grouped within the same group). + +All such duels are then treated as input for Elo rating algorithm. + +Specific rules regarding Elo implementation for this application's purposes: + + * rankings are applied (evaluated) after each session (note: debug information for Bologna Sprints does not display correct "previous" ratings: ratings are applied after each heat, yeat debug info displays inital rating from before the event; this applies to any possible situation in which drivers take part in multiple sessions in one day) + * no minimum rating limit for driver is enforced + * drivers are rated from their first entry (there's no initial grace period, see: challenges.txt) + * shared drive entries have the effective ranking equal to the average ranking of drivers sharing the drive; pending ranking points from duels of such entries are divided equally between drivers sharing the drive + * driver group disparity is varied to accommodate for dynamic shifts of relative performance within the F1 field (caused by technical changes) - see below + +Other than that, standard Elo rating conventions apply: + + * drivers start with identical initial rating + * duels between high-ranked drivers change their rankings by fewer points than duels between low-ranked drivers + +Field disparity change: + + * higher disparity leads to more rating inflation - as disparity is a measure of rating difference that yields a certian probability of driver's victory, so higher disparity leads to more attribution for a victory to a driver (and less attribution to the shift of performance, e.g. car performance change) + * higher rating deviation in the months prior to a race suggests a shift in relative performance (some drivers gain a lot, some divers lose a lot), so there's a need for damping further changes a bit - by lowering disparity + * once the ratings are stabilized (meaning relative performance within the field had settled), disparity can be increased + * this helps with the initial "rolling start" phase of the ranking (1946-1949 races) + +Specific parameters which are configurable: + + * initial driver ranking + * initial disparity factor (ranking difference which drops the possibility of lower-ranked driver's win by the factor of 10) + * duel importance (base, i.e. for drivers ranked below importance thresholds) for all race types + * importance thresholds (for 50% of base importance and 75% of base importance) + +All calculation is rounded to 2 decimal places at each rating cycle. diff --git a/doc/results.txt b/doc/results.txt deleted file mode 100644 index 43dda5b..0000000 --- a/doc/results.txt +++ /dev/null @@ -1,42 +0,0 @@ -== Scoring rules == -Every race or ranked qualifying session results for each entry are handed ordinal numbers as "groups" in which the entry was classified. - -For qualifying, a group is simply the qualifying position (not applying any carryover/technical grid drop penalties, but applying disqualification/exclusion/grid penalties for offences during the ranked session). - -For races the following rules apply: - * race winning entry forms group "1" - * among the drivers classified on the lead lap, other groups are as follows: 2-3 places are group "2", 4-5 places are group "3", 6-10 places are group "4", 11-15 places are group "5", etc. - * for drivers classified outside the lead lap, the groups are formed by the drivers classified with the same numbers of completed laps (each distinct lap number as a separate group) - * non-classified drivers (because of completing not enough laps, but not retiring) form a single separate group, below all the classified drivers - * drivers retiring due to driver-induced accidents form a single separate group, below other drivers - * drivers disqualified from the race form a single separate group, below other drivers - * drivers retiring due to mechanical issues form a special "0" group together with drivers which did not start the race - -After separating session results into groups, all entries from non-"0" groups form a "tournament". All possible entry couples are paired against each other to form "duels". The outcome of the duel may be a win/loss (if the entries are grouped in different groups) or a draw (if entries are grouped within the same group). - -All such duels are then treated as input for Elo rating algorithm. - -Specific rules regarding Elo implementation for this application's purposes: - * rankings are applied (evaluated) after each session (note: debug information for Bologna Sprints does not display correct "previous" ratings: ratings are applied after each heat, yeat debug info displays inital rating from before the event; this applies to any possible situation in which drivers take part in multiple sessions in one day) - * no minimum rating limit for driver is enforced - * drivers are rated from their first entry (there's no initial grace period, see: challenges.txt) - * shared drive entries have the effective ranking equal to the average ranking of drivers sharing the drive; pending ranking points from duels of such entries are divided equally between drivers sharing the drive - * driver group disparity is varied to accommodate for dynamic shifts of relative performance within the F1 field (caused by technical changes) - see below - -Other than that, standard Elo rating conventions apply: - * drivers start with identical initial rating - * duels between high-ranked drivers change their rankings by fewer points than duels between low-ranked drivers - -Field disparity change: - * higher disparity leads to more rating inflation - as disparity is a measure of rating difference that yields a certian probability of driver's victory, so higher disparity leads to more attribution for a victory to a driver (and less attribution to the shift of performance, e.g. car performance change) - * higher rating deviation in the months prior to a race suggests a shift in relative performance (some drivers gain a lot, some divers lose a lot), so there's a need for damping further changes a bit - by lowering disparity - * once the ratings are stabilized (meaning relative performance within the field had settled), disparity can be increased - * this helps with the initial "rolling start" phase of the ranking (1946-1949 races) - -Specific parameters which are configurable: - * initial driver ranking - * initial disparity factor (ranking difference which drops the possibility of lower-ranked driver's win by the factor of 10) - * duel importance (base, i.e. for drivers ranked below importance thresholds) for all race types - * importance thresholds (for 50% of base importance and 75% of base importance) - -All calculation is rounded to 2 decimal places at each rating cycle. diff --git a/doc/sources.md b/doc/sources.md new file mode 100644 index 0000000..a9512d9 --- /dev/null +++ b/doc/sources.md @@ -0,0 +1,20 @@ +Data sources: +============= + +Championship races: +------------------- + +1950-1951 - wikipedia +1952-1953 - second-a-lap.blogspot.com +1954+ - ergast.com/mrd + +Non-championship races: +----------------------- +1950+ - www.silhouet.com/motorsport/archive/f1 +1952-1953 - second-a-lap.blogspot.com +1954+ - chicanef1.com + +Qualifying: +----------- +2003+ - ergast.com/mrd +1954+ - chicanef1.com diff --git a/doc/sources.txt b/doc/sources.txt deleted file mode 100644 index ee10bcd..0000000 --- a/doc/sources.txt +++ /dev/null @@ -1,8 +0,0 @@ -Championship races: -1950-1951 - wikipedia -1952-1953 - second-a-lap.blogspot.com -1954+ - ergast.com/mrd - -Non-championship races: -1950+ - www.silhouet.com/motorsport/archive/f1 -1952-1953 - second-a-lap.blogspot.com diff --git a/doc/sql.md b/doc/sql.md new file mode 100644 index 0000000..1f4f08b --- /dev/null +++ b/doc/sql.md @@ -0,0 +1,68 @@ +Useful queries for application database: +======================================= + + * overall top rating progression + +``` +CREATE OR REPLACE VIEW max_date_rankings AS + SELECT MAX(ranking) max_ranking, + rank_date max_rank_date + FROM rankings + GROUP BY rank_date; +SELECT drivers.driver, + max_date_rankings.max_rank_date, + max_date_rankings.max_ranking +FROM max_date_rankings +INNER JOIN rankings ON (rankings.ranking = max_date_rankings.max_ranking) + AND (rankings.rank_date = max_date_rankings.max_rank_date) +LEFT JOIN drivers ON rankings._driver = drivers.id +WHERE max_ranking > ( + SELECT MAX(mr.max_ranking) FROM max_date_rankings mr + WHERE mr.max_rank_date < max_date_rankings.max_rank_date +); +``` + + * overall top peak ratings + +``` +SELECT drivers.driver, + rankings.ranking, + rankings.rank_date +FROM rankings +INNER JOIN ( + SELECT MAX(ranking) ranking, _driver FROM rankings + GROUP BY _driver +) r ON r.ranking=rankings.ranking AND r._driver=rankings._driver +JOIN drivers ON rankings._driver = drivers.id +GROUP BY rankings._driver +ORDER BY rankings.ranking DESC; +``` + + * highest exit ratings + +``` +SELECT drivers.driver, + rankings.ranking, + rankings.rank_date +FROM rankings +INNER JOIN ( + SELECT MAX(rank_date) rank_date, _driver FROM rankings GROUP BY _driver +) r ON r.rank_date=rankings.rank_date AND r._driver=rankings._driver +JOIN drivers ON rankings._driver = drivers.id +WHERE rankings.rank_date < CURDATE() - INTERVAL 1 YEAR +ORDER BY rankings.ranking DESC; +``` + + * year-by-year rating inflation + +``` +SELECT YEAR(rank_date), + MAX(ranking), + MIN(ranking), + AVG(ranking), + AVG(ranking)+STDDEV(ranking), + AVG(ranking)-STDDEV(ranking) +FROM rankings +GROUP BY YEAR(rank_date) +ORDER BY YEAR(rank_date) ASC; +``` diff --git a/doc/sql.txt b/doc/sql.txt deleted file mode 100644 index a21b607..0000000 --- a/doc/sql.txt +++ /dev/null @@ -1,59 +0,0 @@ -Useful queries: - - - overall top rating progression - -CREATE OR REPLACE VIEW max_date_rankings AS - SELECT MAX(ranking) max_ranking, - rank_date max_rank_date - FROM rankings - GROUP BY rank_date; -SELECT drivers.driver, - max_date_rankings.max_rank_date, - max_date_rankings.max_ranking -FROM max_date_rankings -INNER JOIN rankings ON (rankings.ranking = max_date_rankings.max_ranking) - AND (rankings.rank_date = max_date_rankings.max_rank_date) -LEFT JOIN drivers ON rankings._driver = drivers.id -WHERE max_ranking > ( - SELECT MAX(mr.max_ranking) FROM max_date_rankings mr - WHERE mr.max_rank_date < max_date_rankings.max_rank_date -); - - - overall top peak ratings - -SELECT drivers.driver, - rankings.ranking, - rankings.rank_date -FROM rankings -INNER JOIN ( - SELECT MAX(ranking) ranking, _driver FROM rankings - GROUP BY _driver -) r ON r.ranking=rankings.ranking AND r._driver=rankings._driver -JOIN drivers ON rankings._driver = drivers.id -GROUP BY rankings._driver -ORDER BY rankings.ranking DESC; - - - highest exit ratings - -SELECT drivers.driver, - rankings.ranking, - rankings.rank_date -FROM rankings -INNER JOIN ( - SELECT MAX(rank_date) rank_date, _driver FROM rankings GROUP BY _driver -) r ON r.rank_date=rankings.rank_date AND r._driver=rankings._driver -JOIN drivers ON rankings._driver = drivers.id -WHERE rankings.rank_date < CURDATE() - INTERVAL 1 YEAR -ORDER BY rankings.ranking DESC; - - - year-by-year rating inflation - -SELECT YEAR(rank_date), - MAX(ranking), - MIN(ranking), - AVG(ranking), - AVG(ranking)+STDDEV(ranking), - AVG(ranking)-STDDEV(ranking) -FROM rankings -GROUP BY YEAR(rank_date) -ORDER BY YEAR(rank_date) ASC; -- cgit v1.2.3