Go implementation of the weighted slope one rating-based collaborative filtering scheme.
go get github.com/mhdcodes/slopeone-gothis library is designed to be very simple and straightforward to use. All you have to do is to load rating data, then predict future ratings based on the training set provided.
import slopeone "github.com/mhdcodes/slopeone-go"
algorithm := slopeone.New()Adding Rating values can be easily done by providing a slice of user ratings via the Update() method:
data := []map[string]float64{
{"squid": 1, "cuttlefish": 0.5, "octopus": 0.2},
{"squid": 1, "octopus": 0.5, "nautilus": 0.2},
{"squid": 0.2, "octopus": 1, "cuttlefish": 0.4, "nautilus": 0.4},
{"cuttlefish": 0.9, "octopus": 0.4, "nautilus": 0.5},
}
algorithm.Update(data)To predict ratings for a new user, call the Predict method:
results := algorithm.Predict(map[string]float64{
"squid": 0.4,
})This produces the following results:
map[string]float64{
"cuttlefish": 0.25,
"octopus": 0.23333333333333,
"nautilus": 0.1,
}go test -v- Go - The programming language used
Please see the changelog for more information on what has changed recently.
Please see CONTRIBUTING.md for details and a todo list.
If you discover any security related issues, please email author instead of using the issue tracker.
We use SemVer for versioning. For the versions available, see the tags on this repository.
Please see the Licence for more information.