

{"id":69884,"date":"2019-09-17T14:28:49","date_gmt":"2019-09-17T08:58:49","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=69884"},"modified":"2025-07-29T18:34:49","modified_gmt":"2025-07-29T13:04:49","slug":"python-machine-learning-project-detecting-parkinson-disease","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/","title":{"rendered":"Python Machine Learning Project &#8211; Detecting Parkinson\u2019s Disease with XGBoost"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1400,&quot;href&quot;:&quot;https:\\\/\\\/archive.ics.uci.edu\\\/ml\\\/machine-learning-databases\\\/parkinsons&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20230327100257\\\/https:\\\/\\\/archive.ics.uci.edu\\\/ml\\\/machine-learning-databases\\\/parkinsons\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 06:31:02&quot;,&quot;http_code&quot;:502},{&quot;date&quot;:&quot;2025-12-12 12:53:30&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-15 16:18:20&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-19 06:25:06&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-22 07:00:11&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-26 00:47:43&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2025-12-29 11:31:48&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-01 14:07:17&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-04 15:48:20&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-07 21:28:42&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-11 03:26:27&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-14 12:03:22&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-17 17:18:08&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-20 21:06:27&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-24 04:29:57&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-27 06:01:22&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-01-30 07:49:06&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-02 09:23:20&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-05 10:50:43&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-08 12:39:52&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-11 14:20:24&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-14 14:48:45&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-17 17:01:58&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-20 18:41:16&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-23 20:09:20&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-27 05:47:29&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-02 07:41:40&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-05 09:10:44&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-08 15:35:14&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-11 16:24:55&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-15 00:02:59&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-18 04:40:08&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-21 05:55:09&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-24 06:08:43&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-27 13:47:22&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-30 20:52:33&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-03 00:10:29&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-06 05:48:45&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-09 06:57:13&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-12 19:04:20&quot;,&quot;http_code&quot;:502},{&quot;date&quot;:&quot;2026-04-15 19:05:23&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-19 02:40:19&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-22 05:40:51&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-25 07:40:07&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-28 11:16:40&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-01 17:28:23&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-04 18:34:27&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-08 09:02:31&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-11 09:43:09&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-14 11:51:50&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-17 14:23:07&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-21 01:32:45&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-24 16:37:38&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-27 21:23:55&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-05-31 06:54:40&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-03 09:09:39&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-06 10:29:09&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-09 12:09:42&quot;,&quot;http_code&quot;:404}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-09 12:09:42&quot;,&quot;http_code&quot;:404},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:1401,&quot;href&quot;:&quot;https:\\\/\\\/techvidvan.com\\\/ai-data-science-course-multilingual&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>In our list of Python projects, detecting Parkinson&#8217;s disease with python is on the 3rd position. In this Python Machine learning project, we will build a model using which we can accurately detect the\u00a0presence of Parkinson&#8217;s disease in one&#8217;s body.<\/p>\n<p>Here are some more Python Machine Learning Projects which you can bookmark for practicing later:<\/p>\n<ol>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/advanced-python-project-detecting-fake-news\/\">Fake News Detection Python Project\u00a0<\/a><\/li>\n<li>Parkinson&#8217;s Disease Detection Python Project<\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/project-in-python-colour-detection\/\">Color Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-mini-project-speech-emotion-recognition\/\">Speech Emotion Recognition Python Project\u00a0<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/project-in-python-breast-cancer-classification\/\">Breast Cancer Classification Python Project\u00a0<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-gender-age-detection\/\">Age and Gender Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-deep-learning-project-handwritten-digit-recognition\/\">Handwritten Digit Recognition Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-chatbot-project\/\">Chatbot Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-driver-drowsiness-detection-system\/\">Driver Drowsiness Detection Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-project-traffic-signs-recognition\/\">Traffic Signs Recognition Python Project<\/a><\/li>\n<li><a href=\"https:\/\/data-flair.training\/blogs\/python-based-project-image-caption-generator-cnn\/\">Image Caption Generator Python Project<\/a><\/li>\n<\/ol>\n<p>So, let&#8217;s start the Python Machine Learning Project with the introduction of terms used &#8211;<\/p>\n<h3>Detecting Parkinson&#8217;s Disease &#8211; Python Machine Learning Project<\/h3>\n<h4>What is Parkinson\u2019s Disease?<\/h4>\n<p>Parkinson&#8217;s disease is a progressive disorder of the central nervous system affecting movement and inducing tremors and stiffness. It has 5 stages to it and affects more than 1 million individuals every year in India. This is chronic and has no cure yet. It is a neurodegenerative disorder affecting dopamine-producing neurons in the brain.<\/p>\n<h4>What is XGBoost?<\/h4>\n<p>XGBoost is a new Machine Learning algorithm designed with speed and performance in mind. XGBoost stands for eXtreme Gradient Boosting and is based on decision trees. In this project, we will import the XGBClassifier from the xgboost library; this is an implementation of the scikit-learn API for XGBoost classification.<\/p>\n<h4>Detecting Parkinson&#8217;s Disease with XGBoost &#8211; Objective<\/h4>\n<p>To build a model to accurately detect the presence of Parkinson\u2019s disease in an individual.<\/p>\n<h4>Detecting Parkinson&#8217;s Disease with XGBoost &#8211; About the Python Machine Learning Project<\/h4>\n<p>In this Python machine learning project, using the <a href=\"https:\/\/data-flair.training\/blogs\/python-libraries\/\"><em><strong>Python libraries<\/strong><\/em><\/a> scikit-learn, numpy, pandas, and xgboost, we will build a model using an XGBClassifier. We\u2019ll load the data, get the features and labels, scale the features, then split the dataset, build an XGBClassifier, and then calculate the accuracy of our model.<\/p>\n<h4>Dataset for Python Machine Learning Project<\/h4>\n<p>You\u2019ll need the UCI ML Parkinsons dataset for this; you can <a href=\"https:\/\/archive.ics.uci.edu\/ml\/machine-learning-databases\/parkinsons\/\"><em><strong>download it here<\/strong><\/em><\/a>. The dataset has 24 columns and 195 records and is only 39.7 KB.<\/p>\n<h4>Prerequisites<\/h4>\n<p>You\u2019ll need to install the following libraries with pip:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">pip install numpy pandas sklearn xgboost<\/pre>\n<p>You\u2019ll also need to install Jupyter Lab, and then use the command prompt to run it:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">C:\\Users\\DataFlair&gt;jupyter lab<\/pre>\n<p>This will open a new JupyterLab window in your browser. Here, you will create a new console and type in your code, then press Shift+Enter to execute one or more lines at a time.<\/p>\n<h3>Steps for Detecting Parkinson&#8217;s Disease with XGBoost<\/h3>\n<p>Below are some steps required to practice Python Machine Learning Project &#8211;<\/p>\n<p>1. Make necessary imports:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import numpy as np\r\nimport pandas as pd\r\nimport os, sys\r\nfrom sklearn.preprocessing import MinMaxScaler\r\nfrom xgboost import XGBClassifier\r\nfrom sklearn.model_selection import train_test_split\r\nfrom sklearn.metrics import accuracy_score<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/import-data-python-machine-learning-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69897\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/import-data-python-machine-learning-project.png\" alt=\"Python machine learning project\" width=\"456\" height=\"163\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/import-data-python-machine-learning-project.png 456w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/import-data-python-machine-learning-project-150x54.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/import-data-python-machine-learning-project-300x107.png 300w\" sizes=\"auto, (max-width: 456px) 100vw, 456px\" \/><\/a><\/p>\n<p>2. Now, let\u2019s read the data into a DataFrame and get the first 5 records.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Read the data\r\ndf=pd.read_csv('D:\\\\DataFlair\\\\parkinsons.data')\r\ndf.head()<\/pre>\n<p><strong>Output Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/read-csv-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69898\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/read-csv-python-project.png\" alt=\"interesting python project\" width=\"1259\" height=\"315\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/read-csv-python-project.png 1259w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/read-csv-python-project-150x38.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/read-csv-python-project-300x75.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/read-csv-python-project-768x192.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/read-csv-python-project-1024x256.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/read-csv-python-project-520x130.png 520w\" sizes=\"auto, (max-width: 1259px) 100vw, 1259px\" \/><\/a><\/p>\n<p>3. Get the features and labels from the DataFrame (dataset). The features are all the columns except \u2018status\u2019, and the labels are those in the \u2018status\u2019 column.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Get the features and labels\r\nfeatures=df.loc[:,df.columns!='status'].values[:,1:]\r\nlabels=df.loc[:,'status'].values<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features-and-labels-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69900\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features-and-labels-python-project.png\" alt=\"python data science project\" width=\"436\" height=\"66\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features-and-labels-python-project.png 436w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features-and-labels-python-project-150x23.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-features-and-labels-python-project-300x45.png 300w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/a><\/p>\n<p>4. The \u2018status\u2019 column has values 0 and 1 as labels; let\u2019s get the counts of these labels for both- 0 and 1.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Get the count of each label (0 and 1) in labels\r\nprint(labels[labels==1].shape[0], labels[labels==0].shape[0])<\/pre>\n<p><strong>Output Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-label-counts-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69902\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-label-counts-python-project.png\" alt=\"Python project\" width=\"500\" height=\"79\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-label-counts-python-project.png 500w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-label-counts-python-project-150x24.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/get-label-counts-python-project-300x47.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>We have 147 ones and 48 zeros in the status column in our dataset.<\/p>\n<p>5. Initialize a MinMaxScaler and scale the features to between -1 and 1 to normalize them. The MinMaxScaler transforms features by scaling them to a given range. The fit_transform() method fits to the data and then transforms it. We don\u2019t need to scale the labels.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Scale the features to between -1 and 1\r\nscaler=MinMaxScaler((-1,1))\r\nx=scaler.fit_transform(features)\r\ny=labels<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/scale-features-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69903\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/scale-features-python-project.png\" alt=\"scale features python project\" width=\"434\" height=\"87\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/scale-features-python-project.png 434w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/scale-features-python-project-150x30.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/scale-features-python-project-300x60.png 300w\" sizes=\"auto, (max-width: 434px) 100vw, 434px\" \/><\/a><\/p>\n<p>6. Now, split the dataset into training and testing sets keeping 20% of the data for testing.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Split the dataset\r\nx_train,x_test,y_train,y_test=train_test_split(x, y, test_size=0.2, random_state=7)<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-dataset-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69904\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-dataset-python-project.png\" alt=\"Top Python Project \" width=\"661\" height=\"56\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-dataset-python-project.png 661w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-dataset-python-project-150x13.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-dataset-python-project-300x25.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/split-dataset-python-project-520x44.png 520w\" sizes=\"auto, (max-width: 661px) 100vw, 661px\" \/><\/a><\/p>\n<p>7. Initialize an XGBClassifier and train the model. This classifies using eXtreme Gradient Boosting- using<em><strong><a href=\"https:\/\/data-flair.training\/blogs\/gradient-boosting-algorithm\/\"> gradient boosting algorithms<\/a> <\/strong><\/em>for modern data science problems. It falls under the category of Ensemble Learning in ML, where we train and predict using many models to produce one superior output.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair - Train the model\r\nmodel=XGBClassifier()\r\nmodel.fit(x_train,y_train)<\/pre>\n<p><strong>Output Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-python-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69905\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-python-project.png\" alt=\"Python data science project\" width=\"600\" height=\"200\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-python-project.png 600w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-python-project-150x50.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-python-project-300x100.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/train-model-python-project-520x173.png 520w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>8. Finally, generate y_pred (predicted values for x_test) and calculate the accuracy for the model. Print it out.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># DataFlair - Calculate the accuracy\r\ny_pred=model.predict(x_test)\r\nprint(accuracy_score(y_test, y_pred)*100)<\/pre>\n<p><strong>Output Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/calculate-accuracy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-69906\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/calculate-accuracy.png\" alt=\"Python machine learning project\" width=\"362\" height=\"144\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/calculate-accuracy.png 362w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/calculate-accuracy-150x60.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/calculate-accuracy-300x119.png 300w\" sizes=\"auto, (max-width: 362px) 100vw, 362px\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>Parkinson\u2019s disease is a brain disorder that affects movement and speech. Early detection is very important for treatment. Machine learning can help doctors detect Parkinson\u2019s using voice features. Python and the XGBoost algorithm are great tools for this task. XGBoost is a powerful model known for speed and accuracy. It works well with small and clean datasets like the one used for Parkinson\u2019s detection.<\/p>\n<p>In this Python machine learning project, we learned to detect the presence of Parkinson\u2019s Disease in individuals using various factors. We used an XGBClassifier for this and made use of the sklearn library to prepare the dataset. This gives us an accuracy of 94.87%, which is great considering the number of lines of code in this python project.<\/p>\n<p>Hope you enjoyed this Python project. We have already provided you the links for more interesting Python Projects at the top of the blog.<\/p>\n<p class=\"df-text-bold df-text-red\" style=\"text-align: center\">Want to become next Data Scientist?<\/p>\n<p class=\"df-text-bold\" style=\"text-align: center\">Enroll for <a href=\"https:\/\/techvidvan.com\/ai-data-science-course-multilingual\/\"><strong>Best Data Science<em>\u00a0Online Course<\/em><\/strong><\/a> and be the next Data Scientist<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our list of Python projects, detecting Parkinson&#8217;s disease with python is on the 3rd position. In this Python Machine learning project, we will build a model using which we can accurately detect the\u00a0presence&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":69907,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[21084,21083,21082],"class_list":["post-69884","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-interesting-python-project","tag-python-machine-learning-project","tag-python-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Machine Learning Project - Detecting Parkinson\u2019s Disease with XGBoost - DataFlair<\/title>\n<meta name=\"description\" content=\"Master Python with Python machine learning project, revise the concept of Python and machine learning and kick start your career in data science, AI and ML\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Machine Learning Project - Detecting Parkinson\u2019s Disease with XGBoost - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Master Python with Python machine learning project, revise the concept of Python and machine learning and kick start your career in data science, AI and ML\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-17T08:58:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-29T13:04:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Python-machine-learning-project-.png\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Machine Learning Project - Detecting Parkinson\u2019s Disease with XGBoost - DataFlair","description":"Master Python with Python machine learning project, revise the concept of Python and machine learning and kick start your career in data science, AI and ML","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/","og_locale":"en_US","og_type":"article","og_title":"Python Machine Learning Project - Detecting Parkinson\u2019s Disease with XGBoost - DataFlair","og_description":"Master Python with Python machine learning project, revise the concept of Python and machine learning and kick start your career in data science, AI and ML","og_url":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-09-17T08:58:49+00:00","article_modified_time":"2025-07-29T13:04:49+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Python-machine-learning-project-.png","type":"image\/png"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Python Machine Learning Project &#8211; Detecting Parkinson\u2019s Disease with XGBoost","datePublished":"2019-09-17T08:58:49+00:00","dateModified":"2025-07-29T13:04:49+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/"},"wordCount":840,"commentCount":20,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Python-machine-learning-project-.png","keywords":["interesting Python project","Python machine learning project","Python project"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/","url":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/","name":"Python Machine Learning Project - Detecting Parkinson\u2019s Disease with XGBoost - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Python-machine-learning-project-.png","datePublished":"2019-09-17T08:58:49+00:00","dateModified":"2025-07-29T13:04:49+00:00","description":"Master Python with Python machine learning project, revise the concept of Python and machine learning and kick start your career in data science, AI and ML","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Python-machine-learning-project-.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/09\/Python-machine-learning-project-.png","width":802,"height":420,"caption":"Python machine learning project"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-machine-learning-project-detecting-parkinson-disease\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Machine Learning Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/machine-learning\/"},{"@type":"ListItem","position":3,"name":"Python Machine Learning Project &#8211; Detecting Parkinson\u2019s Disease with XGBoost"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/69884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=69884"}],"version-history":[{"count":17,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/69884\/revisions"}],"predecessor-version":[{"id":146322,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/69884\/revisions\/146322"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/69907"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=69884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=69884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=69884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}