Documentation ¶
Overview ¶
Alternating Least Squares recommendation algorithm in Go !
Index ¶
- Variables
- func GetTopNRecommendations(Q, Qhat *DenseMatrix, user, n int, products []string) ([]string, error)
- func Load(path, sep string) *DenseMatrix
- func MakeRatingMatrix(ratings []float64, rows, cols int) *DenseMatrix
- func Predict(Qhat *DenseMatrix, user, product int) (float64, error)
- func Train(Q *DenseMatrix, n_factors, iterations int, lambda float64) (*DenseMatrix, float64)
- func TrainImplicit(R *DenseMatrix, n_factors, iterations int, lambda float64) *DenseMatrix
Constants ¶
This section is empty.
Variables ¶
var (
NA = math.NaN()
)
Functions ¶
func GetTopNRecommendations ¶
looks at the model generated by ALS and makes a user/product prediction Returns best n recommendations for a user index in the matrix. If products is nil, returns top indices. Else returns names of top products.
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.
func MakeRatingMatrix ¶
Wrapper for MakeDenseMatrix. Returns rating matrix
func Train ¶
Params: the user/product matrix, number of factors for recommendation, iterations, and lambda value for ALS. Returns the trained matrix with predictions for 0 valued entries, and the final error calculation (float64)
func TrainImplicit ¶
Params: the rating matrix, number of factors, number of iterations, and lambda for building recommendation matrix. Returns the confidence matrix on a scale from 0 to 1.
Types ¶
This section is empty.