<jupyter_start><jupyter_text>Gerekli Kütüphanelerin Yüklenmesi<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.models import Sequential
from keras.layers import Dense,Dropout,BatchNormalization,Activation<jupyter_output><empty_output><jupyter_text>Veri Setinin Yüklenmesi  NOT:Yapay sinir ağları kısmında makine öğrenmesinde veri ön işleme adımları uygulanan veri seti kullanılmıştır.<jupyter_code>veri_seti = pd.read_csv("new_COVID-19_Dataset.csv")
veri_seti.head()
veri_seti.describe()
veri_seti.columns
veri_seti.isnull().sum()<jupyter_output><empty_output><jupyter_text>Özniteliklerin Bağımlı ve Bağımsız Değişkenler Olarak Ayrılması<jupyter_code>X = veri_seti.drop(['COVID-19'],axis=1)
Y = veri_seti['COVID-19']<jupyter_output><empty_output><jupyter_text>Veri Setinin Eğitim ve Test Olarak Bölünmesi<jupyter_code>X_train,X_test,Y_train,Y_test = train_test_split(X,Y,test_size = 0.3,random_state = 42)<jupyter_output><empty_output><jupyter_text>YSA Mimarisinin Oluşturulması<jupyter_code>model=Sequential()


model.add(Dense(128,input_dim=13))
model.add(Activation("relu"))
model.add(BatchNormalization())
model.add(Dense(64))
model.add(Activation("relu"))
model.add(BatchNormalization())
model.add(Dropout(0.4))

model.add(Dense(32))
model.add(Activation("relu"))
model.add(BatchNormalization())
model.add(Dropout(0.3))
model.add(Dense(16))
model.add(Activation("relu"))
model.add(BatchNormalization())

model.add(Dense(128))
model.add(Activation("relu"))
model.add(BatchNormalization())
model.add(Dropout(0.4))
model.add(Dense(64))
model.add(Activation("relu"))
model.add(BatchNormalization())


model.add(Dense(1, activation='sigmoid'))

model.summary()<jupyter_output>Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
dense (Dense)                (None, 128)               1792      
_________________________________________________________________
activation (Activation)      (None, 128)               0         
_________________________________________________________________
batch_normalization (BatchNo (None, 128)               512       
_________________________________________________________________
dense_1 (Dense)              (None, 64)                8256      
_________________________________________________________________
activation_1 (Activation)    (None, 64)                0         
_________________________________________________________________
batch_normalization_1 (Batch (None, 64)                256       
________________________________________________________[...]<jupyter_text>Modelin Derlenmesi<jupyter_code>model.compile(optimizer="adam",
              loss="binary_crossentropy",
             metrics=["acc"])<jupyter_output><empty_output><jupyter_text>Modelin Eğitilmesi<jupyter_code>history=model.fit(X_train,Y_train,
         validation_data=(X_test, Y_test), 
         batch_size=128,
         epochs=100,
         verbose=1,
         shuffle=True)<jupyter_output>Epoch 1/100
30/30 [==============================] - 2s 29ms/step - loss: 0.7386 - acc: 0.5796 - val_loss: 0.5745 - val_acc: 0.8063
Epoch 2/100
30/30 [==============================] - 0s 3ms/step - loss: 0.3908 - acc: 0.8606 - val_loss: 0.5013 - val_acc: 0.8063
Epoch 3/100
30/30 [==============================] - 0s 3ms/step - loss: 0.2107 - acc: 0.9430 - val_loss: 0.4898 - val_acc: 0.8063
Epoch 4/100
30/30 [==============================] - 0s 3ms/step - loss: 0.1553 - acc: 0.9552 - val_loss: 0.5107 - val_acc: 0.8063
Epoch 5/100
30/30 [==============================] - 0s 3ms/step - loss: 0.1328 - acc: 0.9605 - val_loss: 0.5255 - val_acc: 0.8063
Epoch 6/100
30/30 [==============================] - 0s 3ms/step - loss: 0.1032 - acc: 0.9672 - val_loss: 0.5143 - val_acc: 0.8093
Epoch 7/100
30/30 [==============================] - 0s 3ms/step - loss: 0.1156 - acc: 0.9648 - val_loss: 0.4486 - val_acc: 0.8369
Epoch 8/100
30/30 [==============================] - 0s 3ms/step - loss: 0.1013 - [...]<jupyter_text>Sonuçların Grafikle Gösterilmesi<jupyter_code>plt.figure(figsize=(14,3))
plt.subplot(1, 2, 1)
plt.plot(history.history['acc'])
plt.plot(history.history['val_acc'])
plt.title('Model accuracy')
plt.ylabel('Accuracy')
plt.xlabel('Epoch')
plt.legend(['Train', 'Test'], loc='upper left')
plt.subplot(1, 2, 2)
plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])
plt.title('Model loss')
plt.ylabel('Loss')
plt.xlabel('Epoch')
plt.legend(['Train', 'Test'], loc='upper left')
plt.show()<jupyter_output><empty_output><jupyter_text>Model Sınıflandırma Başarımı<jupyter_code>model.evaluate(X_test,Y_test)<jupyter_output>51/51 [==============================] - 0s 500us/step - loss: 0.0358 - acc: 0.9822<jupyter_text>Modele Tahmin Yaptırma<jupyter_code>symptom_list1 = np.array([[1,1,1,0,0,0,0,1,1,1,0,1,1]])
x = np.argmax(model.predict(symptom_list1), axis=-1)
if(x == 1):
  print("POZİTİF : ",x)
else:
  print("NEGATİF : ",x)

symptom_list2  = np.array([[1,0,0,1,1,0,1,0,0,0,0,1,1]])
x = np.argmax(model.predict(symptom_list2), axis=-1)
if(x == 1):
  print("POZİTİF : ",x)
else:
  print("NEGATİF : ",x)<jupyter_output>NEGATİF :  [0]<jupyter_text>Ağırlık Değerlerini ve Model Konfigürasyonunu .h5 formatında saklayalım.<jupyter_code>model.save("model/covid19_model.h5")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19014336917562724, 'fraction_numerical': 0.06577060931899642, 'mean_word_length': 5.4594907407407405, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '507118', 'license': 'MIT', 'n_tokens_mistral': 2305, 'n_tokens_neox': 2020, 'n_words': 314, 'path': 'COVID-19 Disease Prediction/COVID-19_Disease_Prediction_DL.ipynb', 'repo_name': 'alicansoyel/COVID-19_Disease_Prediction', 'size': '5580'}