Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Collaborative filtering recommendation system. Recommendation algorithm using collaborative filtering. Topics: Ranking algorithm, euclidean distance algorithm, slope one algorithm, filtragem colaborativa.

License

NotificationsYou must be signed in to change notification settings

tigoCaval/recommendation-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collaborative filtering recommendation system

  • Ranking algorithm using likes / dislikes or star-based rating
  • This package can be used in any PHP application or with any framework.
  • Download package:composer require tigo/recommendation
  • MIT license.Feel free to use this project.Leave a star ⭐ or make a fork !

If you found this project useful, consider making a donation to support the developer.

paypal|paypal

Getting started

Starting with composer

  1. Install composer
  2. Download package:composer require tigo/recommendation
  3. PHP >= 7.0; Versions that have been tested: 7.2.25, 7.3.23 e 8.0.1.
//Somewhere in your project, you may need to use autoloadinclude__DIR__ ."/vendor/autoload.php";

Algorithms

  • ranking
  • euclidean
  • slope one

Introduction

Recommend a product using collaborative filtering

/**     $table gets the array from the database.     $user is the foreign key that represents the user who will receive the recommendation.   **/useTigo\Recommendation\Recommend;// import class$client =newRecommend();$client->ranking($table,$user);//optional third parameter refers to the score not accepted$client->euclidean($table,$user);//optional third parameter refers to the minimum accepted score$client->slopeOne($table,$user);//optional third parameter refers to the minimum accepted score

Configuration

Sometimes, it may be necessary to rename the value of the constants (According to your database table).

example

  • Configure: standard key (Directory:./src/configuration/StandardKey.php)
constSCORE ='score';//scoreconstPRODUCT_ID ='product_id';//Foreign keyconstUSER_ID ='user_id';//Foreign key

Example

A simple didactic demonstration of the algorithm

/**     Example using "rating: liked and disliked"     like: score = 1;  dislike: score = 0  **/$table = [        ['product_id'=>'A','score'=>1,'user_id'=>'Pedro'        ],        ['product_id'=>'B','score'=>1,'user_id'=>'Pedro'        ],        ['product_id'=>'A','score'=>1,'user_id'=>'João'        ],        ['product_id'=>'B','score'=>1,'user_id'=>'João'        ],        ['product_id'=>'C','score'=>1,'user_id'=>'João'        ]  ];useTigo\Recommendation\Recommend;// import class$client =newRecommend();print_r($client->ranking($table,"Pedro"));// result = ['C' => 2]print_r($client->ranking($table,"Pedro",1));// result = [];print_r($client->euclidean($table,"Pedro"));// result = ['C' => 1]print_r($client->euclidean($table,"Pedro",2));// result = [] ;print_r($client->slopeOne($table,'Pedro'));// result = ['C' => 1]print_r($client->slopeOne($table,'Pedro',2));// result = []

Supporting this project

If you are interested in supporting this project, you can help in many ways. Leave a star ⭐ or make a donation of any value.

Sponsor supporting this project

  • []

Contributors

License

MIT license. See the archiveLicense


About

Collaborative filtering recommendation system. Recommendation algorithm using collaborative filtering. Topics: Ranking algorithm, euclidean distance algorithm, slope one algorithm, filtragem colaborativa.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp