Meu erro produto está com erro nesta linha de comando :
UserSimilarity similarity = new PearsonCorrelationSimilarity(model);
Diz que é para remover o argumento Pearson, Dar um cast ou mudar o tipo de similary para pearson... porém nenhum dos 3 funcionam!
package br.com.alura.recomendador;
import java.io.File; import java.io.IOException; import java.util.List;
import org.apache.mahout.cf.taste.common.TasteException; import org.apache.mahout.cf.taste.impl.model.file.FileDataModel; import org.apache.mahout.cf.taste.impl.neighborhood.ThresholdUserNeighborhood; import org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender; import org.apache.mahout.cf.taste.model.DataModel; import org.apache.mahout.cf.taste.neighborhood.UserNeighborhood; import org.apache.mahout.cf.taste.recommender.RecommendedItem; import org.apache.mahout.cf.taste.recommender.UserBasedRecommender; import org.apache.mahout.cf.taste.similarity.UserSimilarity; import org.apache.mahout.math.hadoop.similarity.cooccurrence.measures.PearsonCorrelationSimilarity;
public class RecomendaProdutos { public static void main(String[] args) throws IOException, TasteException { File file = new File("dados.csv"); DataModel model = new FileDataModel(file);
UserSimilarity similarity = new PearsonCorrelationSimilarity(model);
UserNeighborhood neighborhood = new ThresholdUserNeighborhood(0.1, similarity, model);
UserBasedRecommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity);
List<RecommendedItem> recommendations = recommender.recommend(6, 4);
for (RecommendedItem recommendation : recommendations) {
System.out.println(recommendation);
}
}
}