本文介绍了Mahout插件,用于轨道上的红宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Ruby on Rails项目中使用Apache Mahout来实现建议和协作过滤.特别是我的要求是:

I want to use Apache Mahout in my project on Ruby on Rails for implementing recommendations and collaborative filtering. In Particular my requirements are:

  1. 建议相关标签.
  2. 建议相关文章.
  3. 根据用户的偏好提示他查看文章.
  4. 根据地理位置以及用户的其他元信息,向他推荐相似的用户.

我愿意使用任何其他解决方案(除了mahout之外)都可以轻松地与滑轨集成并满足我的要求.

I am open to using any other solution (other than mahout) if it integrates with rails easily and fulfills my requirements.

推荐答案

Mahout(和Hadoop)在JRuby上运行的Rails中运行良好.您可以像这样包含Hadoop和Mahout jar:

Mahout (and Hadoop) work pretty well within Rails running on JRuby. You can include Hadoop and Mahout jars like so:

Dir ["/mahout-base-dir/**/*.jar"].each {| jar |需要罐子}
Dir ["/hadoop-base-dir/**/*.jar"].each {| jar |需要jar}

Dir["/mahout-base-dir/**/*.jar"].each { |jar| require jar }
Dir["/hadoop-base-dir/**/*.jar"].each { |jar| require jar }

然后,您可以包括计划使用的Mahout类,例如:

Then you can include the Mahout classes you plan on using, for instance:

从那里,您可以遵循Mahout Java Docs和JRuby约定来构建Rails rec系统.

From there, you can follow the Mahout Java Docs and JRuby conventions to build your Rails rec system.

话虽这么说,但我不确定这将是您网站的最佳架构(很难说,没有更多细节).如果您的问题规模足够大,足以使Mahout满意,那么将Rails仅用于Web东西,并在Web框架之外生成您的建议(例如,通过每晚批量生成关联性等)可能更有意义.

That being said, I'm not sure that would be the best architecture for your site (hard to say without more detail). If your problem scale is large enough to warrant Mahout, it probably makes more sense to use Rails for just the web stuff, and generate your recommendations outside the web framework (for instance by generating affinities in nightly batches, etc.).

这篇关于Mahout插件,用于轨道上的红宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 00:58