ium_z444439/train.py
2023-05-11 18:27:25 +02:00

24 lines
581 B
Python

import pandas as pd
import tensorflow
from keras.applications.densenet import layers
train_data_x = pd.read_csv('./X_train.csv')
adults_train = train_data_x.copy()
adults_predict = train_data_x.pop('age')
normalize = layers.Normalization()
normalize.adapt(adults_train)
adult_model = tensorflow.keras.Sequential([
normalize,
layers.Dense(64),
layers.Dense(1)
])
adult_model.compile(
loss=tensorflow.keras.losses.MeanSquaredError(),
optimizer=tensorflow.keras.optimizers.Adam())
adult_model.fit(adults_train, adults_predict, epochs=500)
adult_model.save('model')