For this, I wrote a class called ResultFileGenerator.java. According to the Kaggle web page, we will have to write the result in the business_ids, labels format. Here, business_id is the ID for the corresponding business, and the label is the multi-label prediction. Let's see how easily we can do that.
First, we aggregate image predictions to business scores for each model. Then, we transform the preceding data structure into a list for each bizID containing a Tuple (bizid, List[Double]) where the Vector[Double] is the vector of probabilities:
public static List<Pair<String, List<Double>>> SubmitObj(FeatureAndDataAligner alignedData, String modelPath, String model0, String model1, String model2, String model3,