Documentation ¶
Overview ¶
User-item recommendation using nearest-neighrbor collaborative filtering in Go
Index ¶
- func CosineSim(a, b []float64) float64
- func DotProduct(a, b []float64) (float64, error)
- func GetBinaryRecommendations(prefs *DenseMatrix, user int, products []string) ([]string, []float64, error)
- func GetRecommendations(prefs *DenseMatrix, user int, products []string) ([]string, []float64, error)
- func Jaccard(a, b []float64) float64
- func Load(path, sep string) *DenseMatrix
- func MakeRatingMatrix(ratings []float64, rows, cols int) *DenseMatrix
- func NormSquared(a []float64) float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CosineSim ¶
Cosine Similarity between two vectors Returns cos similarity on a scale from 0 to 1.
func DotProduct ¶
Find the dot product between two vectors
func GetBinaryRecommendations ¶
func GetBinaryRecommendations(prefs *DenseMatrix, user int, products []string) ([]string, []float64, error)
Gets Recommendations for a user (row index) based on the prefs matrix. Uses cosine similarity for rating scale, and jaccard similarity if binary
func GetRecommendations ¶
func GetRecommendations(prefs *DenseMatrix, user int, products []string) ([]string, []float64, error)
Gets Recommendations for a user (row index) based on the prefs matrix. Uses cosine similarity for rating scale, and jaccard similarity if binary
func Load ¶
func Load(path, sep string) *DenseMatrix
read file with separator and load into a matrix. If user/product ID's start at 1, set first product/user at row/col index 0. Already tested in ALS package
func MakeRatingMatrix ¶
func NormSquared ¶
For cosine similarity. Returns sqrt of sum of squared elements.
Types ¶
This section is empty.