I'm a beginner at Python I have a deep learning question

Asked 2 years ago, Updated 2 years ago, 45 views

I got a deep learning beginner heart attack Excel dataset and practiced it. But in the case of sex events, M and F are in natural language I think there's an error. So I searched for it in many ways. One hot coding? I think we need to do the same thing I'm asking you a question because it didn't work. What should we do in this case? I need tips from masters

import tensorflow as tf
import os
import pandas as pd
import numpy as np

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

data = pd.read_csv("heart.csv")
data = data.dropna()

ydata = data['HeartDisease'].values
xdata = []

for i, rows in data.iterrows():
    xdata.append([rows['Age'], rows['Sex'], rows['ChestPainType'], rows['RestingBP'], rows['Cholesterol'], rows['FastingBS'],
                  rows['RestingECG'], rows['MaxHR'], rows['ExerciseAngina'], rows['Oldpeak'], rows['ST_Slope']])

xdata = np.array(xdata)
ydata = np.array(ydata)

model = tf.keras.models.Sequential([tf.keras.layers.Dense(64, activation='sigmoid'),
                                    tf.keras.layers.Dense(128, activation='sigmoid'),
                                    tf.keras.layers.Dropout(0.2),
                                    tf.keras.layers.Dense(1, activation='sigmoid')
])

model.compile(optimizer='Adam', loss='binary_crossentropy', metrics=['accuracy'])
model.fit(xdata, ydata, epochs=1)
result = model.evaluate(xdata, ydata, verbose=2)

python deep-learning

2022-09-20 13:12

1 Answers


2022-09-20 13:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.