This is an API Rest that uses an ML model to make prediction of the happiness score of a country.
The dataset was obtained from Kaggle, its name is The World Happiness and you can look it here. The dataset is split in a lot of years from 2015 until 2019 in .csv
files. Before fitting the model these files are transformed. Mainly, merging the firsts 3 files and changing its columns can use a dataset with more data.
This project was built with Python using the library Scikit-Learn. For obtain the best model, I use the method from sklearn, GridSearchCV
, this allow test a serie of configurations and ML models, in this case the models:
- SVR
- GradientBoostingRegressor
With the next configurations:
self.params = {
'SVR': {
'kernel': ['linear', 'poly', 'rbf'],
'gamma': ['auto', 'scale'],
'C': [1, 5, 10],
},
'GRADIENT': {
'loss': ['ls', 'lad'],
'learning_rate': [0.01, 0.05, 0.1],
},
}
For API was used Flask and Boostrap to the styles and the HTML.
For use the model you must import a file previously created by main.py
. In this way, the user can tester different parameters to have a prediction of the model.