Mahout插件,用于轨道上的红宝石

编程入门 行业动态 更新时间:2024-10-23 03:19:59
本文介绍了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:

  • 建议相关标签.
  • 建议相关文章.
  • 根据用户的偏好提示他查看文章.
  • 根据地理位置以及用户的其他元信息,向他推荐相似的用户.
  • 我愿意使用任何其他解决方案(除了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:

    需要"ruby​​gems" 需要'java'

    require 'rubygems' require 'java'

    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:

    include_class'org.apache.hadoop.fs.Path' include_class'org.apache.hadoop.conf.Configuration' include_class'org.apache.hadoop.fs.FileSystem' include_class'org.apache.mahout.clustering.spectralmon.AffinityMatrixInputJob' include_class'org.apache.mahout.clustering.spectral.kmeans.SpectralKMeansDriver'

    include_class 'org.apache.hadoop.fs.Path' include_class 'org.apache.hadoop.conf.Configuration' include_class 'org.apache.hadoop.fs.FileSystem' include_class 'org.apache.mahout.clustering.spectralmon.AffinityMatrixInputJob' include_class 'org.apache.mahout.clustering.spectral.kmeans.SpectralKMeansDriver'

    从那里,您可以遵循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插件,用于轨道上的红宝石

    本文发布于:2023-10-27 11:31:01,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1533227.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:红宝石   轨道   插件   Mahout

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!