[tensorflow2.0](入门)简单记录

f(x) = ax + b
import tensorflow as tf
import pandas as pd

data = pd.read_csv(r’…xxx.csv’)

x = data.Education
y = data.Income

model = tf.keras.Sequential()
model.add(tf.keras.layers.Dense(1, input_shape=([1,])))

model.summary()
model.compile(optimizer = ‘adam’, loss=‘mse’)
history = model.fit(x, y, epochs=100)

model.predict(x) # 对x的预测
model.predict(pd.Series([20])

你可能感兴趣的:([tensorflow2.0](入门)简单记录)