Author- Namarta Gocher
Malaria is a blood disease caused by a parasite called plasmodium; transmitted from humans by the female Anopheles mosquito. Different malaria symptoms help us to predict that a person is suffering from malaria. In 2019, there are a total of 409,000 deaths in the world are due to malaria, so it is very important to the prognosis, it is an efficient and effective way.
![](https://static.wixstatic.com/media/6e3b57_d41b5b7018f240589696e3cd851041ea~mv2.jpeg/v1/fill/w_980,h_644,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/6e3b57_d41b5b7018f240589696e3cd851041ea~mv2.jpeg)
FIG:1
![](https://static.wixstatic.com/media/6e3b57_845f096520114987995c04cd09579889~mv2.jpeg/v1/fill/w_980,h_327,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_845f096520114987995c04cd09579889~mv2.jpeg)
FIG:2
It has 1000 rows of data and 19 columns, which are age, sex, fever, cold, rigor, fatigue, headache, bitter tongue, vomiting, diarrhea, Convulsion, Anemia, jaundice, cocacola urine, hypoglycemia, prostration, hyperpyrexia, severe malaria. We will be using KNN, DECISION TREE, LOGISTIC REGRESSION, and SVM for classifying the result. Then we will compare all the results given by these algorithms. First, we will convert the data set in 0 or 1 to fit for the classification and then predict.
![](https://static.wixstatic.com/media/6e3b57_a08e9a6ba118471aaddf0fbdc97af4ba~mv2.jpeg/v1/fill/w_980,h_205,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_a08e9a6ba118471aaddf0fbdc97af4ba~mv2.jpeg)
FIG:3
![](https://static.wixstatic.com/media/6e3b57_802057d037d048c98432d5df4ea1c9b4~mv2.jpeg/v1/fill/w_597,h_343,al_c,q_80,enc_auto/6e3b57_802057d037d048c98432d5df4ea1c9b4~mv2.jpeg)
FIG:4
After KNN training:
![](https://static.wixstatic.com/media/6e3b57_1b83d99e778c42dd806395686074e88c~mv2.jpeg/v1/fill/w_669,h_432,al_c,q_80,enc_auto/6e3b57_1b83d99e778c42dd806395686074e88c~mv2.jpeg)
FIG:5
Now calculating all the training and testing scores by comparing KNN, DECISION TREE, LOGISTIC REGRESSION, SVM based on training and testing scores we get:
![](https://static.wixstatic.com/media/6e3b57_a921ad41f8f8461a9ab1955ab5980fc4~mv2.jpeg/v1/fill/w_980,h_314,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_a921ad41f8f8461a9ab1955ab5980fc4~mv2.jpeg)
FIG;6
All four algorithms are supervised machine learning algorithms.
![](https://static.wixstatic.com/media/6e3b57_b1833df692e04344865c7ee4a4aae17e~mv2.jpeg/v1/fill/w_980,h_187,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/6e3b57_b1833df692e04344865c7ee4a4aae17e~mv2.jpeg)
FIG:7
Flow Chart:
![](https://static.wixstatic.com/media/6e3b57_f41fead925d1420d9380bf2a631fa5c0~mv2.jpeg/v1/fill/w_893,h_664,al_c,q_85,enc_auto/6e3b57_f41fead925d1420d9380bf2a631fa5c0~mv2.jpeg)
FIG:8
K-Nearest Neighbor(KNN)
KNN is a nonparametric, lazy learning algorithm. Its purpose is to use a database with the data points, divided into the number of classes to predict the classification from the point of view of a specimen.
The steps for the calculation of the K-nearest neighbors:
Set the parameter K= number of nearest neighbors.
To calculate the distance between the study and all of the training samples.
The sort of distance, and defined, the nearest neighbors based on the Kth minimum distance.
Collect the category of the y-nearest neighbors
The use of a simple majority of the categories, of which the nearest neighbors, the forecasted value of the query instance.
DECISION TREE
A decision tree is similar to that of a flow chart: each internal node represents a "test" as an attribute (for example, if a flip was heads or tails), each case is the result of the test, and in each of the last node, the node labels in a class, if a decision is taken, after that take into consideration all of the attributes).
There are some impurity measure are there like
Entropy
Gini index/ Gini impurity
Entropy
Entropy is the amount of information that is needed to accurately describe an example of this. So, if the sample is homogeneous, then all the records in which the entropy is 0; otherwise, if the test is a multiple of equal, the larger the entropy is a maximum of 1.
So, on the left of the cup, it is the lowest level of entropy, in the middle of the cup has more entropy, and to the right of the cup with the greatest entropy.
Mathematically written as,
![](https://static.wixstatic.com/media/6e3b57_dc43d4b50b4c4c8bb701be7257438131~mv2.jpg/v1/fill/w_474,h_131,al_c,q_80,enc_auto/6e3b57_dc43d4b50b4c4c8bb701be7257438131~mv2.jpg)
FIG:9
Gini index / Gini impurity
The Gini index is a measure of income inequality. It has a value between 0 and 1. A Gini index value of 0 means that there is a need to be perfectly consistent, not all of the elements are the same, while the Gini index with a value of 1 implies that there exists a maximal inequality among them. This, the sum of the squares estimates in each of the classes. This is because, as described below, the
![](https://static.wixstatic.com/media/6e3b57_1ad7c3e115d5416a85837809d744b4dd~mv2.jpg/v1/fill/w_542,h_108,al_c,q_80,enc_auto/6e3b57_1ad7c3e115d5416a85837809d744b4dd~mv2.jpg)
FIG:10
LOGISTIC REGRESSION
The logistic regression model is a statistical model that in its basic form uses a logistic function to model a double, the dependencies of variables, even though many of the more complex add-ons. In regression analysis, logistic regression is estimating the parameters of a logistic model of the binary regression model for the form).
Showing Varginica from iris data after applying logistic regression:
![](https://static.wixstatic.com/media/6e3b57_7d509aa1679e461392cf70814c67f6b3~mv2.jpeg/v1/fill/w_918,h_304,al_c,q_80,enc_auto/6e3b57_7d509aa1679e461392cf70814c67f6b3~mv2.jpeg)
FIG:11
Support Vector Machine
SVM is one of the most popular and versatile machine learning algorithms. It is widely used for classification problems, for regression problems. However, on this subject, let's talk about the classification of the trouble. It is generally the preferred choice for medium-sized to small data set sizes. The main task of the SVM is to find the optimal hyperplane, the line that divides the data points of the components, and the two terms of the highest profit margin.
![](https://static.wixstatic.com/media/6e3b57_d802f7d8d10c46f8b49ef456e990ede9~mv2.jpg/v1/fill/w_852,h_805,al_c,q_85,enc_auto/6e3b57_d802f7d8d10c46f8b49ef456e990ede9~mv2.jpg)
FIG:12
GitHub Code:
https://github.com/namartagocher/malaria_prediction
References:
https://eu.biogents.com/malaria/
https://www.sciencedirect.com/science/article/abs/pii/S0010482520304820?dgcid=rss_sd_all
Comments