Package net.myrrix.common

Examples of net.myrrix.common.MyrrixRecommender


    configureRescorerProvider(context, bucket, instanceID);
   
    ReloadingReference<List<List<HostAndPort>>> allPartitionsReference =
        configureAllPartitionsReference(context, bucket, instanceID);
   
    MyrrixRecommender recommender =
        new ServerRecommender(bucket, instanceID, localInputDir, partition, allPartitionsReference);
    context.setAttribute(AbstractMyrrixServlet.RECOMMENDER_KEY, recommender);
   
    configureClientThread(context, bucket, instanceID, recommender);
View Full Code Here


    if (pathComponents.hasNext()) {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Path too long");
      return;
    }

    MyrrixRecommender recommender = getRecommender();
    RescorerProvider rescorerProvider = getRescorerProvider();
    try {
      IDRescorer rescorer = rescorerProvider == null ? null :
          rescorerProvider.getRecommendRescorer(new long[] {userID}, recommender, getRescorerParams(request));
      Iterable<RecommendedItem> recommended =
          recommender.recommend(userID, getHowMany(request), getConsiderKnownItems(request), rescorer);
      output(request, response, recommended);
    } catch (NoSuchUserException nsue) {
      response.sendError(HttpServletResponse.SC_NOT_FOUND, nsue.toString());
    } catch (NotReadyException nre) {
      response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, nre.toString());
View Full Code Here

*/
public final class MostPopularItemsServlet extends AbstractMyrrixServlet {

  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    MyrrixRecommender recommender = getRecommender();
    RescorerProvider rescorerProvider = getRescorerProvider();
    try {
      IDRescorer rescorer = rescorerProvider == null ? null :
          rescorerProvider.getMostPopularItemsRescorer(recommender, getRescorerParams(request));
      output(request, response, recommender.mostPopularItems(getHowMany(request), rescorer));
    } catch (NotReadyException nre) {
      response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, nre.toString());
    } catch (TasteException te) {
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, te.toString());
      getServletContext().log("Unexpected error in " + getClass().getSimpleName(), te);
View Full Code Here

      return;
    }

    long[] userIDs = userIDSet.toArray();

    MyrrixRecommender recommender = getRecommender();
    RescorerProvider rescorerProvider = getRescorerProvider();
    try {
      IDRescorer rescorer = rescorerProvider == null ? null :
          rescorerProvider.getRecommendRescorer(userIDs, recommender, getRescorerParams(request));
      Iterable<RecommendedItem> recommended =
          recommender.recommendToMany(userIDs, getHowMany(request), getConsiderKnownItems(request), rescorer);
      output(request, response, recommended);
    } catch (NoSuchUserException nsue) {
      response.sendError(HttpServletResponse.SC_NOT_FOUND, nsue.toString());
    } catch (NotReadyException nre) {
      response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, nre.toString());
View Full Code Here

    } catch (IllegalArgumentException ignored) {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad value");
      return;
    }

    MyrrixRecommender recommender = getRecommender();
    try {
      recommender.setPreference(userID, itemID, prefValue);
    } catch (TasteException te) {
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, te.toString());
      getServletContext().log("Unexpected error in " + getClass().getSimpleName(), te);
    }
  }
View Full Code Here

    } catch (NumberFormatException nfe) {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST, nfe.toString());
      return;
    }

    MyrrixRecommender recommender = getRecommender();
    try {
      recommender.removePreference(userID, itemID);
    } catch (TasteException te) {
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, te.toString());
      getServletContext().log("Unexpected error in " + getClass().getSimpleName(), te);
    }
  }
View Full Code Here

    if (pathComponents.hasNext()) {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Path too long");
      return;
    }

    MyrrixRecommender recommender = getRecommender();
    try {

      if ("count".equals(countOrN)) {
        int count = isUser() ? recommender.getNumUserClusters() : recommender.getNumItemClusters();
        response.getWriter().println(count);
      } else {
        int n;
        try {
          n = Integer.parseInt(countOrN);
        } catch (NumberFormatException nfe) {
          response.sendError(HttpServletResponse.SC_BAD_REQUEST, nfe.toString());
          return;
        }
        try {
          FastIDSet ids = isUser() ? recommender.getUserCluster(n) : recommender.getItemCluster(n);
          outputIDs(request, response, ids);
        } catch (IndexOutOfBoundsException ioobe) {
          response.sendError(HttpServletResponse.SC_BAD_REQUEST, ioobe.toString());
        }
      }
View Full Code Here

    long[] itemIDs = new long[itemIDsList.size()];
    for (int i = 0; i < itemIDs.length; i++) {
      itemIDs[i] = itemIDsList.get(i);
    }

    MyrrixRecommender recommender = getRecommender();
    try {
      float[] similarities = recommender.similarityToItem(toItemID, itemIDs);
      Writer out = response.getWriter();
      for (float similarity : similarities) {
        out.write(Float.toString(similarity));
        out.write('\n');       
      }
View Full Code Here

    } catch (IllegalArgumentException ignored) {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad value");
      return;
    }

    MyrrixRecommender recommender = getRecommender();
    try {
      recommender.setUserTag(userID, userTag, tagValue);
    } catch (TasteException te) {
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, te.toString());
      getServletContext().log("Unexpected error in " + getClass().getSimpleName(), te);
    }
  }
View Full Code Here

    }

    long[] itemIDs = itemIDsAndValue.getFirst();
    float[] values = itemIDsAndValue.getSecond();
   
    MyrrixRecommender recommender = getRecommender();
    try {
      float estimate = recommender.estimateForAnonymous(toItemID, itemIDs, values);
      Writer out = response.getWriter();
      out.write(Float.toString(estimate));
      out.write('\n');
    } catch (NotReadyException nre) {
      response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, nre.toString());
View Full Code Here

TOP

Related Classes of net.myrrix.common.MyrrixRecommender

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.