Change tensorflow import - Zadanie 6.2 training

This commit is contained in:
Zofia Galla 2021-05-15 14:53:10 +02:00
parent bc74513edc
commit 73fbe01114

View File

@ -1,8 +1,7 @@
import tensorflow as tf
import sys import sys
from tf.keras import layers from tensorflow.keras import layers
# from keras.layers import Flatten,Dense,Dropout, GlobalAveragePooling2D # from keras.layers import Flatten,Dense,Dropout, GlobalAveragePooling2D
from tf.keras.optimizers import Adam from tensorflow.keras.optimizers import Adam
import numpy as np import numpy as np
import pandas as pd import pandas as pd
from sklearn.metrics import mean_squared_error from sklearn.metrics import mean_squared_error
@ -15,7 +14,7 @@ x_train.pop('Unnamed: 0')
learning_rate = 0.001 #sys.argv[1] learning_rate = 0.001 #sys.argv[1]
model = tf.keras.Sequential() model = tensorflow.keras.Sequential()
model.add(layers.Input(shape=(22,))) model.add(layers.Input(shape=(22,)))
model.add(layers.Dense(64)) model.add(layers.Dense(64))
model.add(layers.Dense(64)) model.add(layers.Dense(64))
@ -25,7 +24,7 @@ model.add(layers.Dense(1))
model.compile(loss='mean_absolute_error', optimizer=Adam(learning_rate)) model.compile(loss='mean_absolute_error', optimizer=Adam(learning_rate))
model.fit( model.fit(
x = tf.convert_to_tensor(x_train, np.float32), x = tensorflow.convert_to_tensor(x_train, np.float32),
y = y_train, y = y_train,
verbose=0, epochs=99) verbose=0, epochs=99)