doushan2311 2011-01-25 10:12
浏览 31
已采纳

最佳算法,用于根据用户的选择选择要呈现给用户的正确数据

i'm working on a project that tries to match the events in a city based on the interests of the user. Basically, the end user in the front end has to select his interests (culture, sports, fun, food...there are 8 of them) with values that range from 0 to 10. In the back end (where all the events are created) the webmaster can choose a score for each category (culture, sports, fun...the same as the front end). What is the best algorithm to use to find the most relevant results based on the user input? I'm using php (although i think this is not a language specific question).

  • 写回答

2条回答 默认 最新

  • dongwei1855 2011-01-25 11:46
    关注

    Compare each of the scores of the events with those from the user profile. The lower the deviation, the better the event matches the user's interest.

    In SQL it could be something like this:

    SELECT ... FROM `events` WHERE ...  
    ORDER BY (
        ABS(`culture` - $culture) 
        + ABS(`sports` - $sports) 
        + ABS(`fun` - $fun) 
        + ...
    ) ASC
    

    You could also weight the scores according to the distribution of points in the user profile. That means if a user has $culture = 10 and all other scores 0, he is particularly interested in culture and you may get better results with

    SELECT ... FROM `events` WHERE ...  
    ORDER BY (
        (ABS(`culture` - $culture) * $cultureImportance)
        + (ABS(`sports` - $sports) * $sportsImportance)
        + (ABS(`fun` - $fun) * $funImportance)
        + ...
    ) ASC
    

    where the importance of each score is the deviation of that score from the mean of all scores of the user.

    You could also add "spice" to the importance values, e.g. to push sport events during the time of superbowl to make your site more zeitgeisty.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?