List of usage examples for org.apache.mahout.common HadoopUtil openStream
public static InputStream openStream(Path path, Configuration conf) throws IOException
From source file:hadoop.api.AggregateAndRecommendReducer.java
License:Apache License
@Override protected void setup(Context context) throws IOException { Configuration conf = context.getConfiguration(); recommendationsPerUser = conf.getInt(NUM_RECOMMENDATIONS, DEFAULT_NUM_RECOMMENDATIONS); booleanData = conf.getBoolean(RecommenderJob.BOOLEAN_DATA, false); indexItemIDMap = TasteHadoopUtils.readIDIndexMap(conf.get(ITEMID_INDEX_PATH), conf); String itemFilePathString = conf.get(ITEMS_FILE); if (itemFilePathString != null) { itemsToRecommendFor = new FastIDSet(); for (String line : new FileLineIterable(HadoopUtil.openStream(new Path(itemFilePathString), conf))) { try { itemsToRecommendFor.add(Long.parseLong(line)); } catch (NumberFormatException nfe) { log.warn("itemsFile line ignored: {}", line); }/* ww w . j a v a 2 s. c o m*/ } } }
From source file:org.gpfvic.mahout.cf.taste.hadoop.item.IDReader.java
License:Apache License
private InputStream openFile(String pathString) throws IOException { return HadoopUtil.openStream(new Path(pathString), conf); }