Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kiryuu Sakuya
TensorFlow-Homework
Commits
bc7928f7
Unverified
Commit
bc7928f7
authored
Feb 27, 2020
by
Kiryuu Sakuya
🎵
Browse files
Update homework 02
parent
75bcc362
Changes
4
Hide whitespace changes
Inline
Side-by-side
.vscode/settings.json
0 → 100644
View file @
bc7928f7
{
"python.pythonPath"
:
"d:
\\
Python
\\
tensorflow-homework
\\
venv
\\
Scripts
\\
python.exe"
}
\ No newline at end of file
02. linear-regression-with-one-variable/docs/README.md
0 → 100644
View file @
bc7928f7
# 单变量线性回归
## 散点图和目标模型

> 图 1 为随机生成数据的散点图
\ No newline at end of file
02. linear-regression-with-one-variable/docs/img/1.png
0 → 100644
View file @
bc7928f7
21 KB
02. linear-regression-with-one-variable/main.py
0 → 100644
View file @
bc7928f7
# -*- 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment