We need to perform image classification using logistic regression (SOFTMAX), resulting in probabilities of occurrence for each of the image labels. Logistic regression is a predictive analysis algorithm and, hence, more suitable for prediction problems. In this recipe, we will design output layers for the image classification problem.
Constructing output layers for output classification
How to do it...
- Design the output layer using OutputLayer:
builder.layer(new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD)
.nOut(numLabels)
.activation(Activation.SOFTMAX)
.build());
- Set the input type using setInputType():
builder.setInputType(InputType.convolutional(30,30,3));