Logo Lanfrica

Sasan-Faraj/wealth_prediction

Domain:

socioeconomic

Record type:

project
Creator:
Sas
Host:
As an personal extension of my previously completed extra credit assignment, I aimed to compare a random forest model and a K-nearest neighbors model in their accuracy of predicting wealth of people in Liberia # Liberia Wealth Prediction As a personal extension of my previously completed extra credit assignment (located here), I aimed to compare a random forest model and a K-nearest neighbors model in their accuracy of predicting the level of wealth of individuals in Liberia. My code for this project can be located here. ___ ## Initial Analysis A correlation matrix was not created in the primary analyses of the features or the target because neither the data did not appear to be linearly based in the previous project. In order to double check that the data seemed to be accurately distributed, a pairplot of the features was created. The features in this case were location, gender, size, education, and age. All of the features were represented as a in interger data type. The pairplot demonstrates that the data is not distributed in any abnormal ways that would require further investigation. When examining the target, it appears that the vast majority of individuals, 75%, are ranked below 3 out of 5, indicating that those who make the most money are outliers of the data set. The box plot below depicts the range of wealth from the data set. This box plot indicates that the models may have some trouble predicting the wealth because the data set has an over-representation of individuals who make relatively lower income compared to the other individuals. ___ ## K-Nearest Neighbors Because the KNN model relies on the distance between k points, an instance of the KNN model was created for three seperate standardizations of the features: no standarization (ie raw data), Standard Scaler (SS), and MinMax Scaler (MM). Forty percent of the data was made into the test data and 60 percent was made into the training data. The decision behind this split was to prevent from too high of an internal validity and limit overfitting. Graphs of the different instances were created in order to depict the varying levels of training/testing scores for different numbers of k ranging from …