package io.prediction.engines.java.itemrec;

import io.prediction.engines.java.itemrec.data.Query;
import io.prediction.engines.java.itemrec.data.Actual;
import io.prediction.engines.java.itemrec.data.Prediction;
import io.prediction.engines.java.itemrec.data.TrainingData;
import io.prediction.engines.java.itemrec.data.PreparedData;
import io.prediction.engines.java.itemrec.algos.GenericItemBased;
import io.prediction.engines.java.itemrec.algos.GenericItemBasedParams;
import io.prediction.engines.java.itemrec.algos.SVDPlusPlus;
import io.prediction.engines.java.itemrec.algos.SVDPlusPlusParams;
import io.prediction.controller.java.JavaParams;
import io.prediction.controller.java.EmptyParams;
import io.prediction.controller.java.LJavaAlgorithm;
import io.prediction.controller.java.JavaEngine;
import io.prediction.controller.java.JavaEngineBuilder;
import io.prediction.controller.java.JavaEngineParams;
import io.prediction.controller.java.JavaEngineParamsBuilder;
import io.prediction.controller.java.JavaWorkflow;
import io.prediction.controller.java.WorkflowParamsBuilder;

import io.prediction.controller.Params;

import scala.Tuple2;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;

public class Runner {
  public static void main(String[] args) {

    String filePath = "src/main/java/itemrec/examples/ratings.csv";
    String algoName = "genericitembased";

    if (args.length == 2) {
      filePath = args[0];
      algoName = args[1];
    }

    System.out.println(Arrays.toString(args));
    int k = 20;
    DataSourceParams dsp = new DataSourceParams(filePath, 1, 0.8f, 0.2f, 0, 3, k);
    EmptyParams pp = new EmptyParams();
    GenericItemBasedParams genericItemBasedParams = new GenericItemBasedParams(10);
    SVDPlusPlusParams svdPlusPlusParams = new SVDPlusPlusParams(10);
    ServingParams sp = new ServingParams();

    String algo;
    //JavaParams algoParams;
    Params algoParams;
    if (algoName.equals("genericitembased")) {
      algo = "genericitembased";
      algoParams = genericItemBasedParams;
    } else {
      algo = "svdplusplus";
      algoParams = svdPlusPlusParams;
    }

    JavaEngineParams engineParams = new JavaEngineParamsBuilder()
      .dataSourceParams(dsp)
      .preparatorParams(pp)
      .addAlgorithmParams(algo, algoParams)
      .servingParams(sp)
      .build();

    JavaWorkflow.runEngine(
      (new EngineFactory()).apply(),
      engineParams,
      ItemRecMetrics.class,
      new MetricsParams(k),
      new WorkflowParamsBuilder().batch("Java Itemrec engine").verbose(3).build()
      );
  }

}

@@ -635,32 +635,34 @@
 ava.JavaParams;%0A
+//
 import io.predic
@@ -1082,16 +1082,62 @@
 ilder;%0A%0A
+import io.prediction.controller.EmptyParams;%0A%0A
 import i
@@ -1922,16 +1922,18 @@
 0);%0A    
+//
 ServingP
@@ -1963,16 +1963,56 @@
 arams();
+%0A    EmptyParams sp = new EmptyParams();
 %0A%0A    St

Fix typos.