How can I create and train a neural network with a scalar Boolean output for binary classification, and hopefully have it automatically compute the "ErrorRate"
property (described here) during training?
Here is an attempt that resulted in errors:
(* create training data *)
rmf = RegionMember[Disk[]];
pts = RandomReal[{-1, 1}, {1000, 2}];
data = Thread[pts -> rmf[pts]];
(* construct net *)
net = NetChain[{100, Ramp, 1}, "Input" -> 2, "Output" -> NetDecoder["Boolean"]]
(* attempt training *)
NetTrain[net, data]
This results in:
First::nofirst: {} has zero length and no first element.
NetTrain::encgenfail1: Could not encode input number 459 for port "Output": input was not a sequence of length 1. Please check the example.
I am not experienced with neutral networks. I am generally confused about how to specify that the output of a net is even a scalar (not a vector). In the example above, this does not seem to be the problem as changing the training data to use size-1 Boolean vectors instead of Boolean scalars does not fix the error.