728x90
반응형

gpascore.csv
0.01MB

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

data = pd.read_csv('gpascore.csv')
data = data.dropna()

y = data['admit'].values
x = []

for i, rows in data.iterrows():
    x.append([rows['gre'], rows['gpa'], rows['rank']])

model = tf.keras.models.Sequential([
    tf.keras.layers.Dense(128, activation='sigmoid'),
    tf.keras.layers.Dense(356, activation='sigmoid'),
    tf.keras.layers.Dense(712, activation='sigmoid'),
    tf.keras.layers.Dense(1, activation='sigmoid')
])

model.compile(optimizer='adam', loss='binary_crossentropy',
              metrics=['accuracy'])

model.fit(np.array(x), np.array(y), epochs=1000)

# predict

predict_v = model.predict([[750, 3.70, 3], [400, 2.2, 1]])
print(predict_v)
728x90
반응형

'Deep Learning' 카테고리의 다른 글

Library_Pandas_2  (0) 2022.09.14
Library_Pandas_1  (0) 2022.09.14
Implementing a Simple Neural Network Structure Using TensorFlow  (0) 2022.09.13
TensorFlow  (0) 2022.09.12
Numpy  (0) 2022.09.12

+ Recent posts