2020年5月12日 星期二

Machine Learning Foundations : Exercise 1 House Price Question


Exercise 1 : House Prices Question : code lab link
Build a neural network that predicts the price of a house according to a simple formula, house pricing was as easy as a house costs 50k + 50k per bedroom, so that a 1 bedroom house costs 100k, a 2 bedroom house costs 150k etc.

Training data set
Bedroom amount [1, 2, 3, 4,]
House price [100, 150, 200, 250]

Code:
import tensorflow as tf
iport numpy as np
from tensorflow import keras
# Create an 1*1 layer neuron
model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
# Setting optimizer and loss function
model.compile(optimizer='sgd', loss='mean_squared_error')
# Training data
xs = np.array([1, 2, 3, 4], dtype=int)
ys = np.array([100, 150, 200, 250], dtype=int)
# Training mode for 500 iteration
model.fit(xs, ys, epochs=500)
# Predict the output
print(model.predict([7.0]))m
view raw gistfile1.txt hosted with ❤ by GitHub

沒有留言:

張貼留言

Linux driver: How to enable dynamic debug at booting time for built-in driver.

 Dynamic debug is useful for debug driver, and can be enable by: 1. Mount debug fs #>mount -t debugfs none /sys/kernel/debug 2. Enable dy...