C1W1 Assignment: Housing Prices
C1W1 Assignment: Housing Prices#
https-deeplearning-ai/tensorflow-1-public/C1/W1/assignment/C1W1_Assignment.ipynb
Commit
f16e408
on May 3, 2022, Compare
base cost 50k
50k each bedroom
1 bedroom 100k
scale 100,000 to 1
import tensorflow as tf
import numpy as np
def house_model():
xs = np.arange(1, 7)
ys = 0.5 * xs + 0.5
model = tf.keras.Sequential([
tf.keras.layers.Dense(1, input_shape=(1,))])
model.compile(optimizer='sgd', loss='mse')
model.fit(xs, ys, epochs=1000)
return model
model = house_model()
new_y = 7.0
prediction = model.predict([new_y])[0]
print(prediction)
1/1 [==============================] - 0s 92ms/step
[4.008728]