Lab7 Report - nancyynx88/lab7 GitHub Wiki
Write a TensorFlow program for the following Task.
a.
Implement linear regression for dataset that is not covered
in class (e.g. Boston Dataset -
https://archive.ics.uci.edu/ml/datasets/Housing
).
b.
Plot training cost using Matplotlib in python.
c.
Implement cross-validation (Optional)
In the Wiki Page, include a brief description of your datase
t and your approach/results for this task.
Here's the link to the source code:
https://github.com/nancyynx88/lab7/blob/master/LinearRegression.py
Here's the program result:
In this python based tensorflow program, I learned how to implement the linear regression in it: This is to generate the training data function and to create some noice:
The training dataset is randomly generated:
Linear Regression
trX = np.linspace(-1, 1, 101)
create a y value which is approximately linear but with some random noise
Result for this task:
Training cost= 0.000622037 W= 2.00299 b= 3.99981
Testing... (Mean square loss Comparison) Testing cost= 2.29777e-07 Absolute mean square loss difference: 0.000621807
trY = 2 * trX + 4+np.random.randn(*trX.shape) * 0.033