Giter Site home page Giter Site logo

starrrr1 / kaggle-taxi-travel-time-prediction Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ffyu/kaggle-taxi-travel-time-prediction

0.0 1.0 0.0 13 KB

My solution using a specially designed Scalable Random Forest Model

License: MIT License

Python 100.00%

kaggle-taxi-travel-time-prediction's Introduction

Kaggle-Taxi-Travel-Time-Prediction

https://www.kaggle.com/c/pkdd-15-taxi-trip-time-prediction-ii

Final Leaderboard Ranking: 48/345

This is one of the models used in my final submission of the Kaggle's Taxi trip time prediction competition.

The basic idea of a Random Forest model is to ensemble a number of different trees, with each tree trained on a bootstrapped sample and a subset of features under each split. If we decide to go with a large number of trees in the forest for a sizable training set, the total memory required in the process would be huge. With the constraint of RAM on a personal laptop (normally 8-16 GB), this can cause difficulties in training the model.

The script Submission.py utilizes a specially designed Scalable Random Forecast algorithm. The idea is similar to the original Random Forest - i.e. to generate diversified trees and average the results to improve performance. To scale the problem, instead of using a bootstrapped sample with the same size as the original data set, we split the entire training set into a number of partitions, and train each single tree on a single partition. The number of partitions is equal to the number of trees and each partition has the same size. Now we have a much smaller training data for each tree but still manage to keep the sample diversified. The idea of subsetting the features on every split is still kept in this adjusted algorithm. All those should lead to many different yet useful single trees. By bagging them, we would be able to achieve similar accuracy compared to traditional Random Forest, but with a much less requirement of RAM usage.

The dependencies of this script include:

To run the script, please change the global variable FOLDER to your local directory, and also download the train and test sets from the competition website. The script would generate a bunch of intermediate files. The final prediction of the test set is named "submission_final.csv". The running time is roughly two hours on an i7-16G laptop.

Also note that this is only one model that contributes to my final result. I used another model which breaks down the training set by varying time of the day. That model does not have the RAM usage problem since it has been divided into pieces by time of the day.

Please feel free to email me if you have any comments/suggestions.

Feifei Yu

[email protected]

kaggle-taxi-travel-time-prediction's People

Contributors

ffyu avatar

Watchers

 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.