آموزش زبان پایتون (تشخیص بیماری پارکینسون PD)

به آموزش زبان پایتون (تشخیص بیماری پارکینسون) خوش اومدید.

در این بخش می خوایم یک برنامه با استفاده از هوش مصنوعی بنویسیم که می تواند در پیش بینی بیماری پارکینسون به کار برده شود:

مرحله اول:نصب افزونه ها:

import pandas as pd
import numpy as np
from xgboost import XGBClassifier
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
import seaborn as sns

مرحله دوم: آپلود دیتای اولیه بیمار:

#load the data
from google.colab import files
uploaded = files.upload()
parkinsons.data(n/a) - 40697 bytes, last modified: n/a - 100% done

مرحله سوم: تبدیل دیتای اولیه به دیتا فریم:

#load the data into a data frame
df = pd.read_csv('parkinsons.data')
df.head()

مرحله چهارم: دانلود و فراخوانی مقاله یا متن ربات:

#get the artcile
article = Article('https://www.mayoclinic.org/diseases-conditions/chronic-kidney-disease/symptoms-causes/syc-20354521')
article.download()
article.parse()
article.nlp()
corpus = article.text

مرحله پنجم: بررسی دیتا برای دیتاهای از دست رفته:

#Check this data for missing values
df.isnull().values.any()

مرحله ششم: استخراج تعداد سطرها و ستونهای دیتا:

df.shape

مرحله هفتم: دریافت تعداد وضعیت ها در دادگان:

#Get the target count
df['status'].value_counts()

مرحله هشتم: تابع پرینت

percent_has_disease = 147 / (147 + 48) * 100
percent_dont_have_disease = 48 / (147 + 48) * 100
print('If I guess the individual did not have Parkinsons disease,
 I would be correct ', percent_dont_have_disease, '% of the time.')
print('If I guess the individual have Parkinsons disease, I would be correct ',
 percent_has_disease, '% of the time.')

مرحله نهم: نمایش تابع وضعیت

dir="ltr">#Visualize the count
dir="ltr">sns.countplot(df['status'])

مرحله دهم: استخراج تعداد نوع دیتا

#Get the data types
df.dtypes

مرحله یازدهم: ایجاد توابع ویژگی

#Create the feature data set
X = df.drop(['name'],1)
X = np.array(X.drop(['status'],1))
#Create the target data set
y = np.array(df['status'])

مرحله دوازدهم: تقسیم دیتا به ۸۰ درصد آموزش و ۲۰ درصد تست

#Split the data into 80% trading and 20% testing data sets
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

مرحله سیزدهم: تبدیل دیتا به بازه عددی صفر و یک

#Transform the feature data to be values between 0 and 1
sc = MinMaxScaler(feature_range=(0,1))
x_train = sc.fit_transform(x_train)
x_test = sc.transform(x_test)

مرحله چهاردهم: ایجاد تابع کلاس بندی XGBClassifier برای کلاس بندی دیتا

#Create the XGBClassifier
model = XGBClassifier().fit(x_train, y_train)

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

قبلا حساب کاربری ایجاد کرده اید؟
گذرواژه خود را فراموش کرده اید؟
Loading...