Write a Python program to predict the level of corruption in a country based on a range of macro- economic and social features. The table below lists some countries described by the following descriptive features: • LIFE EXP: the mean life expectancy at birth • TOP-10 INCOME: the percentage of the annual income of the country that goes to the top 1096 of earners • INFANT MORT: the number of infant deaths per 1000 births • MIL SPEND the percentage of GDP spent on the military • SCHOOL YEARS: the mean number years spent in school by adult females The largest feature is the corruption perception index (CPI). The CPI measures the perceived levels of corruption in the public sector of countries and ranges from 0 (highly corruption) to 100 Country CPI Infant Mort 74.30 73.10 82.62 Afghanistan Haiti Nigeria Egypt Argentina China Brazil Israel USA Ireland UK Germany Canada Australia Sweden New Zealand LIFE EXP 59.61 45.00 51.30 70.48 75.77 74.87 73.18 81.30 78.51 80.15 80.09 80.24 80.99 82.09 81.43 80.67 Top-10 Income 23.21 47.67 38.23 26.58 32.30 29.98 42.93 28.80 29.85 27.23 28.49 22.07 24.79 25.40 22.18 27.81 19.60 13.30 13.70 14.50 3.60 6.30 3.50 4.40 3.50 4.90 4.20 2.40 4.90 Mil Spend 4.44 0.09 1.07 1.86 0.76 1.95 1.43 6.77 4.72 0.60 2.59 1.31 1.42 1.86 1.27 1.13 School Year 0.40 3.40 4.10 5.30 10.10 6.40 7.20 12.50 13.70 11.50 13.00 12.00 14.20 11.50 12.80 12.30 1.5171 1.7999 2.4493 2.8622 2.9961 3.6356 3.7741 5.8096 7.1357 7.5360 7.7751 8.0461 8.6725 8.8442 9.2985 9.4627 We will use Russia as our query country for this question. The table below lists the descriptive features for Russia Country CPI UFE EXP 67.62 Top-10 Income 31.68 Infant Mort 10.00 Mil Spend 3.87 School Year 12.90 Russia 1. Write a python code to predict the value of 3-nearest neighbor prediction model using Euclidean distance return for the CPI of Russia. 2. Write a python code to predict the value of 12-nearest neighbor prediction model using Euclidean distance return for the CPI of Russia. Show transcribed image text Write a Python program to predict the level of corruption in a country based on a range of macro- economic and social features. The table below lists some countries described by the following descriptive features: • LIFE EXP: the mean life expectancy at birth • TOP-10 INCOME: the percentage of the annual income of the country that goes to the top 1096 of earners • INFANT MORT: the number of infant deaths per 1000 births • MIL SPEND the percentage of GDP spent on the military • SCHOOL YEARS: the mean number years spent in school by adult females The largest feature is the corruption perception index (CPI). The CPI measures the perceived levels of corruption in the public sector of countries and ranges from 0 (highly corruption) to 100 Country CPI Infant Mort 74.30 73.10 82.62 Afghanistan Haiti Nigeria Egypt Argentina China Brazil Israel USA Ireland UK Germany Canada Australia Sweden New Zealand LIFE EXP 59.61 45.00 51.30 70.48 75.77 74.87 73.18 81.30 78.51 80.15 80.09 80.24 80.99 82.09 81.43 80.67 Top-10 Income 23.21 47.67 38.23 26.58 32.30 29.98 42.93 28.80 29.85 27.23 28.49 22.07 24.79 25.40 22.18 27.81 19.60 13.30 13.70 14.50 3.60 6.30 3.50 4.40 3.50 4.90 4.20 2.40 4.90 Mil Spend 4.44 0.09 1.07 1.86 0.76 1.95 1.43 6.77 4.72 0.60 2.59 1.31 1.42 1.86 1.27 1.13 School Year 0.40 3.40 4.10 5.30 10.10 6.40 7.20 12.50 13.70 11.50 13.00 12.00 14.20 11.50 12.80 12.30 1.5171 1.7999 2.4493 2.8622 2.9961 3.6356 3.7741 5.8096 7.1357 7.5360 7.7751 8.0461 8.6725 8.8442 9.2985 9.4627 We will use Russia as our query country for this question. The table below lists the descriptive features for Russia Country CPI UFE EXP 67.62 Top-10 Income 31.68 Infant Mort 10.00 Mil Spend 3.87 School Year 12.90 Russia 1. Write a python code to predict the value of 3-nearest neighbor prediction model using Euclidean distance return for the CPI of Russia. 2. Write a python code to predict the value of 12-nearest neighbor prediction model using Euclidean distance return for the CPI of Russia.
Expert Answer
Answer to Write a Python program to predict the level of corruption in a country based on a range of macro- economic and social fe…