Examples of FileLineIterable


Examples of org.apache.mahout.common.FileLineIterable

   
    Map<String, List<String>> byUserEntryCache = new FastMap<String, List<String>>(100000);
   
    for (File byItemFile : byItemDirectory.listFiles()) {
      log.info("Processing {}", byItemFile);
      Iterator<String> lineIterator = new FileLineIterable(byItemFile, false).iterator();
      String line = lineIterator.next();
      String movieIDString = line.substring(0, line.length() - 1);
      while (lineIterator.hasNext()) {
        line = lineIterator.next();
        int firstComma = line.indexOf(',');
View Full Code Here

Examples of org.apache.mahout.common.FileLineIterable

    FastByIDMap<Collection<Preference>> userIDPrefMap = new FastByIDMap<Collection<Preference>>();
   
    int counter = 0;
    FilenameFilter filenameFilter = new MovieFilenameFilter();
    for (File movieFile : new File(dataDirectory, "training_set").listFiles(filenameFilter)) {
      Iterator<String> lineIterator = new FileLineIterable(movieFile, false).iterator();
      String line = lineIterator.next();
      long movieID = Long.parseLong(line.substring(0, line.length() - 1)); // strip colon
      while (lineIterator.hasNext()) {
        line = lineIterator.next();
        if (++counter % 100000 == 0) {
View Full Code Here

Examples of org.apache.mahout.common.FileLineIterable

    if (dfs.exists(outPath)) {
      dfs.delete(outPath, true);
    }
   
    Set<String> categories = new HashSet<String>();
    for (String line : new FileLineIterable(new File(catFile))) {
      categories.add(line.trim().toLowerCase());
    }
   
    DefaultStringifier<Set<String>> setStringifier = new DefaultStringifier<Set<String>>(conf, GenericsUtil
        .getClass(categories));
View Full Code Here

Examples of org.apache.mahout.common.FileLineIterable

      dfs.delete(outPath, true);
    }
   
    Set<String> categories = new HashSet<String>();
    if (catFile.length() > 0) {
      for (String line : new FileLineIterable(new File(catFile))) {
        categories.add(line.trim().toLowerCase());
      }
    }
   
    DefaultStringifier<Set<String>> setStringifier = new DefaultStringifier<Set<String>>(conf, GenericsUtil
View Full Code Here

Examples of org.apache.mahout.common.FileLineIterable

   * @throws IOException
   *             if there is an error
   */
  public static List<VectorWritable> readFile(String fileName) throws IOException {
    List<VectorWritable> results = new ArrayList<VectorWritable>();
    for (String line : new FileLineIterable(new File(fileName))) {
      results.add(new VectorWritable(AbstractVector.decodeVector(line)));
    }
    return results;
  }
View Full Code Here

Examples of org.apache.mahout.common.FileLineIterable

        current.listFiles(new PrefixAdditionFilter(prefix + File.separator + current.getName(), writer,
            charset));
      } else {
        try {
          StringBuilder file = new StringBuilder();
          for (String aFit : new FileLineIterable(current, charset, false)) {
            file.append(aFit).append('\n');
          }
          writer.write(prefix + File.separator + current.getName(), file.toString());
         
        } catch (FileNotFoundException e) {
View Full Code Here

Examples of org.apache.mahout.common.FileLineIterable

        usersToRecommendFor = null;
      } else {
        usersToRecommendFor = new FastIDSet();
        Path usersFilePath = new Path(usersFilePathString).makeQualified(fs);
        FSDataInputStream in = fs.open(usersFilePath);
        for (String line : new FileLineIterable(in)) {
          usersToRecommendFor.add(Long.parseLong(line));
        }
      }
    } catch (IOException ioe) {
      throw new IllegalStateException(ioe);
View Full Code Here

Examples of org.apache.mahout.common.FileLineIterable

   * @throws IOException
   *             if there is an error
   */
  public static List<VectorWritable> readFile(String fileName) throws IOException {
    List<VectorWritable> results = new ArrayList<VectorWritable>();
    for (String line : new FileLineIterable(new File(fileName))) {
      results.add(new VectorWritable(AbstractVector.decodeVector(line)));
    }
    return results;
  }
View Full Code Here

Examples of org.apache.mahout.common.FileLineIterable

        usersToRecommendFor = null;
      } else {
        usersToRecommendFor = new FastIDSet();
        Path usersFilePath = new Path(usersFilePathString).makeQualified(fs);
        FSDataInputStream in = fs.open(usersFilePath);
        for (String line : new FileLineIterable(in)) {
          usersToRecommendFor.add(Long.parseLong(line));
        }
      }
    } catch (IOException ioe) {
      throw new IllegalStateException(ioe);
View Full Code Here

Examples of org.apache.mahout.common.FileLineIterable

   
    FPGrowth<String> fp = new FPGrowth<String>();
    Set<String> features = new HashSet<String>();
   
    fp.generateTopKFrequentPatterns(
        new StringRecordIterator(new FileLineIterable(new File(input), encoding, false), pattern),
        fp.generateFList(
            new StringRecordIterator(new FileLineIterable(new File(input), encoding, false), pattern),
            minSupport),
        minSupport,
        maxHeapSize,
        features,
        new StringOutputConverter(new SequenceFileOutputCollector<Text,TopKStringPatterns>(writer)),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.