Documentation
¶
Index ¶
- Constants
- type ChatRanker
- type External
- type FeedbackItem
- type IDF
- type ItemToItem
- type ItemToItemOptions
- type MatrixFactorizationItems
- type MatrixFactorizationUsers
- type NonPersonalized
- type Recommender
- func (r *Recommender) ExcludeSet() mapset.Set[string]
- func (r *Recommender) IsColdStart() bool
- func (r *Recommender) Recommend(ctx context.Context, limit int) ([]cache.Score, error)
- func (r *Recommender) RecommendSequential(ctx context.Context, result []cache.Score, limit int, names ...string) ([]cache.Score, string, error)
- func (r *Recommender) UserFeedback() []data.Feedback
- type RecommenderFunc
- type UserToUser
- type UserToUserOptions
Constants ¶
View Source
const ( LatestRecommender = "latest" NonPersonalizedRecommender = "non-personalized/" ItemToItemRecommender = "item-to-item/" UserToUserRecommender = "user-to-user/" ExternalRecommender = "external/" CollaborativeRecommender = "collaborative" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatRanker ¶
type ChatRanker struct {
// contains filtered or unexported fields
}
func NewChatRanker ¶
func NewChatRanker(cfg config.OpenAIConfig, prompt string) (*ChatRanker, error)
func (*ChatRanker) Rank ¶
func (r *ChatRanker) Rank(user *data.User, feedback []*FeedbackItem, items []*data.Item) ([]string, error)
type External ¶
type External struct {
// contains filtered or unexported fields
}
func NewExternal ¶
func NewExternal(cfg config.ExternalConfig) (*External, error)
type FeedbackItem ¶
type ItemToItem ¶
type ItemToItem interface {
Timestamp() time.Time
Items() []*data.Item
Push(item *data.Item, feedback []int32)
PopAll(i int) []cache.Score
Pool() parallel.Pool
}
func NewItemToItem ¶
func NewItemToItem(cfg config.ItemToItemConfig, n int, timestamp time.Time, opts *ItemToItemOptions) (ItemToItem, error)
type ItemToItemOptions ¶
type ItemToItemOptions struct {
TagsIDF []float32
UsersIDF []float32
OpenAIConfig config.OpenAIConfig
}
type MatrixFactorizationItems ¶
type MatrixFactorizationItems struct {
// contains filtered or unexported fields
}
func NewMatrixFactorizationItems ¶
func NewMatrixFactorizationItems(timestamp time.Time) *MatrixFactorizationItems
func (*MatrixFactorizationItems) Add ¶
func (items *MatrixFactorizationItems) Add(itemId string, v []float32)
func (*MatrixFactorizationItems) Marshal ¶
func (items *MatrixFactorizationItems) Marshal(w io.Writer) error
type MatrixFactorizationUsers ¶
type MatrixFactorizationUsers struct {
// contains filtered or unexported fields
}
func NewMatrixFactorizationUsers ¶
func NewMatrixFactorizationUsers() *MatrixFactorizationUsers
func (*MatrixFactorizationUsers) Add ¶
func (users *MatrixFactorizationUsers) Add(userId string, v []float32)
func (*MatrixFactorizationUsers) Get ¶
func (users *MatrixFactorizationUsers) Get(userId string) ([]float32, bool)
type NonPersonalized ¶
func NewNonPersonalized ¶
func NewNonPersonalized(cfg config.NonPersonalizedConfig, n int, timestamp time.Time) (*NonPersonalized, error)
func (*NonPersonalized) Name ¶
func (l *NonPersonalized) Name() string
func (*NonPersonalized) PopAll ¶
func (l *NonPersonalized) PopAll() []cache.Score
func (*NonPersonalized) Push ¶
func (l *NonPersonalized) Push(item data.Item, feedback []data.Feedback)
func (*NonPersonalized) Timestamp ¶
func (l *NonPersonalized) Timestamp() time.Time
type Recommender ¶
type Recommender struct {
// contains filtered or unexported fields
}
func NewRecommender ¶
func (*Recommender) ExcludeSet ¶
func (r *Recommender) ExcludeSet() mapset.Set[string]
func (*Recommender) IsColdStart ¶
func (r *Recommender) IsColdStart() bool
func (*Recommender) RecommendSequential ¶
func (r *Recommender) RecommendSequential(ctx context.Context, result []cache.Score, limit int, names ...string) ([]cache.Score, string, error)
RecommendSequential recommend items from multiple recommenders sequentially util reaching the limit. If limit <= 0, all recommendations are returned.
func (*Recommender) UserFeedback ¶
func (r *Recommender) UserFeedback() []data.Feedback
type RecommenderFunc ¶
type UserToUser ¶
type UserToUser interface {
Users() []*data.User
Push(user *data.User, feedback []int32)
PopAll(i int) []cache.Score
Timestamp() time.Time
}
func NewUserToUser ¶
func NewUserToUser(cfg config.UserToUserConfig, n int, timestamp time.Time, opts *UserToUserOptions) (UserToUser, error)
type UserToUserOptions ¶
Click to show internal directories.
Click to hide internal directories.