"Boolean" (神经网络解码器)
NetDecoder["Boolean"]
更多信息
- NetDecoder[…][input] 对一个输入应用解码器,产生一个输出.
- NetDecoder[…][{input1,input2,…}] 对一系列输入应用解码器,产生一系列输出.
- 解码器的输入 input 是一个标量,范围为 0≤input≤1.
- NetDecoder[{"Boolean","InputDepth"->n}] 可以用来指定输入数组的深度为 n. 默认深度为 0,表示输入是一个实数.
- 在构建网络时,可通过指定 "port"->NetDecoder[…] 将解码器添加到网络的输出端口上.
- NetDecoder["Boolean"][data,prop] 可用于计算输入数据的指定的属性.
- 当一个 "Boolean" 解码器附加在网络上时,net[data,prop] 或 net[data,"oport"->prop] 可用于计算解码输出的指定的属性.
- "Boolean" 解码器支持以下属性 prop:
-
"Decision" 具有最高概率(默认)的布尔类 False 或 True "Probability" 类 True 的概率 p "Entropy" 概率分布的熵 "RandomSample" 对其概率按比例采样 Boolean "RandomSample"->t 使用正温度 t 采样 None 不解码,直接返回输入
属性
范例
打开所有单元 关闭所有单元基本范例 (1)
dec = NetDecoder["Boolean"]dec[0.2]dec[{0.2, 0.9, 0.5}]解码器期待概率作为输入并充当带有属性 "Probability" 的 Identity:
dec[{0.2, 0.9, 0.5}, "Probability"]dec[{0.2, 0.9, 0.5}, "Entropy"]范围 (2)
在 ElementwiseLayer 的输出端口上添加 "Boolean" 解码器:
layer = ElementwiseLayer[LogisticSigmoid, "Output" -> NetDecoder["Boolean"]]layer[3]创建一个 "Boolean" 解码器,将概率矩阵转换为布尔值矩阵:
decoder = NetDecoder[{"Boolean", "InputDepth" -> 2}]layer = NetInitialize@NetChain[{{3, 3}, LogisticSigmoid}, "Input" -> "Real", "Output" -> decoder]layer[10.0]layer[10.0, "Probability"]layer[10.0, "Entropy"]技术笔记
相关指南
-
▪
- 神经网络