Collaborative filtering recommendation system in Go:
- Ranking algorithm using likes/dislikes or numeric ratings.
- This package can be used in any Go project or module.
- 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.
Starting with Go modules:
- Install Go (tested with 1.20+)
- Download package:
go get github.com/tigoCaval/recommendation-go
Recommend products using collaborative filtering:
Simple demonstration of collaborative filtering:
table := []recommendation.Transaction{
{ProductID: "A", Score: 1, UserID: "John"},
{ProductID: "B", Score: 1, UserID: "John"},
{ProductID: "A", Score: 1, UserID: "Mary"},
{ProductID: "B", Score: 0, UserID: "Mary"},
{ProductID: "C", Score: 1, UserID: "Mary"},
}
client := recommendation.NewRecommend()
fmt.Println(client.Ranking(table,"John",0)) // map[C:1]
fmt.Println(client.Euclidean(table,"John,0")) // map[C:1]
fmt.Println(client.SlopeOne(table,"John",0)) // map[C:1.5]
Algorithm | Description | Output Example |
---|---|---|
Ranking | Simple count-based ranking. Recommends items with the highest score (likes/dislikes). | map[C:1] |
Euclidean | Distance-based similarity. Finds the most similar users and recommends unseen items. | map[C:1] |
SlopeOne | Predictive algorithm. Uses differences between item ratings to estimate unknown preferences. | map[C:1.5] |
If you are interested in supporting this project, you can help in many ways. Leave a star ⭐ or make a donation of any value.
- []
MIT license. See the archive License