Skip to Main Content
机器学习设计模式
book

机器学习设计模式

by Valliappa Lakshmanan, Sara Robinson, Michael Munn
September 2022
Beginner to intermediate content levelBeginner to intermediate
386 pages
7h 36m
Chinese
Southeast University Press
Content preview from 机器学习设计模式
106
3
我们用
Keras
函数式
API
将各个部分组合在一起得到了集成模型:
member_inputs = [model.input for model in members]
#
拼接合并各模型的输出
member_outputs = [model.output for model in members]
merge = layers.concatenate(member_outputs)
hidden = layers.Dense(10, activation='relu')(merge)
ensemble_output = layers.Dense(1, activation='relu')(hidden) ensemble_model =
Model(inputs=member_inputs, outputs=ensemble_output)
#
绘制集成模型的图
tf.keras.utils.plot_model(ensemble_model, show_shapes=True,
to_file='ensemble_graph.png')
#
编译
ensemble_model.compile(loss='mse', optimizer='adam', metrics=['mse'])
在这个例子中,次级模型是一个有两个隐藏层的密集神经网络。通过训练,该网络
学习如何在进行预测时最好地结合集成成员的结果。
为什么有效
bagging
这样的模型平均方法之所以有效,是因为集成模型中的每个成员通常不会 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PyTorch深度学习

PyTorch深度学习

Posts & Telecom Press, Vishnu Subramanian
数据科学原理

数据科学原理

Posts & Telecom Press, Sinan Ozdemir
Rust程序设计

Rust程序设计

Jim Blandy, Jason Orendorff, Leonora F. S. Tindall

Publisher Resources

ISBN: 9787564196776