%% Check Output Layer Validity
% Check the validity of the custom classification output layer weightedClassificationLayer.
% Define a custom weighted classification layer. To create this layer, save the file weightedClassificationLayer.m in the current folder.
% Create an instance of the layer. Specify the class weights as a vector with three elements corresponding to three classes.

classWeights = [0.1 0.7 0.2];
layer = weightedClassificationLayer(classWeights);

% Check that the layer is valid using checkLayer. Set the valid input size to the typical size of a single observation input to the layer. The layer expects a 1-by-1-by-K-by-N array input, where K is the number of classes and N is the number of observations in the mini-batch.

numClasses = numel(classWeights);
validInputSize = [1 1 numClasses];
checkLayer(layer,validInputSize,'ObservationDimension',4);

% The test summary reports the number of passed, failed, incomplete, and skipped tests.
% Copyright 2018 The MathWorks, Inc.