Package net.myrrix.common

Examples of net.myrrix.common.OneWayMigrator


    modelFile = new File(inputDir, "model.bin.gz");
    appendFile = new File(inputDir, "append.bin.gz");

    recentlyActiveUsers = new FastIDSet();
    recentlyActiveItems = new FastIDSet();
    hasher = new OneWayMigrator();
   
    loader = new GenerationLoader(recentlyActiveUsers, recentlyActiveItems, this);

    countdownToRebuild = WRITES_BETWEEN_REBUILD;
    refreshExecutor = Executors.newSingleThreadExecutor(
View Full Code Here


      log.info("No input files in {}", inputDir);
      return;
    }
    Arrays.sort(inputFiles, ByLastModifiedComparator.INSTANCE);

    IDMigrator hash = new OneWayMigrator();

    int lines = 0;
    int badLines = 0;
    for (File inputFile : inputFiles) {
      log.info("Reading {}", inputFile);
      for (String line : new FileLineIterable(inputFile)) {
       
        if (badLines > 100) { // Crude check
          throw new IOException("Too many bad lines; aborting");
        }
       
        lines++;
       
        if (line.isEmpty() || line.charAt(0) == '#') {
          continue;
        }
       
        Iterator<String> it = COMMA.split(line).iterator();

        long userID;
        boolean userIsTag;
        long itemID;
        boolean itemIsTag;
        float value;
        try {
         
          String userIDString = it.next();
          userIsTag = userIDString.startsWith("\"");
          if (userIsTag) {
            userID = hash.toLongID(userIDString.substring(1, userIDString.length() - 1));
          } else {
            userID = Long.parseLong(userIDString);
          }
         
          String itemIDString = it.next();
          itemIsTag = itemIDString.startsWith("\"");
          if (itemIsTag) {
            itemID = hash.toLongID(itemIDString.substring(1, itemIDString.length() - 1));
          } else {
            itemID = Long.parseLong(itemIDString);           
          }
         
          if (it.hasNext()) {
View Full Code Here

        return Executors.newFixedThreadPool(
            2 * numCores,
            new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ServerRecommender-%d").build());
      }
    });
    tagHasher = new OneWayMigrator();
  }
View Full Code Here

  /**
   * @param delegate underlying {@link ClientRecommender} to use with translation
   */
  public TranslatingClientRecommender(ClientRecommender delegate) {
    this(delegate, new OneWayMigrator(), new MemoryIDMigrator());
  }
View Full Code Here

    String translateFileName = cliArgs.getTranslateItem();
    boolean translateItem = translateFileName != null;

    TranslatingRecommender translatingRecommender = null;
    if (translateUser || translateItem) {
      IDMigrator userTranslator = translateUser ? new OneWayMigrator() : null;
      MemoryIDMigrator itemTranslator = translateItem ? new MemoryIDMigrator() : null;
      translatingRecommender = new TranslatingClientRecommender(recommender, userTranslator, itemTranslator);
      if (translateFileName != null && !"oneWay".equals(translateFileName)) {
        File translateFile = new File(translateFileName);
        translatingRecommender.addItemIDs(translateFile);
View Full Code Here

TOP

Related Classes of net.myrrix.common.OneWayMigrator

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.