Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
hands-on-ml-zh
提交
1f64a587
H
hands-on-ml-zh
项目概览
OpenDocCN
/
hands-on-ml-zh
通知
13
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hands-on-ml-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
1f64a587
编写于
11月 29, 2018
作者:
Y
Yu Wang
提交者:
GitHub
11月 29, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
订正 4.训练模型.md 代码中的缩进和括号配对问题
上级
894b406d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
3 addition
and
3 deletion
+3
-3
docs/4.训练模型.md
docs/4.训练模型.md
+3
-3
未找到文件。
docs/4.训练模型.md
浏览文件 @
1f64a587
...
...
@@ -413,8 +413,8 @@ def plot_learning_curves(model, X, y):
y_val_predict
=
model
.
predict
(
X_val
)
train_errors
.
append
(
mean_squared_error
(
y_train_predict
,
y_train
[:
m
]))
val_errors
.
append
(
mean_squared_error
(
y_val_predict
,
y_val
))
plt
.
plot
(
np
.
sqrt
(
train_errors
),
"r-+"
,
linewidth
=
2
,
label
=
"train"
)
plt
.
plot
(
np
.
sqrt
(
val_errors
),
"b-"
,
linewidth
=
3
,
label
=
"val"
)
plt
.
plot
(
np
.
sqrt
(
train_errors
),
"r-+"
,
linewidth
=
2
,
label
=
"train"
)
plt
.
plot
(
np
.
sqrt
(
val_errors
),
"b-"
,
linewidth
=
3
,
label
=
"val"
)
```
我们一起看一下简单线性回归模型的学习曲线(图 4-15):
...
...
@@ -714,7 +714,7 @@ log_reg.fit(X, y)
X_new
=
np
.
linspace
(
0
,
3
,
1000
).
reshape
(
-
1
,
1
)
y_proba
=
log_reg
.
predict_proba
(
X_new
)
plt
.
plot
(
X_new
,
y_proba
[:,
1
],
"g-"
,
label
=
"Iris-Virginica"
)
plt
.
plot
(
X_new
,
y_proba
[:,
0
],
"b--"
,
label
=
"Not Iris-Virginica"
plt
.
plot
(
X_new
,
y_proba
[:,
0
],
"b--"
,
label
=
"Not Iris-Virginica"
)
```
![](
../images/chapter_4/图4-23.PNG
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录