Documentation ¶
Index ¶
- Constants
- func BetweenSlackInterval(trafficValue, setValue, delta float64) bool
- func DPP(L *mat.Dense, topN int, existed []int) []int
- func DPPWithWindow(L *mat.Dense, topN int, windowSize int) []int
- func FlowControl(controllerMap map[string]*PIDController, ctx *context.RecommendContext) (map[string]float64, int)
- func GetMaxScore(items []*module.Item) float64
- func Load(config *recconf.RecommendConfig)
- func ParseExpression(conditionArray, conditionExpress string) (string, error)
- func RegisterEmbeddingHook(name string, fn EmbeddingHookFunc)
- func RegisterSort(name string, s ISort)
- func RegisterSortWithConfig(config *recconf.RecommendConfig)
- func SampleControlTargetsByScore(maxUpliftTargetCnt int, targetScore, alpha map[string]float64, ...)
- func Sort(sortData *SortData, tag string)
- func ToBool(i interface{}, defaultVal bool) bool
- func ToString(task interface{}, excludes ...string) string
- type AlgoScoreSort
- type BoostScoreByWeight
- type BoostScoreCondition
- type BoostScoreSort
- type DPPSort
- type DistinctIdCondition
- type DistinctIdSort
- type DiversityMatchFunc
- type DiversityRule
- type DiversityRuleSort
- type EmbeddingHookFunc
- type Expression
- type ICloneSort
- type ISort
- type ItemContainer
- type ItemKey
- type ItemKeyFunc
- type ItemRankScoreSort
- type ItemRankSlice
- type ItemScoreSlice
- type ItemScoreSort
- type ItemSlot
- type MatrixDotFunc
- type MatrixScatterRule
- type MixSortStrategy
- type MixSortStrategyType
- type MultiRecallMixSort
- type PIDController
- func (p *PIDController) Do(trafficOrPercent float64, ctx *context.RecommendContext) (float64, float64)
- func (p *PIDController) DoWithId(trafficOrPercent float64, itemOrExpId string, ctx *context.RecommendContext) (float64, float64)
- func (p *PIDController) GenerateItemExpress()
- func (p *PIDController) GetMinExpTraffic() float64
- func (p *PIDController) IsAllocateExpWise() bool
- func (p *PIDController) IsControlledItem(item *module.Item) bool
- func (p *PIDController) IsControlledTraffic(ctx *context.RecommendContext) bool
- func (p *PIDController) SetAllocateExpWise(wise bool)
- func (p *PIDController) SetErrDiscount(decay float64)
- func (p *PIDController) SetFreezeMinutes(minutes int)
- func (p *PIDController) SetMinExpTraffic(traffic float64)
- func (p *PIDController) SetOnline(online bool)
- func (p *PIDController) SetParameters(kp, ki, kd float32)
- func (p *PIDController) SetRunWithZeroInput(run bool)
- func (p *PIDController) SetStartPageNum(pageNum int)
- func (p *PIDController) SetTimeWindow(timeWindow int)
- func (p *PIDController) SetUserExpress(expression string)
- type PIDStatus
- type SSDSort
- type SortData
- type SortService
- type SortStrategy
- type Strategy
- type TrafficControlSort
- type WindowRule
Constants ¶
View Source
const (
ItemDefaultName = "DEFAULT"
)
Variables ¶
This section is empty.
Functions ¶
func BetweenSlackInterval ¶
func FlowControl ¶
func FlowControl(controllerMap map[string]*PIDController, ctx *context.RecommendContext) (map[string]float64, int)
FlowControl 非单品(整体)目标流量调控,返回各个目标的调控力度
func GetMaxScore ¶
func Load ¶
func Load(config *recconf.RecommendConfig)
func ParseExpression ¶ added in v2.3.2
func RegisterEmbeddingHook ¶
func RegisterEmbeddingHook(name string, fn EmbeddingHookFunc)
func RegisterSort ¶
func RegisterSortWithConfig ¶
func RegisterSortWithConfig(config *recconf.RecommendConfig)
func SampleControlTargetsByScore ¶
func SampleControlTargetsByScore(maxUpliftTargetCnt int, targetScore, alpha map[string]float64, ctx *context.RecommendContext)
SampleControlTargetsByScore 按照偏好分权重选择n个上提目标,未被选中的目标调控值置0
Types ¶
type AlgoScoreSort ¶
type AlgoScoreSort struct {
// contains filtered or unexported fields
}
func NewAlgoScoreSort ¶
func NewAlgoScoreSort(config recconf.SortConfig) *AlgoScoreSort
func (*AlgoScoreSort) Sort ¶
func (s *AlgoScoreSort) Sort(sortData *SortData) error
type BoostScoreByWeight ¶
type BoostScoreByWeight struct {
BoostScoreByWeightDao module.BoostScoreByWeightDao
}
func NewBoostScoreByWeight ¶
func NewBoostScoreByWeight(config recconf.SortConfig) *BoostScoreByWeight
func (*BoostScoreByWeight) Sort ¶
func (s *BoostScoreByWeight) Sort(sortData *SortData) error
type BoostScoreCondition ¶
type BoostScoreCondition struct {
// contains filtered or unexported fields
}
func NewBoostScoreCondition ¶
func NewBoostScoreCondition(config *recconf.BoostScoreCondition) (*BoostScoreCondition, error)
type BoostScoreSort ¶
type BoostScoreSort struct {
// contains filtered or unexported fields
}
func NewBoostScoreSort ¶
func NewBoostScoreSort(config recconf.SortConfig) *BoostScoreSort
func (*BoostScoreSort) CloneWithConfig ¶
func (s *BoostScoreSort) CloneWithConfig(params map[string]interface{}) ISort
func (*BoostScoreSort) GetSortName ¶
func (s *BoostScoreSort) GetSortName() string
func (*BoostScoreSort) Sort ¶
func (s *BoostScoreSort) Sort(sortData *SortData) error
type DPPSort ¶
type DPPSort struct {
// contains filtered or unexported fields
}
func NewDPPSort ¶
func NewDPPSort(config recconf.DPPSortConfig) *DPPSort
func (*DPPSort) GenerateEmbedding ¶
func (*DPPSort) KernelMatrix ¶
type DistinctIdCondition ¶
type DistinctIdCondition struct {
// contains filtered or unexported fields
}
func NewDistinctIdCondition ¶
func NewDistinctIdCondition(config *recconf.DistinctIdCondition) *DistinctIdCondition
type DistinctIdSort ¶
type DistinctIdSort struct {
// contains filtered or unexported fields
}
func NewDistinctIdSort ¶
func NewDistinctIdSort(config recconf.SortConfig) *DistinctIdSort
func (*DistinctIdSort) Sort ¶
func (s *DistinctIdSort) Sort(sortData *SortData) error
type DiversityMatchFunc ¶
type DiversityRule ¶
type DiversityRule struct { DiversityRuleConfig recconf.DiversityRuleConfig DimensionItemMap map[module.ItemId]string }
func NewDiversityRule ¶
func NewDiversityRule(config recconf.DiversityRuleConfig) *DiversityRule
func (*DiversityRule) GetDimensionValue ¶
func (r *DiversityRule) GetDimensionValue(item *module.Item) string
type DiversityRuleSort ¶
type DiversityRuleSort struct {
// contains filtered or unexported fields
}
func NewDiversityRuleSort ¶
func NewDiversityRuleSort(config recconf.SortConfig) *DiversityRuleSort
func (*DiversityRuleSort) CloneWithConfig ¶
func (s *DiversityRuleSort) CloneWithConfig(params map[string]interface{}) ISort
func (*DiversityRuleSort) GetSortName ¶
func (s *DiversityRuleSort) GetSortName() string
func (*DiversityRuleSort) Sort ¶
func (s *DiversityRuleSort) Sort(sortData *SortData) error
type EmbeddingHookFunc ¶
type EmbeddingHookFunc func(context *context.RecommendContext, item *module.Item) []float64
type Expression ¶
type ICloneSort ¶
type ItemContainer ¶
type ItemContainer struct {
// contains filtered or unexported fields
}
func NewItemContaienr ¶
func NewItemContaienr(strategy Strategy, size int) *ItemContainer
func (*ItemContainer) Assembly ¶
func (c *ItemContainer) Assembly() (ret []*module.Item)
func (*ItemContainer) Assign ¶
func (c *ItemContainer) Assign(name string, size int, capacity int, sortStrategy SortStrategy)
func (*ItemContainer) Split ¶
func (c *ItemContainer) Split(items []*module.Item)
type ItemKeyFunc ¶
type ItemKeyFunc func(item *module.Item, context *context.RecommendContext) string
type ItemRankScoreSort ¶
type ItemRankScoreSort struct { }
func NewItemRankScoreSort ¶
func NewItemRankScoreSort() *ItemRankScoreSort
func (*ItemRankScoreSort) Sort ¶
func (s *ItemRankScoreSort) Sort(sortData *SortData) error
type ItemRankSlice ¶
func (ItemRankSlice) Len ¶
func (us ItemRankSlice) Len() int
func (ItemRankSlice) Less ¶
func (us ItemRankSlice) Less(i, j int) bool
func (ItemRankSlice) Swap ¶
func (us ItemRankSlice) Swap(i, j int)
type ItemScoreSlice ¶
func (ItemScoreSlice) Len ¶
func (us ItemScoreSlice) Len() int
func (ItemScoreSlice) Less ¶
func (us ItemScoreSlice) Less(i, j int) bool
func (ItemScoreSlice) Swap ¶
func (us ItemScoreSlice) Swap(i, j int)
type ItemScoreSort ¶
type ItemScoreSort struct { }
func (*ItemScoreSort) Sort ¶
func (s *ItemScoreSort) Sort(sortData *SortData) error
type ItemSlot ¶
type ItemSlot struct {
// contains filtered or unexported fields
}
ItemSlot is a group of items split by the Strategy, like SplitByRecallName
type MatrixScatterRule ¶
type MatrixScatterRule struct { Threshold float64 // contains filtered or unexported fields }
func NewMatrixScatterRule ¶
func NewMatrixScatterRule(threshold float64, items []*module.Item, f MatrixDotFunc) *MatrixScatterRule
func (*MatrixScatterRule) Match ¶
func (r *MatrixScatterRule) Match(pos int, item *module.Item, context *context.RecommendContext) bool
pos start from 1 return true or false, if return true, the item can add into the items
type MixSortStrategy ¶
type MixSortStrategy interface { ContainsRecallName(name string) bool AppendItem(item *module.Item) IsFull() bool GetStrategyType() MixSortStrategyType BuildItems(items []*module.Item) []*module.Item Evaluate(properties map[string]interface{}) (bool, error) EvaluateByDomain(userProperties, itemProperties map[string]interface{}) (bool, error) IsUseCondition() bool }
type MixSortStrategyType ¶
type MixSortStrategyType int
const ( FixPositionStrategyType MixSortStrategyType = 1 RandomPositionStrategyType MixSortStrategyType = 2 DefaultStrategyType MixSortStrategyType = 3 )
type MultiRecallMixSort ¶
type MultiRecallMixSort struct {
// contains filtered or unexported fields
}
func NewMultiRecallMixSort ¶
func NewMultiRecallMixSort(config recconf.SortConfig) *MultiRecallMixSort
func (*MultiRecallMixSort) Sort ¶
func (s *MultiRecallMixSort) Sort(sortData *SortData) error
type PIDController ¶
type PIDController struct {
// contains filtered or unexported fields
}
func NewPIDController ¶
func NewPIDController(task *model.TrafficControlTask, target *model.TrafficControlTarget, conf *recconf.PIDControllerConfig, expId string) *PIDController
func (*PIDController) Do ¶
func (p *PIDController) Do(trafficOrPercent float64, ctx *context.RecommendContext) (float64, float64)
func (*PIDController) DoWithId ¶
func (p *PIDController) DoWithId(trafficOrPercent float64, itemOrExpId string, ctx *context.RecommendContext) (float64, float64)
func (*PIDController) GenerateItemExpress ¶ added in v2.3.2
func (p *PIDController) GenerateItemExpress()
func (*PIDController) GetMinExpTraffic ¶
func (p *PIDController) GetMinExpTraffic() float64
func (*PIDController) IsAllocateExpWise ¶
func (p *PIDController) IsAllocateExpWise() bool
func (*PIDController) IsControlledItem ¶
func (p *PIDController) IsControlledItem(item *module.Item) bool
func (*PIDController) IsControlledTraffic ¶
func (p *PIDController) IsControlledTraffic(ctx *context.RecommendContext) bool
func (*PIDController) SetAllocateExpWise ¶
func (p *PIDController) SetAllocateExpWise(wise bool)
func (*PIDController) SetErrDiscount ¶
func (p *PIDController) SetErrDiscount(decay float64)
func (*PIDController) SetFreezeMinutes ¶
func (p *PIDController) SetFreezeMinutes(minutes int)
func (*PIDController) SetMinExpTraffic ¶
func (p *PIDController) SetMinExpTraffic(traffic float64)
func (*PIDController) SetOnline ¶
func (p *PIDController) SetOnline(online bool)
func (*PIDController) SetParameters ¶
func (p *PIDController) SetParameters(kp, ki, kd float32)
func (*PIDController) SetRunWithZeroInput ¶
func (p *PIDController) SetRunWithZeroInput(run bool)
func (*PIDController) SetStartPageNum ¶
func (p *PIDController) SetStartPageNum(pageNum int)
func (*PIDController) SetTimeWindow ¶ added in v2.3.2
func (p *PIDController) SetTimeWindow(timeWindow int)
func (*PIDController) SetUserExpress ¶ added in v2.3.2
func (p *PIDController) SetUserExpress(expression string)
type SSDSort ¶ added in v2.3.2
type SSDSort struct {
// contains filtered or unexported fields
}
func NewSSDSort ¶ added in v2.3.2
func NewSSDSort(config recconf.SSDSortConfig) *SSDSort
func (*SSDSort) SSDWithSlidingWindow ¶ added in v2.3.2
func (s *SSDSort) SSDWithSlidingWindow(items []*module.Item, ctx *context.RecommendContext) []*module.Item
SSDWithSlidingWindow paper: https://arxiv.org/pdf/2107.05204
type SortData ¶
type SortData struct { Data interface{} Context *context.RecommendContext User *module.User PipelineName string }
type SortService ¶
func (*SortService) AddSort ¶
func (ss *SortService) AddSort(scene string, s ISort)
func (*SortService) AddSorts ¶
func (ss *SortService) AddSorts(scene string, sorts []ISort)
func (*SortService) Sort ¶
func (ss *SortService) Sort(data *SortData, tag string)
type SortStrategy ¶
type SortStrategy int
const ( SortByScoreStrategy SortStrategy = iota SortByRandomStrategy )
type TrafficControlSort ¶ added in v2.3.2
type TrafficControlSort struct {
// contains filtered or unexported fields
}
func NewTrafficControlSort ¶ added in v2.3.2
func NewTrafficControlSort(config recconf.SortConfig) *TrafficControlSort
func (*TrafficControlSort) CloneWithConfig ¶ added in v2.3.2
func (p *TrafficControlSort) CloneWithConfig(params map[string]interface{}) ISort
func (*TrafficControlSort) GetSortName ¶ added in v2.3.2
func (p *TrafficControlSort) GetSortName() string
func (*TrafficControlSort) Sort ¶ added in v2.3.2
func (p *TrafficControlSort) Sort(sortData *SortData) error
type WindowRule ¶
type WindowRule struct { Size int Min int Max int ItemKey ItemKeyFunc Total int // contains filtered or unexported fields }
func NewWindowRule ¶
func NewWindowRule(min, max, size, total int, f ItemKeyFunc) *WindowRule
size : window size total: window total size, recommend item list size
func (*WindowRule) AddToWindow ¶
func (w *WindowRule) AddToWindow(pos int, item *module.Item, context *context.RecommendContext) bool
item add to the window list by the param pos, a int value of position pos start from 1 return true or false, if add success, return true, else return false
Source Files ¶
- algo_score_sort.go
- boost_score_by_weight.go
- boost_score_sort.go
- boost_score_sort_clone.go
- distinct_id_sort.go
- diversity_rule.go
- diversity_rule_sort.go
- diversity_rule_sort_clone.go
- dpp_sort.go
- item_container.go
- item_rank_score.go
- item_score.go
- matrix_scatter_rule.go
- mix_sort_strategy.go
- multi_recall_mix_sort.go
- pid_controller.go
- sort.go
- ssd_sort.go
- traffic_control_sort.go
- traffic_control_sort_clone.go
- window_rule.go
Click to show internal directories.
Click to hide internal directories.