recommendation-go

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2025 License: MIT

README

Recommendation Algorithm in Go

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.

paypal
paypal

Getting started

Starting with Go modules:

  1. Install Go (tested with 1.20+)
  2. Download package:
go get github.com/tigoCaval/recommendation-go

Introduction

Recommend products using collaborative filtering:

Example

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]
Algorithms
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]
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 archive License

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL