## org.apache.mahout.cf.taste.similarity.precompute
Class BatchItemSimilarities

    java.lang.Object
      org.apache.mahout.cf.taste.similarity.precompute.BatchItemSimilarities

Direct Known Subclasses:
  MultithreadedBatchItemSimilarities

    public abstract class BatchItemSimilarities

extends Object

Constructor Summary
`protected` `BatchItemSimilarities(ItemBasedRecommender recommender, int similarItemsPerItem)`

Method Summary
`abstract int` `computeItemSimilarities(int degreeOfParallelism, int maxDurationInHours, SimilarItemsWriter writer)`
`protected ItemBasedRecommender` `getRecommender()`
`protected int` `getSimilarItemsPerItem()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BatchItemSimilarities

    protected BatchItemSimilarities(ItemBasedRecommender recommender,
                                    int similarItemsPerItem)

Parameters:
  `recommender` - recommender to use
  `similarItemsPerItem` - number of similar items to compute per item

Method Detail

### getRecommender

    protected ItemBasedRecommender getRecommender()

### getSimilarItemsPerItem

    protected int getSimilarItemsPerItem()

### computeItemSimilarities

    public abstract int computeItemSimilarities(int degreeOfParallelism,
                                                int maxDurationInHours,
                                                SimilarItemsWriter writer)
                                         throws IOException

  Parameters:
    `degreeOfParallelism` - number of threads to use for the computation
    `maxDurationInHours` - maximum duration of the computation
    `writer` - `SimilarItemsWriter` used to persist the results
  Returns:
    the number of similarities precomputed
  Throws:
    `IOException`
    `RuntimeException` - if the computation takes longer than maxDurationInHours

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.