The scoring approach that we're going to use is pretty simple. It assigns business-level labels by averaging the image-level predictions. I know I did it naively, but you can try a better approach. What I have done is assign a business with label 0 if the average of the probabilities across all of its images that it belongs to class 0 is greater than 0.5:
def scoreModel(model: MultiLayerNetwork, ds: INDArray) = { model.output(ds)}
Then we collect the model predictions from the scoreModel() method and merge with alignedData:
def aggImgScores2Business(scores: INDArray, alignedData: featureAndDataAligner ) = { assert(scores.size(0) == alignedData.data.length, "alignedData and scores length are different. They must be equal") ...