From db7a59f689138fad1c96ba20d8570d62cab789dd Mon Sep 17 00:00:00 2001 From: jakubknczny Date: Sat, 15 May 2021 19:01:47 +0200 Subject: [PATCH] import tensorflow --- lab5/train/train.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lab5/train/train.py b/lab5/train/train.py index 270f635..9f24cbb 100644 --- a/lab5/train/train.py +++ b/lab5/train/train.py @@ -1,7 +1,7 @@ import numpy as np import pandas as pd import sys -import tensorflow as tf +import tensorflow from tensorflow.keras import layers X_train = pd.read_csv('train.csv') @@ -17,7 +17,7 @@ Y_test = pd.get_dummies(Y_test) Y_valid = X_valid.pop('stabf') Y_valid = pd.get_dummies(Y_valid) -model = tf.keras.Sequential([ +model = tensorflow.keras.Sequential([ layers.Input(shape=(12,)), layers.Dense(32), layers.Dense(16), @@ -25,12 +25,12 @@ model = tf.keras.Sequential([ ]) model.compile( - loss=tf.keras.losses.BinaryCrossentropy(), - optimizer=tf.keras.optimizers.Adam(lr=float(sys.argv[1])), - metrics=[tf.keras.metrics.BinaryAccuracy()]) + loss=tensorflow.keras.losses.BinaryCrossentropy(), + optimizer=tensorflow.keras.optimizers.Adam(lr=float(sys.argv[1])), + metrics=[tensorflow.keras.metrics.BinaryAccuracy()]) -history = model.fit(tf.convert_to_tensor(X_train, np.float32), +history = model.fit(tensorflow.convert_to_tensor(X_train, np.float32), Y_train, epochs=2, validation_data=(X_valid, Y_valid)) model.save('grid-stability-dense.h5')