Skip to Content
机器学习流水线实战
book

机器学习流水线实战

by Hannes Hapke, Catherine Nelson
November 2021
Intermediate to advanced
302 pages
8h 57m
Chinese
Posts & Telecom Press
Content preview from 机器学习流水线实战
242
14
TFE
可用于为这种情况训练加密模型。
照常使用
pip
进行安装:
$ pip install tf_encrypted
建立
TFE
模型的第一步是定义一个可以批量生成训练数据的类。这个类由数据拥有者在本
地实现。可以使用装饰器将其转换为加密数据:
@tfe.local_computation
TFE
中编写模型训练代码几乎与常规
Keras
模型相同,只需将
tf
替换为
tfe
import tf_encrypted as tfe
model = tfe.keras.Sequential()
model.add(tfe.keras.layers.Dense(1, batch_input_shape=[batch_size, num_features]))
model.add(tfe.keras.layers.Activation('sigmoid'))
唯一的区别是必须将参数
batch_input_shape
提供给
Dense
的第一层。
TFE
档提供了此示例。在撰写本书时,
TFE
并未包含常规
Keras
的所有功能,因此无法
以这种格式展示示例项目。
14.5.2
 将训练好的模型转换为加密的预测服务
使用
TFE
的第二种情况是,你希望提供经过加密处理的纯文本数据模型。如图
14-5
所示,
在这种情况下,你可以完全访问未加密的训练数据,但是你希望应用的用户能够收到私有
预测结果。这为上传了加密数据并接收加密预测的用户提供了隐私保证。
受信任 不受信任
数据拥有者 训练数据仓库 训练好的模型 预测
14-5 ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

大数据项目管理:从规划到实现

大数据项目管理:从规划到实现

Ted Malaska, Jonathan Seidman
可编程网络自动化

可编程网络自动化

Jason Edelman, Scott S. Lowe, Matt Oswalt
C++语言导学(原书第2版)

C++语言导学(原书第2版)

本贾尼 斯特劳斯特鲁普

Publisher Resources

ISBN: 9787115573216