Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 681757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:31:07+00:00 2026-05-14T01:31:07+00:00

I’m trying to develop a site that recommends items(fx. books) to users based on

  • 0

I’m trying to develop a site that recommends items(fx. books) to users based on their preferences. So far, I’ve read O’Reilly’s “Collective Intelligence” and numerous other online articles. They all, however, seem to deal with single instances of recommendation, for example if you like book A then you might like book B.

What I’m trying to do is to create a set of ‘preference-nodes’ for each user on my site. Let’s say a user likes book A,B and C. Then, when they add book D, I don’t want the system to recommend other books based solely other users experience with book D. I wan’t the system to look up similar ‘preference-nodes’ and recommend books based on that.

Here’s an example of 4 nodes:

User1: 'book A'->'book B'->'book C'
User2: 'book A'->'book B'->'book C'->'book D'
user3: 'book X'->'book Y'->'book C'->'book Z'
user4: 'book W'->'book Q'->'book C'->'book Z'

So a recommendation system, as described in the material I’ve read, would recommend book Z to User 1, because there are two people who recommends Z in conjuction with liking C (ie. Z weighs more than D), even though a user with a similar ‘preference-node’, User2, would be more qualified to recommend book D because he has a more similar interest-pattern.

So do any of you have any experience with this sort of thing? Is there some things I should try to read or does there exist any open source systems for this?

Thanks for your time!

Small edit: I think last.fm’s algorithm is doing exactly what I my system to do. Using the preference-trees of people to recommmend music more personally to people. Instead of just saying “you might like B because you liked A”

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:31:08+00:00Added an answer on May 14, 2026 at 1:31 am

    Create a table and insert the test data:

    CREATE TABLE `ub` (
      `user_id` int(11) NOT NULL,
      `book_id` varchar(10) NOT NULL,
      PRIMARY KEY (`user_id`,`book_id`),
      UNIQUE KEY `book_id` (`book_id`,`user_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    
    insert into ub values (1, 'A'), (1, 'B'), (1, 'C');
    insert into ub values (2, 'A'), (2, 'B'), (2, 'C'), (2,'D');
    insert into ub values (3, 'X'), (3, 'Y'), (3, 'C'), (3,'Z');
    insert into ub values (4, 'W'), (4, 'Q'), (4, 'C'), (4,'Z');
    

    Join the test data onto itself by book_id, and create a temporary table to hold each user_id and the number of books it has in common with the target user_id:

    create temporary table ub_rank as 
    select similar.user_id,count(*) rank
    from ub target 
    join ub similar on target.book_id= similar.book_id and target.user_id != similar.user_id
    where target.user_id = 1
    group by similar.user_id;
    
    select * from ub_rank;
    +---------+------+
    | user_id | rank |
    +---------+------+
    |       2 |    3 |
    |       3 |    1 |
    |       4 |    1 |
    +---------+------+
    3 rows in set (0.00 sec)
    

    We can see that user_id has 3 in common with user_id 1, but user_id 3 and user_id 4 only have 1 each.

    Next, select all the books that the users in the temporary table have that do not match the target user_id’s books, and arrange these by rank. Note that the same book might appear in different user’s lists, so we sum the rankings for each book so that common books get a higher ranking.

    select similar.book_id, sum(ub_rank.rank) total_rank
    from ub_rank
    join ub similar on ub_rank.user_id = similar.user_id 
    left join ub target on target.user_id = 1 and target.book_id = similar.book_id
    where target.book_id is null
    group by similar.book_id
    order by total_rank desc;
    
    +---------+------------+
    | book_id | total_rank |
    +---------+------------+
    | D       |          3 |
    | Z       |          2 |
    | X       |          1 |
    | Y       |          1 |
    | Q       |          1 |
    | W       |          1 |
    +---------+------------+
    6 rows in set (0.00 sec)
    

    Book Z appeared in two user lists, and so was ranked above X,Y,Q,W which only appeared in one user’s list. Book D did best because it appeared in user_id 2’s list, which had 3 items in common with target user_id 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.