A Codeforces Rating Predictor that estimates changes in user ratings after a contest. The project utilizes machine learning techniques to analyze performance and predict ratings based on contest standings. The prediction model is integrated into a browser extension for seamless interaction with the Codeforces platform.
- Prediction of Rating Changes: Based on user performance and relative standings in a contest.
- Machine Learning Model: Uses Random Forest algorithm optimized with Bayesian optimization.
- Browser Extension: Built using HTML, CSS, and JavaScript, allowing users to easily predict rating changes directly on Codeforces.
- Flask API: A local server processes the data and returns predictions.
- Project Overview
- Technical Stack
- Data Preprocessing
- Machine Learning Model
- Browser Extension
- Usage
- Setup
- Future Improvements
- License
The aim of this project is to predict the rating changes for Codeforces participants after a contest. By analyzing historical data and the standings from a particular contest, the system estimates the relative performance of each participant and provides an accurate prediction of their new rating.
- Programming Languages: Python, JavaScript
- Backend: Flask
- Frontend: HTML, CSS, JavaScript
- Machine Learning: Random Forest with Bayesian Optimization
- Data Handling: NumPy, Pandas
- Model Deployment: Flask API on Local Server
The preprocessing step plays a vital role in this project. The following strategies were employed:
- Surrounding Averages: Compute the average ratings of participants in close ranking positions. This helps determine the relative performance of a participant during a contest.
- Feature Engineering: Various features were created based on past ratings, ranks, and other relevant metrics.
- Sorting & Cleaning: Data was sorted based on old ratings, and any irrelevant or missing data was handled accordingly.
- The project uses the Random Forest algorithm for prediction. It is an ensemble learning method that aggregates the predictions from multiple decision trees to improve accuracy and robustness.
- Bayesian Optimization was used to fine-tune the hyperparameters of the model, ensuring that it provides the most accurate predictions possible.
- Performance was evaluated using metrics like Mean Absolute Error (MAE) and Root Mean Squared Error (RMSE).
- Cross-validation was conducted to ensure the model generalizes well on unseen data.
The browser extension was developed using HTML, CSS, and JavaScript. Users can interact with the extension to:
- Select a Codeforces contest.
- Input their handle to get a prediction of their new rating.
- View the results directly within the extension without navigating away from the Codeforces website.
- User-Friendly UI: Simple and intuitive design.
- Real-Time Predictions: Fetches contest data and sends it to the local server for processing.
- Integration with Codeforces: Allows users to see predictions based on live data from the platform.
-
Start the Flask Server:
python app.py
-
Use the Browser Extension:
- Install the extension by loading the
manifest.json
file in your browser. - Navigate to a Codeforces contest page.
- Open the extension and input your handle.
- Click on "Predict" to see the rating change estimate.
- Install the extension by loading the
- Python 3.x
- Flask
- scikit-learn
- Pandas
- NumPy
- Bayesian Optimization Libraries: e.g.,
scikit-optimize
- Browser with Extension Support: Chrome, Firefox, etc.
-
Clone the Repository
git clone https://github.com/yourusername/CF-Rating-Predictor.git cd CF-Rating-Predictor
-
Install Python Dependencies
pip install -r requirements.txt
-
Run the Flask API
python app.py
-
Install the Browser Extension
- Go to
chrome://extensions/
(or the equivalent for your browser). - Enable "Developer mode".
- Click on "Load unpacked" and select the
extension/
directory.
- Go to
-
Make Predictions: Open the extension, select a contest, input your handle, and get predictions!
- Model Enhancements: Integrate more sophisticated algorithms like Gradient Boosting Machines (GBM) or neural networks for better accuracy.
- Data Source Automation: Automate the fetching of historical data to update the model regularly.
- Deployment: Deploy the Flask API on a cloud server to make it accessible anywhere.
- Cross-Browser Compatibility: Extend the extension support to other popular browsers.
This project is licensed under the MIT License - see the LICENSE file for details.