This program is designed to predict the prices of airline tickets using a machine learning model based on the RandomForestRegressor. It incorporates feature selection with Recursive Feature Elimination (RFE) and hyperparameter tuning using Randomized Search Cross-Validation (RandomizedSearchCV).
Make sure you have the necessary libraries installed (see requirements.txt
). You can also install needed libraries at a later time.
- Clone the repository:
git clone [email protected]:alex-wang-13/Flight-Price-Predictor.git
cd flight-price-predictor
- Make sure that you have all the libraries needed to run the program:
pip install -r requirements.txt
- Run the script:
python flight_price_predictor.py
- Enter the file path to your training data when prompted.
- The program will process the data, convert non-numerical features to numerical ones, and show the correlation matrix with respect to the price column.
- It will split the data into training and testing sets, perform feature selection using RFE, and find the best hyperparameters using Randomized Search CV.
- Finally, it will use the best model to predict prices on the test set, calculate the accuracy (R-squared score), and export the results to a CSV file named
prediction.csv
.
Ensure that your training data is in a CSV file format with a 'price' column representing the target variable.
- Input: CSV file containing training data.
- Output: 'prediction.csv' containing predicted prices on the test set.
Alex Wang
This project is licensed under the MIT License - see the LICENSE file for details.