Question: Problem 1 . Boston house data . CRIM, RM , LSTAT, AGE . ( 5 0 ) ( 1 ) , . Google drive hw
Problem Boston house data
CRIM, RM LSTAT, AGE
Google drive
hwbostonhouse.ipynb
Cost function graph
Scikit learn Linear regression library
# HW House price prediction using linear regression
# import library
import tensorflow as tf
import numpy as np
import pandas as pd
from sklearn.modelselection import traintestsplit
# X Y
boston pdreadcsvBostonhouse.csv
X bostonCRIMRM 'LSTAT', 'AGE'
y bostonTarget
Xtrain, Xtest, ytrain, ytest traintestsplitX y testsize randomstate
Xtrain nparrayXtrain, dtypenpfloat
Xtest nparrayXtest, dtypenpfloat
ytrain nparrayytrain, dtypenpfloat
ytest nparrayytest, dtypenpfloat
# Model parameter
#
# learning rate
# learning rate
learningrate
# Gradient descent
def gradientDescent:
with tfGradientTape as tape:
# Gradient descent
cost
for step in range:
gradientDescent
pred tfmatmulXtest,W b
costinst tfreducemeantfsquarepred ytest
cost npappendcost costinst
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
