Create a model for predicting the hotel review scores based on the reviews.
The train and test datasets can be found in the Kaggle competition here.
hotel_address
- hotel address;review_date
— date when the reviewer posted the review;average_score
— average hotel score based on the last review for the last year;hotel_name
- hotel name;reviewer_nationality
- nationality of the reviewer;negative_review
— negative review a reviewer provided to the hotel;review_total_negative_word_counts
— total words in the negative review;positive_review
— negative review a reviewer provided to the hotel;review_total_positive_word_counts
— total words in the positive review;reviewer_score
— score a reviewer gave to the hotel based on their experience;total_number_of_reviews_reviewer_has_given
— total reviews the reviewer wrote in the past;total_number_of_reviews
— total reviews of the hotel;tags
— tags which a reviewer attached to their review;days_since_review
— number of days between the date of checking and the data of cleaning;additional_number_of_scoring
— number of scores without review, since some guests only left the score but didn't provide any feedback;lat
— hotel latitude;lng
— hotel longitude.
- Adjusted feature typings
- Removed duplicates
- Filled missing values for
lat
andlng
with mean values of other hotels in the same area - Removed outliers based on log-normally distributed
additional_number_of_scoring
andtotal_number
of reviews, using the 3-sigma limits
Please, go to the ipynb notebook in the repo to see visualizations and their interpretations.
Engineered features:
country
,city
,postcode
and residualaddress
of the hotels for more granular address decompositionis_negative
andis_positive
to evaluate whether each reviewer provided both negative and positive reviewstotal_scores
, identifying the overall score count, including both scores with and without written reviewspositive_negative_word_delta
to measure the difference between the number of words in the positive and negative reviews for the same revieweryear
,month
,day_week
,day_month
,day_year
,season
to get more granular on the timings of the reviewssame_reviewer_country
to check whether the nationality of the reviwer is the same with the country of the hotel to check for potential review biasnegative_sentiment_{}
andpositive_sentiment_{}
, measuring the overall sentiment of both negative and positive reviews. UsingSentimentAnalyzer()
of the nltk lib, calculated the positive, negative, neutral and compound scores for both negative and positive reviewstrip_type
- whether the trip was leisure, business or othertrip_group
- whether the trip was solo, as a couple, with friends, with familiar with young/older kids or with a petroom
- whether the reviewer stayed in a room, suite or studionights
- number of nights the reviewer stayed formobile_submission
- whether the review was submitted from mobilegeo_cluster
to create geo clusters for the hotels based on theirlat
andlng
which are not informative in themselves
- Normalized abnormally distributed numerical features using Robust Scaler
- Standartized normally distributed
positive_negative_word_delta
- Encoded categorical features with less than 5 unique values using OneHot Encoding
- Encoded categorical features with >= 5 unique values using Binary Encoding
- Using Spearman correlation due to the abnormal distribution of the features, identified features with multicollinearity (correlation score >= 0.7 or <= -0.7) and dropped the less informative of them
- Used F-scores to remove features with F-score below 5 to decrease the risk of overfitting
- Split the train dataset into 2: 75% to train the model, 25% to validate
- Used
RandomForestRegressor()
from sklearn with 100 estimators to build the review score prediction model - Used Mean Absolute Percentage Error (MAPE) to measure the model performance, achieving the MAPE of 0.1206