I really like the idea of a module providing an API for recommendations due to the wide range of use cases. There is also a diversity in algorithms and algorithmic implementations. The current API of recommender module does not incorporate this second circumstance.
At the moment i am developing a drupal module for recommendations with a specific algorithm, a promising hybrid of collaborative filtering and content filtering based on drupals taxonomy. Mahouts algorithms do not cover this algorithm obviously. Also I don't want to obligate users to use mahout for processing (it's a lot of additional infrastructure for a typical drupal user) so I implemented the algorithms in PHP.

With this issue I vote for the API to be extended to algorithmic modules. There should be a possibility to extend the params argument with custom values for algorithm and there should be a parameter specifying the module doing the actual processing. The current algorithms and their processing implementatins could remain one option.

Comments

danithaca’s picture

Version: 7.x-4.0-alpha6 » 7.x-4.x-dev

Thanks davidn.

1. I like the idea of isolating algorithm implementations and the interface. I'll see whether the current code supports that.
2. It is a good suggestion to combine both collaborative filter and content based algorithm. I plan to create a patch in Mahout and make it available to Recommender API.

davidn’s picture

I am looking forward to it.

danithaca’s picture

Status: Needs work » Fixed

Ok. I've got an answer.

The current architecture does support different algorithm implementation. The key is to override the RunRecommender java class for different algorithm implementation. Then you can reuse a lot of code in RunRecommender/AsyncCommand and write your own content-based algorithms. You need to use a different command name than RunRecommender so that the launching program in AsyncCommand can locate your class.

I'm not sure if I explain this clearly?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

davidn’s picture

Status: Closed (fixed) » Needs work

Hi danithaca.

Thanks for your reply. I had something different in mind. There should be a drupal-level logic to support other recommender modules. I don't want to use java and I think there are many usecases where you would stick with php.
The best way for your module would be to provide a hook for other modules to register themselfs as algorithmic modules. If you want, I can develope this with you or on my own.

We are releasing a project with our custom recommender module and if it is working nearly as great as I expect it to work I will share it with the drupal community. And I would love to use the recommender API.

danithaca’s picture

@davidn: Currently the RecommenderAPI supports "register themselfs as algorithmic modules". You can use recommender_app_register() to create a new recommender application with your customized parameters. However, this approach only works when you change parameters to existing recommender algorithms (item-item user-user, SVD, etc). It doesn't work for new algorithms (content-based, ensemble, etc.). To add new algorithms, you have to write Java code, because Mahout is in Java. I don't think it's a good idea to write new recommender algorithms in PHP, because soon you'll hit performance bottleneck. That's why I completely re-wrote RecommenderAPI from PHP to Java last summer.

I'm not quite sure what idea you have on mind. If you write some sample code, I'll have a better understanding. If you provide a patch, I'll be happy to review it, and perhaps check it into the code repository.

danithaca’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

Release 7.x-4.x is not supported anymore. Please consider upgrade to 7.x-6.x and re-open the issue if needed.