whatsapp

whatsApp

Have any Questions? Enquiry here!
☎ +91-9972364704 LOGIN BLOG
× Home Careers Contact
Back
Python Machine Learning Project – Detecting Parkinson’s Disease with XGBoost
Python Machine Learning Project – Detecting Parkinson’s Disease with XGBoost

Python Machine Learning Project – Detecting Parkinson’s Disease with XGBoost

In our list of Python projects, detecting Parkinson’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 presence of Parkinson’s disease in one’s body.

What is Parkinson’s Disease?

Parkinson’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.

 

What is XGBoost?

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.

 

Detecting Parkinson’s Disease with XGBoost – Objective

To build a model to accurately detect the presence of Parkinson’s disease in an individual.

 

Detecting Parkinson’s Disease with XGBoost – About the Python Machine Learning Project

In this Python machine learning project, using the Python libraries scikit-learn, numpy, pandas, and xgboost, we will build a model using an XGBClassifier. We’ll 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.

dataset download: https://archive.ics.uci.edu/ml/machine-learning-databases/parkinsons/

Steps for Detecting Parkinson’s Disease with XGBoost

Below are some steps required to practice Python Machine Learning Project –

 

1. Make necessary imports:

 

import numpy as np

import pandas as pd

import os, sys

from sklearn.preprocessing import MinMaxScaler

from xgboost import XGBClassifier

from sklearn.model_selection import train_test_split

from sklearn.metrics import accuracy_score

 

2. Now, let’s read the data into a DataFrame and get the first 5 records.

#DataFlair - Read the data

df=pd.read_csv('D:\\DataFlair\\parkinsons.data')

df.head()

 

3. Get the features and labels from the DataFrame (dataset). The features are all the columns except ‘status’, and the labels are those in the ‘status’ column.

 

#DataFlair - Get the features and labels

features=df.loc[:,df.columns!='status'].values[:,1:]

labels=df.loc[:,'status'].values

 

4. The ‘status’ column has values 0 and 1 as labels; let’s get the counts of these labels for both- 0 and 1.

 

#DataFlair - Get the count of each label (0 and 1) in labels

print(labels[labels==1].shape[0], labels[labels==0].shape[0])

 

 

We have 147 ones and 48 zeros in the status column in our dataset.

 

 

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’t need to scale the labels.

 

#DataFlair - Scale the features to between -1 and 1

scaler=MinMaxScaler((-1,1))

x=scaler.fit_transform(features)

y=labels

 

 

6. Now, split the dataset into training and testing sets keeping 20% of the data for testing.

 

#DataFlair - Split the dataset

x_train,x_test,y_train,y_test=train_test_split(x, y, test_size=0.2, random_state=7)

 

 

7. Initialize an XGBClassifier and train the model. This classifies using eXtreme Gradient Boosting- using gradient boosting algorithms 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.

 

#DataFlair - Train the model

model=XGBClassifier()

model.fit(x_train,y_train)

 

 

8. Finally, generate y_pred (predicted values for x_test) and calculate the accuracy for the model. Print it out.

# DataFlair - Calculate the accuracy

y_pred=model.predict(x_test)

print(accuracy_score(y_test, y_pred)*100)

 

Summary

In this Python machine learning project, we learned to detect the presence of Parkinson’s 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.

 

Note : Find the best solution for electronics components and technical projects ideas
keep in touch with our social media links as mentioned below
Mifratech websites : https://www.mifratech.com/public/
Mifratech facebook : https://www.facebook.com/mifratech.lab
mifratech instagram : https://www.instagram.com/mifratech/
mifratech twitter account : https://twitter.com/mifratech

 

latest engineering projects on data science

 

engineering projects on machine learning

latest engineering projects on data science

engineering projects on machine learning

 

best engineering projects on machine learning

best engineering projects on machine learning

best projects on machine learning

best projects in deep learning

best machine learning projects for resume

best machine learning projects for final year

best machine learning projects for beginners

best machine learning projects for portfolio

best machine learning projects for jobs

best machine learning projects github

best projects in machine learning

best machine learning projects with source code

best deep learning projects for resume

best deep learning projects github

best deep learning research projects

best machine learning project ideas

best machine learning projects

best ml projects for resume

top 5 machine learning projects for beginners

top 10 machine learning projects for beginners

best ai projects for beginners

 

best ml projects for final year students

best engineering projects on machine learning

best projects on machine learning

best projects in deep learning

best machine learning projects for resume

best machine learning projects for final year

best machine learning projects for beginners

best machine learning projects for portfolio

best machine learning projects for jobs

best machine learning projects github

best projects in machine learning

best machine learning projects with source code

best deep learning projects for resume

best deep learning projects github

best deep learning research projects

best machine learning project ideas

best machine learning projects

best ml projects for resume

top 5 machine learning projects for beginners

top 10 machine learning projects for beginners

best ai projects for beginners

best ml projects for final year students

best project for machine learning

best ml projects for beginners

best machine learning tutorial for beginners

best machine learning course with projects

best machine learning projects in python

best machine learning projects on github

best machine learning programs online

top 10 machine learning projects for beginners in python

 

easy machine learning projects for beginners

Popular Coures