Skip to content

Instantly share code, notes, and snippets.

@benjamintanweihao
Created January 27, 2014 07:43
Show Gist options
  • Select an option

  • Save benjamintanweihao/8644521 to your computer and use it in GitHub Desktop.

Select an option

Save benjamintanweihao/8644521 to your computer and use it in GitHub Desktop.
MahoutFile = org.apache.mahout.cf.taste.impl.model.file
model = MahoutFile.FileDataModel.new(java.io.File.new("data.csv"))
MahoutSimilarity = org.apache.mahout.cf.taste.impl.similarity
# similarity = MahoutSimilarity.TanimotoCoefficientSimilarity.new(model)
similarity = MahoutSimilarity.LogLikelihoodSimilarity.new(model)
MahoutNeighborhood = org.apache.mahout.cf.taste.impl.neighborhood
neighborhood = MahoutNeighborhood.NearestNUserNeighborhood.new(2, similarity, model)
MahoutRecommender = org.apache.mahout.cf.taste.impl.recommender
recommender = MahoutRecommender.GenericUserBasedRecommender.new(model, neighborhood, similarity)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment