예제 #1
0
def main():
    horses98 = HorseParser('./../Data/born98.csv').horses
    horses05 = HorseParser('./../Data/born05.csv').horses

    races98 = RaceParser('./../Data/born98.csv').races
    races05 = RaceParser('./../Data/born05.csv').races

    full_races_98 = get_full_races(races98)
    full_races_05 = get_full_races(races05)

    odds98 = calculate_total_odds(races98)
    odds05 = calculate_total_odds(races05)

    print 'Maximum in born98 dataset: ' + str(max(odds98))
    print 'Minimum in born98 dataset: ' + str(min(odds98))

    print 'Maximum in born05 dataset: ' + str(max(odds05))
    print 'Minimum in born05 dataset: ' + str(min(odds05))

    plt.plot(odds98)
    plt.xlabel('Race')
    plt.ylabel('Total Odds for Race')
    plt.show()
    
    plt.plot(odds05)
    plt.xlabel('Race')
    plt.ylabel('Total Odds for Race')
    plt.show()
def main():
    races98 = RaceParser('./../Data/born98.csv').races
    races05 = RaceParser('./../Data/born05.csv').races

    full_races_98 = get_full_races(races98)
    full_races_05 = get_full_races(races05)

    horse_records_98 = HorseRecords(full_races_98).horses
    horse_records_05 = HorseRecords(full_races_05).horses

    full_race_types_counts_98 = race_types(full_races_98)
    full_race_types_counts_05 = race_types(full_races_05)

    handicap_fractions_98 = handicap_races(horse_records_98)
    handicap_fractions_05 = handicap_races(horse_records_05)

    print 'born98.csv file statistics:'
    print 'No. of full races of different types: '
    print full_race_types_counts_98
    print 'Fraction of handicap races and horse counts'
    print handicap_fractions_98

    print ''

    print 'born05.csv file statistics:'
    print 'No. of full races of different types: '
    print full_race_types_counts_05
    print 'Fraction of handicap races and horse counts'
    print handicap_fractions_05

    plot_handicap_graph(handicap_fractions_98)
예제 #3
0
def main():
    horses98 = HorseParser('./../Data/born98.csv').horses
    horses05 = HorseParser('./../Data/born05.csv').horses

    races98 = RaceParser('./../Data/born98.csv').races
    races05 = RaceParser('./../Data/born05.csv').races

    average_
    for r in races98:
        total_odds = 0
        
        for h in races98[r].horses:
            total_odds += 1/h.odds
        
        odds.append(total_odds)

        if total_odds > 10:
            print races98[r].name + ' ' + str(total_odds)
            print races98[r].date
            print races98[r].track
            print races98[r].time
            print races98[r].no_of_runners
            for h in races98[r].horses:
                print h.name + ' : ' + str(h.odds)

            print ''


    plt.plot(odds)
    plt.xlabel('Race')
    plt.ylabel('Total Odds for Each Race')
    plt.show()
예제 #4
0
def main():
    horses98 = HorseParser('./../Data/born98.csv').horses
    horses05 = HorseParser('./../Data/born05.csv').horses

    races98 = RaceParser('./../Data/born98.csv').races
    races05 = RaceParser('./../Data/born05.csv').races

    jockeys98 = find_all_jockeys(races98)
    jockeys05 = find_all_jockeys(races05)

    print 'No. of jockeys in 98 dataset: ' + str(len(jockeys98))
    print 'No. of jockeys in 05 dataset: ' + str(len(jockeys05))
def main():
    horses98 = HorseParser('./../Data/born98.csv').horses
    horses05 = HorseParser('./../Data/born05.csv').horses

    races98 = RaceParser('./../Data/born98.csv').races
    races05 = RaceParser('./../Data/born05.csv').races

    full_races_98 = get_full_races(races98)
    full_races_05 = get_full_races(races05)

    horse_records_98 = HorseRecords(full_races_98).horses
    full_race_horse_data_05 = HorseRecords(full_races_05).horses

    full_horses_race_count_98 = horses_with_k_races(full_races_98,
                                                    horse_records_98)
    full_horses_race_count_05 = horses_with_k_races(full_races_05,
                                                    full_race_horse_data_05)

    no_of_races_98 = [n for n in full_horses_race_count_98]
    no_of_races_05 = [n for n in full_horses_race_count_05]

    no_of_horses_98 = [
        full_horses_race_count_98[x] for x in full_horses_race_count_98
    ]
    no_of_horses_05 = [
        full_horses_race_count_05[x] for x in full_horses_race_count_05
    ]

    print 'Born98 Dataset Statistics:'
    print 'Race counts of horses for races with all runners: '
    print full_horses_race_count_98
    print 'No. of races:'
    print no_of_races_98
    print 'No. of horses:'
    print no_of_horses_98

    print ''

    print 'Born05 Dataset Statistics:'
    print 'Race counts of horses for races with all runners: '
    print full_horses_race_count_05
    print 'No. of races:'
    print no_of_races_05
    print 'No. of horses:'
    print no_of_horses_05

    plot_graph(no_of_races_98, no_of_horses_98,
               'No. of Races per Horse (Born98 Dataset)')
    plot_graph(no_of_races_05, no_of_horses_05,
               'No. of Races per Horse (Born05 Dataset)')
def main():
    horses98 = HorseParser('./../Data/born98.csv').horses
    horses05 = HorseParser('./../Data/born05.csv').horses

    races98 = RaceParser('./../Data/born98.csv').races
    races05 = RaceParser('./../Data/born05.csv').races

    race_classes_98 = get_classes(full_races_98)
    race_classes_05 = get_classes(full_races_05)

    for c in race_classes:
        print c
        no_of_races, av_speed = average_speed(races98, c)
        print 'Race class: ' + str(c)
        print 'No. of races: ' + str(no_of_races)
        print 'Average speed of a horse running in this race class: ' + str(
            av_speed)
예제 #7
0
def main():
    horses98 = HorseParser('./../Data/born98.csv').horses
    horses05 = HorseParser('./../Data/born05.csv').horses

    races98 = RaceParser('./../Data/born98.csv').races
    races05 = RaceParser('./../Data/born05.csv').races

    goings98 = get_goings(races98)
    goings05 = get_goings(races05)

    print 'No. of different types of going in 98 dataset: ' + str(
        len(goings98))
    print goings98

    print ''

    print 'No. of different types of going in 05 dataset: ' + str(
        len(goings05))
    print goings05

    print ''
    '''
예제 #8
0
def main():
    horse_parser_98 = HorseParser('./../Data/born98.csv')
    horse_parser_05 = HorseParser('./../Data/born05.csv')

    race_parser_98 = RaceParser('./../Data/born98.csv')
    race_parser_05 = RaceParser('./../Data/born05.csv')

    horse_parser_no_handicaps_98 = HorseParserNoHandicaps('./../Data/born98.csv')
    horse_parser_no_handicaps_05 = HorseParserNoHandicaps('./../Data/born05.csv')

    race_parser_no_handicaps_98 = RaceParserNoHandicaps('./../Data/born98.csv')
    race_parser_no_handicaps_05 = RaceParserNoHandicaps('./../Data/born05.csv')

    horses98 = horse_parser_98.horses
    horses05 = horse_parser_05.horses

    races98 = race_parser_98.races
    races05 = race_parser_05.races

    full_races_98 = get_full_races(races98)
    full_races_05 = get_full_races(races05)

    total_races_with_all_horses_98 = no_of_races_with_all_horses(races98)
    total_races_with_winners_98 = no_of_races_with_winner(races98, horses98)

    total_races_with_all_horses_05 = no_of_races_with_all_horses(races05)
    total_races_with_winners_05 = no_of_races_with_winner(races05, horses05)

    average_races_per_horse_98 = average_no_of_races_per_horse(horses98)
    average_races_per_horse_05 = average_no_of_races_per_horse(horses05)

    ages98 = get_ages(full_races_98)
    ages05 = get_ages(full_races_05)

    no_of_races_per_age_98 = races_at_each_age(full_races_98, ages98)
    no_of_races_per_age_05 = races_at_each_age(full_races_05, ages05)

    races_with_k_missing_horses_98 = races_with_k_missing_runners(races98)
    races_with_k_missing_horses_05 = races_with_k_missing_runners(races05)

    print 'born98.csv file statistics:'
    print 'No. of horses: ' + str(len(horses98))
    print 'No. of races: ' + str(len(races98))
    print 'No. of races for which we have all the horses: ' + str(total_races_with_all_horses_98)
    print 'No. of races for which we have the winner: ' + str(total_races_with_winners_98)
    print 'Fraction of races for which we have all the horses: ' + str(float(total_races_with_all_horses_98)/len(races98))
    print 'Fraction of races for which we have the winner: ' + str(float(total_races_with_winners_98)/len(races98))
    print 'Average no. of races per horse: ' + str(average_races_per_horse_98)
    print 'No. of races for horses at each age: ' + str(no_of_races_per_age_98)
    print 'No. of races with k-missing horse records: ' + str(races_with_k_missing_horses_98)
    print 'No. of horse records with comptime missing: ' + str(horse_parser_98.comptime_missing)
    print 'No. of race records with comptime missing: ' + str(race_parser_98.comptime_missing)
    print 'No. of horse records with Irish race class: ' + str(horse_parser_98.irish_races)
    print 'No. of race records with Irish race class ' + str(race_parser_98.irish_races)
    print 'No. of races without handicap races:' + str()

    print ''

    print 'born05.csv file statistics:'
    print 'No. of horses: ' + str(len(horses05))
    print 'No. of races: ' + str(len(races05))
    print 'No. of races for which we have all the horses: ' + str(total_races_with_all_horses_05)
    print 'No. of races for which we have the winner: ' + str(total_races_with_winners_05)
    print 'Fraction of races for which we have all the horses: ' + str(float(total_races_with_all_horses_05)/len(races05))
    print 'Fraction of races for which we have the winner: ' + str(float(total_races_with_winners_05)/len(races05))
    print 'Average no. of races per horse: ' + str(average_races_per_horse_05)
    print 'No. of races for horses at each age: ' + str(no_of_races_per_age_05)
    print 'No. of races with k-missing horse records: ' + str(races_with_k_missing_horses_05)
    print 'No. of horse records with comptime missing: ' + str(horse_parser_05.comptime_missing)
    print 'No. of race records with comptime missing: ' + str(race_parser_05.comptime_missing)
    print 'No. of horse records with Irish race class: ' + str(horse_parser_05.irish_races)
    print 'No. of race records with Irish race class ' + str(race_parser_05.irish_races)