Package org.apache.mahout.cf.taste.similarity.precompute

Examples of org.apache.mahout.cf.taste.similarity.precompute.BatchItemSimilarities


    }

    DataModel dataModel = new GroupLensDataModel(new File(args[0]));
    ItemBasedRecommender recommender = new GenericItemBasedRecommender(dataModel,
        new LogLikelihoodSimilarity(dataModel));
    BatchItemSimilarities batch = new MultithreadedBatchItemSimilarities(recommender, 5);

    int numSimilarities = batch.computeItemSimilarities(Runtime.getRuntime().availableProcessors(), 1,
        new FileSimilarItemsWriter(resultFile));

    System.out.println("Computed " + numSimilarities + " similarities for " + dataModel.getNumItems() + " items "
        + "and saved them to " + resultFile.getAbsolutePath());
  }
View Full Code Here


    }

    DataModel dataModel = new GroupLensDataModel(new File(args[0]));
    ItemBasedRecommender recommender = new GenericItemBasedRecommender(dataModel,
        new LogLikelihoodSimilarity(dataModel));
    BatchItemSimilarities batch = new MultithreadedBatchItemSimilarities(recommender, 5);

    int numSimilarities = batch.computeItemSimilarities(Runtime.getRuntime().availableProcessors(), 1,
        new FileSimilarItemsWriter(resultFile));

    System.out.println("Computed " + numSimilarities + " similarities for " + dataModel.getNumItems() + " items "
        + "and saved them to " + resultFile.getAbsolutePath());
  }
View Full Code Here

    DataModel dataModel = new GenericDataModel(userData);
    ItemBasedRecommender recommender =
        new GenericItemBasedRecommender(dataModel, new TanimotoCoefficientSimilarity(dataModel));

    BatchItemSimilarities batchSimilarities = new MultithreadedBatchItemSimilarities(recommender, 10);

    batchSimilarities.computeItemSimilarities(1, 1, mock(SimilarItemsWriter.class));
  }
View Full Code Here

    DataModel dataModel = new GenericDataModel(userData);
    ItemBasedRecommender recommender =
        new GenericItemBasedRecommender(dataModel, new TanimotoCoefficientSimilarity(dataModel));

    BatchItemSimilarities batchSimilarities = new MultithreadedBatchItemSimilarities(recommender, 10);

    try {
      // Batch size is 100, so we only get 1 batch from 3 items, but we use a degreeOfParallelism of 2
      batchSimilarities.computeItemSimilarities(2, 1, mock(SimilarItemsWriter.class));
      fail();
    } catch (IOException e) {}
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.similarity.precompute.BatchItemSimilarities

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.