Skip to main content
. 2024 Nov 20;13(22):3697. doi: 10.3390/foods13223697
Algorithm 3 Collaborative filtering-based personalized recommendation algorithm
  • Require: 

    User historical behavior; Results of the food public opinion prediction model

  • Ensure: 

    Personalized recommendation list

  •  1.

    Calculate the similarity matrix between user u and other users based on the historical ratings of all users for different news items.

  •  2.

    Select the user vi most similar to user u, and based on the most similar user’s preference for the target news, predict and calculate the specific rating value of user u for the target news item.

  •  3.

    Calculate the early warning index ϵ for all news items based on the sentiment prediction model, and compute the final user recommendation matrix.

  •  4.

    Recommend news based on the rating values from highest to lowest.