Unverified Commit bc7928f7 authored by Kiryuu Sakuya's avatar Kiryuu Sakuya 🎵
Browse files

Update homework 02

parent 75bcc362
{
"python.pythonPath": "d:\\Python\\tensorflow-homework\\venv\\Scripts\\python.exe"
}
\ No newline at end of file
# 单变量线性回归
## 散点图和目标模型
![图 1](img/1.png)
> 图 1 为随机生成数据的散点图
\ No newline at end of file
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy
import matplotlib.pyplot as pyplot
numpy.random.seed()
# 生成 x_data
x_data = numpy.linspace(0, 100, 500)
# 生成 y_data
y_data = 3.1234 * x_data + 2.98 + numpy.random.randn(*x_data.shape) * 0.9
# 画出散点图
pyplot.scatter(x_data, y_data)
# 画出想要学习的目标函数
pyplot.plot(x_data, 3.1234 * x_data + 2.98, color = "red", linewidth = 1)
# pyplot.show()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment