Update 'ium_zadanie6_training.py'

This commit is contained in:
Zofia Galla 2021-05-15 15:17:07 +02:00
parent 516e90125b
commit 2e39677b03

View File

@ -1,7 +1,8 @@
import sys import sys
from tensorflow.keras import layers from tensorflow.keras import layers, Sequential
# from keras.layers import Flatten,Dense,Dropout, GlobalAveragePooling2D # from keras.layers import Flatten,Dense,Dropout, GlobalAveragePooling2D
from tensorflow.keras.optimizers import Adam from tensorflow.keras.optimizers import Adam
from tensorflow import convert_to_tensor
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
@ -14,7 +15,7 @@ x_train.pop('Unnamed: 0')
learning_rate = 0.001 #sys.argv[1] learning_rate = 0.001 #sys.argv[1]
model = tensorflow.keras.Sequential() model = 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))
@ -24,7 +25,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 = tensorflow.convert_to_tensor(x_train, np.float32), x = convert_to_tensor(x_train, np.float32),
y = y_train, y = y_train,
verbose=0, epochs=99) verbose=0, epochs=99)