general_rank

package
v2.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadGeneralRankWithConfig

func LoadGeneralRankWithConfig(config *recconf.RecommendConfig)

LoadGeneralRankWithConfig load general rank config by the recconf config When the function invoked, shows a new config reload, avoid using old filter or sort in the actions, we will clear the rank map, because when request come, GetColdStartGeneralRankByContext or GetGeneralRankByContext will get the new config and regiter the rank in the map.

func RegisterColdStartGeneralRank

func RegisterColdStartGeneralRank(rankId string, rank *ColdStartGeneralRank)

func RegisterGeneralRank

func RegisterGeneralRank(rankId string, rank *GeneralRank)

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

func NewAction

func NewAction(config *recconf.ActionConfig) (*Action, error)

func (*Action) Do

func (a *Action) Do(user *module.User, items []*module.Item, context *context.RecommendContext) (ret []*module.Item)

type ActionType

type ActionType int
const (
	UnknownAction ActionType = 0
	SortAction    ActionType = 1
	FilterAction  ActionType = 2
)

func CreateActionType

func CreateActionType(str string) ActionType

type BaseGeneralRank

type BaseGeneralRank struct {
	// contains filtered or unexported fields
}

func NewBaseGeneralRankWithConfig

func NewBaseGeneralRankWithConfig(scene string, config recconf.GeneralRankConfig) *BaseGeneralRank

func (*BaseGeneralRank) DoRank

func (r *BaseGeneralRank) DoRank(user *module.User, items []*module.Item, context *context.RecommendContext, pipeline string) (ret []*module.Item)

Rank GeneralRank for items , return the items for Rank 1. first load user features 2. construct data use AlgoDataGenerator, if processor is easyrec, create easyrecRequest 3. use goroutines to invoke eas module 4. iterator actions invoke Do function to apply items

type ColdStartGeneralRank

type ColdStartGeneralRank struct {
	*BaseGeneralRank
	// contains filtered or unexported fields
}

func NewColdStartGeneralRankWithConfig

func NewColdStartGeneralRankWithConfig(scene string, config recconf.ColdStartGeneralRankConfig) (*ColdStartGeneralRank, error)

func (*ColdStartGeneralRank) Filter

func (r *ColdStartGeneralRank) Filter(User *module.User, item *module.Item, context *context.RecommendContext) bool

func (*ColdStartGeneralRank) Rank

func (r *ColdStartGeneralRank) Rank(user *module.User, items []*module.Item, context *context.RecommendContext) (ret []*module.Item)

type FeatureConsistencyJobService

type FeatureConsistencyJobService struct {
}

func (*FeatureConsistencyJobService) LogRankResult

func (r *FeatureConsistencyJobService) LogRankResult(user *module.User, items []*module.Item, context *context.RecommendContext)

type GeneralRank

type GeneralRank struct {
	*BaseGeneralRank
}

func NewGeneralRankWithConfig

func NewGeneralRankWithConfig(scene string, config recconf.GeneralRankConfig) (*GeneralRank, error)

func (*GeneralRank) Rank

func (r *GeneralRank) Rank(user *module.User, items []*module.Item, context *context.RecommendContext) (ret []*module.Item)

type GeneralRankService

type GeneralRankService struct {
	// contains filtered or unexported fields
}

func DefaultGeneralRankService

func DefaultGeneralRankService() *GeneralRankService

func NewGeneralRankService

func NewGeneralRankService() *GeneralRankService

func (*GeneralRankService) AddColdStartGeneralRank

func (r *GeneralRankService) AddColdStartGeneralRank(rankId string, rank *ColdStartGeneralRank)

func (*GeneralRankService) AddGeneralRank

func (r *GeneralRankService) AddGeneralRank(rankId string, rank *GeneralRank)

func (*GeneralRankService) Clear

func (r *GeneralRankService) Clear()

func (*GeneralRankService) GetColdStartGeneralRank

func (r *GeneralRankService) GetColdStartGeneralRank(rankId string) (*ColdStartGeneralRank, bool)

func (*GeneralRankService) GetColdStartGeneralRankByContext

func (r *GeneralRankService) GetColdStartGeneralRankByContext(context *context.RecommendContext) *ColdStartGeneralRank

func (*GeneralRankService) GetGeneralRank

func (r *GeneralRankService) GetGeneralRank(rankId string) (*GeneralRank, bool)

func (*GeneralRankService) GetGeneralRankByContext

func (r *GeneralRankService) GetGeneralRankByContext(context *context.RecommendContext) *GeneralRank

GetGeneralRank return the GeneralRank by the context If not found, return nil

func (*GeneralRankService) Rank

func (r *GeneralRankService) Rank(user *module.User, items []*module.Item, context *context.RecommendContext) (ret []*module.Item)

type IGeneralRank

type IGeneralRank interface {
	// Filter the custom rank of item
	Filter(User *module.User, item *module.Item, context *context.RecommendContext) bool

	Rank(User *module.User, items []*module.Item, context *context.RecommendContext)
}

Jump to

Keyboard shortcuts

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