Package io.prediction.examples.java.recommendations.tutorial1

Examples of io.prediction.examples.java.recommendations.tutorial1.Query


  }

  public static void runComponents(String filePath) {
    JavaEngineParams engineParams = new JavaEngineParamsBuilder()
      .dataSourceParams(new DataSourceParams(filePath))
      .addAlgorithmParams("MyRecommendationAlgo", new AlgoParams(0.2)) // Add Algorithm Params
      .build();

    JavaWorkflow.runEngine(
      (new HalfBakedEngineFactory()).apply(),
      engineParams,
View Full Code Here


public class Runner3 {

  public static void runEvaluation(String filePath) {
    JavaEngineParams engineParams = new JavaEngineParamsBuilder()
      .dataSourceParams(new DataSourceParams(filePath))
      .addAlgorithmParams("MyRecommendationAlgo", new AlgoParams(0.2))
      .build();

    JavaWorkflow.runEngine(
      (new EngineFactory()).apply(),
      engineParams,
View Full Code Here

public class Runner5 {

  public static void runEvaluation(String filePath) {
    JavaEngineParams engineParams = new JavaEngineParamsBuilder()
      .dataSourceParams(new DataSourceParams(filePath))
      .addAlgorithmParams("MyMahoutRecommendationAlgo",
        new MahoutAlgoParams("LogLikelihoodSimilarity"))
      .build();

    JavaWorkflow.runEngine(
View Full Code Here

    }
  }

  public static void runComponents(String filePath) {
    JavaEngineParams engineParams = new JavaEngineParamsBuilder()
      .dataSourceParams(new DataSourceParams(filePath))
      .build();

    JavaWorkflow.runEngine(
      (new HalfBakedEngineFactory()).apply(),
      engineParams,
View Full Code Here

    }
  }

  public static void runComponents(String filePath) {
    JavaEngineParams engineParams = new JavaEngineParamsBuilder()
      .dataSourceParams(new DataSourceParams(filePath))
      .addAlgorithmParams("MyRecommendationAlgo", new AlgoParams(0.2)) // Add Algorithm Params
      .build();

    JavaWorkflow.runEngine(
      (new HalfBakedEngineFactory()).apply(),
View Full Code Here

public class Runner3 {

  public static void runEvaluation(String filePath) {
    JavaEngineParams engineParams = new JavaEngineParamsBuilder()
      .dataSourceParams(new DataSourceParams(filePath))
      .addAlgorithmParams("MyRecommendationAlgo", new AlgoParams(0.2))
      .build();

    JavaWorkflow.runEngine(
      (new EngineFactory()).apply(),
View Full Code Here

  private List<Tuple2<Query, Float>> prepareValidation(List<TrainingData.Rating> testRatings) {
    List<Tuple2<Query, Float>> validationList = new ArrayList<Tuple2<Query, Float>>();

    for (TrainingData.Rating r : testRatings) {
      validationList.add(new Tuple2<Query, Float>(
        new Query(r.uid, r.iid),
        r.rating));
    }

    return validationList;
  }
View Full Code Here

      // create a new ArrayList because subList() returns view and not serialzable
      List<TrainingData.Rating> trainingRatings =
        new ArrayList<TrainingData.Rating>(ratings.subList(0, trainingEndIndex));
      List<TrainingData.Rating> testRatings = ratings.subList(trainingEndIndex, testEndIndex);
      TrainingData td = new TrainingData(trainingRatings);
      List<Tuple2<Query, Float>> qaList = prepareValidation(testRatings);

      data.add(new Tuple3<Object, TrainingData, Iterable<Tuple2<Query, Float>>>(
        null, td, qaList));
    }
View Full Code Here

        ParameterizedType returnType = (ParameterizedType) t;
        final Type[] h = returnType.getActualTypeArguments();
        assert(h.length == 1);
        assert(h[0] instanceof Class);
        Class c = (Class) h[0];
        Query q = handle.createQuery(s.value()).map(c);
        if (args != null) bindArguments(method.isAnnotationPresent(BindBy.class) ?
                                        method.getAnnotation(BindBy.class).value() :
                                        BindType.Position, q, args);
        return f.doit(q);
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    private Object handleInstance(Select s, Method method, Object[] args)
    {
        Query q = handle.createQuery(s.value()).map(method.getReturnType());
        if (args != null) bindArguments(method.isAnnotationPresent(BindBy.class) ?
                                        method.getAnnotation(BindBy.class).value() :
                                        BindType.Position, q, args);
        if (args != null) bindArguments(method.isAnnotationPresent(BindBy.class) ?
                                        method.getAnnotation(BindBy.class).value() :
                                        BindType.Position, q, args);
        q.setMaxRows(1);
        return q.first();
    }
View Full Code Here

TOP

Related Classes of io.prediction.examples.java.recommendations.tutorial1.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.