You can create your custom class with your similarity implementation. All
you need is that class to implement the UserSimilarity interface and use it
here
UserSimilarity similarity = new PearsonCorrelationSimilarity(dm);

instead of the PearsonCorrelationSimilarity.

UserSimilarity similarity = new CustomUserSimilarity(dm); //
CustomUserSimilarity
implements UserSimilarity

If the implementation of that CustomUserSimilarity is in C, you may want to
look into JNI (Java Native Interface) to call C code from Java.

Best,
Juanjo.

On Wed, Feb 11, 2015 at 9:48 AM, Eugenio Tacchini <
eugenio.tacch...@gmail.com> wrote:

> Hello Pat and thanks for your reply,
> I know that when users >> items normally item-based works better and I
> don't assume my similarity metric works better but I have, for research
> purposes, to compare:
>
> - RMSE produced by a pearson correlation user-based algorithm VS
> - RMSE produced by a user-based algorithm where similarities are computed
> in a completely different and not standard way (algorithm implemented in C)
>
> so I am looking for a way to assign manually the user similarities; the
> test will be performed just on a couple of datasets so it's fine if I have
> to hard-code the assignment.
>
> Eugenio
>
>
> 2015-02-10 23:58 GMT+01:00 Pat Ferrel <p...@occamsmachete.com>:
>
> > There are many algorithms in Mahout but not all are equal. Some
> > combinations never perform well even though they are described in Mahout
> in
> > Action. The combination below is probably not the best.
> >
> > You seem to assume your user similarity metric is better than Mahout’s?
> Do
> > you have more users or items?
> >
> > If I were you I'd try user or item based recs in Mahout using LLR
> > similarity. It’s always performed best when I’ve compared. I say this
> > because I know of no way to do what you ask without writing some code and
> > partly because I bet it will outperform.
> >
> > Also be aware that the only good way to compare completely different
> > recommenders is A/B user testing.
> >
> > On Feb 10, 2015, at 3:39 AM, Eugenio Tacchini <
> eugenio.tacch...@gmail.com>
> > wrote:
> >
> > Hi all,
> > I am new to mahout but I work with recommender systems, I have just tried
> > to implement a simple user-based recommender:
> >
> > DataModel dm = new FileDataModel(new File("data/ratings.dat"));
> >
> > UserSimilarity similarity = new PearsonCorrelationSimilarity(dm);
> >
> > UserNeighborhood neighborhood = new
> > ThresholdUserNeighborhood(0.1,similarity, dm);
> >
> > UserBasedRecommender r = new GenericUserBasedRecommender(dm,
> neighborhood,
> > similarity);
> >
> > I would like to compare the results of this recommender with another I
> > implemented using another technology. The only differences between the
> two
> > algorithms is the way I choose neighbors; since I am not very fluent in
> > Java, instead of implementing the second algorithm in mahout, I would
> like
> > to manually specify the neighbors for each user, is this possible? Which
> is
> > the easiest way to provide an alternative user-user similarity matrix
> > (computed using my algorithm)?
> >
> > Just to recap: I want to use GenericUserBasedRecommender but providing an
> > alternative users similarity matrix, without reimplementing my similarity
> > algorithm in Java. Basically if I could import the similarities from a
> text
> > file it would be great, but other methods are fine as well.
> >
> > Thanks a lot in advance.
> >
> > Eugenio Tacchini
> >
> >
>

Reply via email to