Giter Club home page Giter Club logo

hk-horse-racing's Introduction

Purpose of project

For detail explanation, please visit my web site www.mlact.com (in chinese only)

The purpose of this project is a stepping stone for myself to learn Machine Learning through a real life case. The reason why choosing Hong Kong horse racing is HKJC maintains high quality of data and transparent to public access. The project was started with excel VBA and SAS using traditional statistic method and move forward to SQL and R for using Machine Learning methods. The project here only demonstrated part of my work where:

  • Number of feature: reduced from 100+ to less than 10
  • Modelling method: Only 4 methods used here while more than 10 tested
  • Ensemble method: Xgboost stacking model used

The following is the procedures taken and different approach was used.

1. Data Collection

Collect data from HKJC and newspaper web sites, including each race result, horse basic information, trackwork etc, approximately 8,000 races and 100,000 rows data (started with Excel VBA and now using R with web page xpath)

2. Data Cleaning

Check whether the data set contains NA / missing / Inf and imputing mean / max / min / 0 or being removed as necessary (Started with Excel and now using R)

3. Feature Engineering

Merge data tables and extract addition predictors such as speed rating, last phase speed, horse win percentage etc. (Started with Excel VBA and SAS / SQL and now using R)

4. Data Transformation

Normalize or scale the data for standardized unit, extracting predictors for next step

5. Data Set Preparation

Stratified sampling the whole data set per race and splitting data into train: 75%, %, test: 25%

6. Variable Importance

Using Random Forest to find the importance of variable to response

7. Predictive model

a.With two – steps conditional logistic regression, where using fundamental predictors to model the basic strength for each horse, then applying public odds for to predict the probability of winning for each horse in the same race b.Adopting other Machine Learning method, such as Random Forest, Support Vector Machine,Xgboost with tuned data

8. Comparing Different Models

Comparing confusion matrix from different approaches together with the variable importance and cross validation, picking the best modelling method for analysis. Fine tuning predictors, learning rate, training / testing data set splitting.

Result

The fundamental model’s accuracy (without applying odds as factor) for predicting winner is slightly lower than public favorite (around 28% accuracy) but the average odds return is higher than the public’s estimation. In all, the return turns out with a marginal profit. There is potential to increase the accuracy by enhancing feature engineering and applying more sophisticated algorithm. However, as too much noise and mankind uncertainty involved in race, it is expected that the accuracy may be lift up by only a few percent as the existing public estimate is fairly efficient.

hk-horse-racing's People

Contributors

acmayuen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.