"Boolean" (Net Decoder)
[Experimental]
NetDecoder["Boolean"]
represents a decoder that converts a probability p to False if p<0.5, and True otherwise.
Details

- NetDecoder[…][input] applies the decoder to an input to produce an output.
- NetDecoder[…][{input1,input2,…}] applies the decoder to a list of inputs to produce a list of outputs.
- The input to the decoder input is a scalar in the range 0≤input≤1.
- NetDecoder[{"Boolean","InputDepth"->n}] can be used to specify that the input array has depth n. The default depth is 0, indicating that the input is a single real number.
- A decoder can be attached to an output port of a net by specifying "port"->NetDecoder[…] when constructing the net.
- NetDecoder["Boolean"][data,prop] can be used to calculate a specific property for the input data.
- When a "Boolean" decoder is attached to a net, net[data,prop] or net[data,"oport"->prop] can be used to calculate a specific property of the decoded output.
- The "Boolean" decoder supports the following properties prop:
-
"Decision" the Boolean class False or True with the highest probability (default) "Probability" the probability p of class True "Entropy" the entropy of the probability distribution "RandomSample" sample a Boolean proportionally to its probability "RandomSample"->t sample using a positive temperature t None bypass decoding and return the input
Properties
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
In[1]:=1

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-gfwb36
Out[1]=1

Decode a probability as either True or False:
In[2]:=2

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-q05whz
Out[2]=2

The decoder maps over a batch of examples:
In[3]:=3

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-fi4lo8
Out[3]=3

The decoder expects probabilities as inputs and acts as Identity with the property "Probability":
In[4]:=4

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-80d8u
Out[4]=4

In[5]:=5

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-j5yqv6
Out[5]=5

Scope (2)Survey of the scope of standard use cases
Attach a "Boolean" decoder to the output port of an ElementwiseLayer:
In[1]:=1

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-i5qidn
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-w0vpfh
Out[2]=2

Create a "Boolean" decoder that converts a matrix of probabilities into a matrix of Boolean values:
In[1]:=1

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-y14pic
Out[1]=1

Attach the decoder to a net and apply it to an input:
In[2]:=2

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-m4sj7j
Out[2]=2

In[3]:=3

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-hoxqlm
Out[3]=3

Obtain the probability of the positive class:
In[4]:=4

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-fj8t2q
Out[4]=4

Compute the entropy of each Bernoulli distribution:
In[5]:=5

✖
https://wolfram.com/xid/0nrs25q30lp6bm7xqkihhyq-9b7dda
Out[5]=5
