Documentation ¶
Index ¶
- Constants
- func LoadFeatureConfig(config *recconf.RecommendConfig)
- func RegisterFeatureFunc(sceneName string, f FeatureFunc)
- func RegisterLoadFeatureFunc(sceneName string, f LoadFeatureFunc)
- func RegisterUserFeatureFunc(sceneName string, f UserFeatureFunc)
- func RegisterUserLoadFeatureFunc(sceneName string, f UserLoadFeatureFunc)
- func UserLoadFeatureConfig(config *recconf.RecommendConfig)
- type BatchRawFeatureOp
- type ComposeFeatureOp
- type ContextFeatureOp
- type CreateConstValueNormalizer
- type CreateDayNormalizer
- type CreateHourNormalizer
- type CreateNewFeatureOp
- type CreateRandomNormalizer
- type DeleteFeatureOp
- type ExpressionNormalizer
- type Feature
- type FeatureFunc
- type FeatureOp
- type FeatureService
- func (s *FeatureService) AddFeatureFunc(sceneName string, f FeatureFunc)
- func (s *FeatureService) AddLoadFeatureFunc(sceneName string, f LoadFeatureFunc)
- func (s *FeatureService) LoadFeatures(user *module.User, items []*module.Item, context *context.RecommendContext) []*module.Item
- func (s *FeatureService) LoadFeaturesForGeneralRank(user *module.User, items []*module.Item, context *context.RecommendContext, ...)
- func (s *FeatureService) LoadFeaturesForPipelineRank(user *module.User, items []*module.Item, context *context.RecommendContext, ...)
- func (s *FeatureService) SetFeatureSceneAsync(sceneName string, async bool)
- func (s *FeatureService) SetFeatures(sceneName string, features []*Feature)
- type FeatureTrans
- type LoadFeatureFunc
- type Normalizer
- type RawFeatureOp
- type UserFeatureFunc
- type UserFeatureService
- func (s *UserFeatureService) GetLoadFeaturesStageNames(context *context.RecommendContext) (stageNames []string)
- func (s *UserFeatureService) LoadUserFeatures(user *module.User, context *context.RecommendContext)
- func (s *UserFeatureService) LoadUserFeaturesForCallback(user *module.User, context *context.RecommendContext)
- type UserLoadFeatureFunc
Constants ¶
const ( SOURCE_USER = "user" SOURCE_ITEM = "item" )
Variables ¶
This section is empty.
Functions ¶
func LoadFeatureConfig ¶
func LoadFeatureConfig(config *recconf.RecommendConfig)
func RegisterFeatureFunc ¶
func RegisterFeatureFunc(sceneName string, f FeatureFunc)
func RegisterLoadFeatureFunc ¶
func RegisterLoadFeatureFunc(sceneName string, f LoadFeatureFunc)
func RegisterUserFeatureFunc ¶
func RegisterUserFeatureFunc(sceneName string, f UserFeatureFunc)
func RegisterUserLoadFeatureFunc ¶
func RegisterUserLoadFeatureFunc(sceneName string, f UserLoadFeatureFunc)
func UserLoadFeatureConfig ¶
func UserLoadFeatureConfig(config *recconf.RecommendConfig)
Types ¶
type BatchRawFeatureOp ¶
type BatchRawFeatureOp struct {
// contains filtered or unexported fields
}
func (BatchRawFeatureOp) ItemTransOp ¶
func (op BatchRawFeatureOp) ItemTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, item *module.Item, context *context.RecommendContext)
ItemTransOp of BatchRawFeatureOp to Trans item or user feature it create new feature store in item properties
func (BatchRawFeatureOp) UserTransOp ¶
func (op BatchRawFeatureOp) UserTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, context *context.RecommendContext)
UserTransOp of BatchRawFeatureOp to Trans user feature it create new feature store in user properties
type ComposeFeatureOp ¶
type ComposeFeatureOp struct {
// contains filtered or unexported fields
}
func (ComposeFeatureOp) ItemTransOp ¶
func (op ComposeFeatureOp) ItemTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, item *module.Item, context *context.RecommendContext)
func (ComposeFeatureOp) UserTransOp ¶
func (op ComposeFeatureOp) UserTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, context *context.RecommendContext)
type ContextFeatureOp ¶ added in v2.3.7
type ContextFeatureOp struct { }
ContextFeatureOp add context feature to user
func (ContextFeatureOp) ItemTransOp ¶ added in v2.3.7
func (op ContextFeatureOp) ItemTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, item *module.Item, context *context.RecommendContext)
func (ContextFeatureOp) UserTransOp ¶ added in v2.3.7
func (op ContextFeatureOp) UserTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, context *context.RecommendContext)
type CreateConstValueNormalizer ¶
type CreateConstValueNormalizer struct { }
func NewCreateConstValueNormalizer ¶
func NewCreateConstValueNormalizer() *CreateConstValueNormalizer
func (*CreateConstValueNormalizer) Apply ¶
func (n *CreateConstValueNormalizer) Apply(value interface{}) interface{}
type CreateDayNormalizer ¶
type CreateDayNormalizer struct { }
func (*CreateDayNormalizer) Apply ¶
func (n *CreateDayNormalizer) Apply(value interface{}) interface{}
type CreateHourNormalizer ¶
type CreateHourNormalizer struct { }
func (*CreateHourNormalizer) Apply ¶
func (n *CreateHourNormalizer) Apply(value interface{}) interface{}
type CreateNewFeatureOp ¶
type CreateNewFeatureOp struct { }
CreateNewFeatureOp create new feature by Normalizer
func (CreateNewFeatureOp) ItemTransOp ¶
func (op CreateNewFeatureOp) ItemTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, item *module.Item, context *context.RecommendContext)
func (CreateNewFeatureOp) UserTransOp ¶
func (op CreateNewFeatureOp) UserTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, context *context.RecommendContext)
it create new feature store in user properties
type CreateRandomNormalizer ¶
type CreateRandomNormalizer struct { }
func NewCreateRandomNormalizer ¶
func NewCreateRandomNormalizer() *CreateRandomNormalizer
func (*CreateRandomNormalizer) Apply ¶
func (n *CreateRandomNormalizer) Apply(value interface{}) interface{}
type DeleteFeatureOp ¶
type DeleteFeatureOp struct {
// contains filtered or unexported fields
}
func (DeleteFeatureOp) ItemTransOp ¶
func (op DeleteFeatureOp) ItemTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, item *module.Item, context *context.RecommendContext)
ItemTransOp of DeleteFeatureOp to Trans item or user feature it create new feature store in item properties
func (DeleteFeatureOp) UserTransOp ¶
func (op DeleteFeatureOp) UserTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, context *context.RecommendContext)
UserTransOp of DeleteFeatureOp to Trans user feature it create new feature store in user properties
type ExpressionNormalizer ¶
type ExpressionNormalizer struct {
// contains filtered or unexported fields
}
func NewExpressionNormalizer ¶
func NewExpressionNormalizer(expression string) *ExpressionNormalizer
func (*ExpressionNormalizer) Apply ¶
func (n *ExpressionNormalizer) Apply(value interface{}) interface{}
type Feature ¶
type Feature struct {
// contains filtered or unexported fields
}
Feature is a type for load user or item feature
func LoadWithConfig ¶
func LoadWithConfig(config recconf.FeatureLoadConfig) *Feature
func (*Feature) LoadFeatures ¶
type FeatureFunc ¶
type FeatureFunc func(user *module.User, items []*module.Item, context *context.RecommendContext) []*module.Item
FeatureFunc is use for feature engineering, after all the features loaded
type FeatureOp ¶
type FeatureOp interface { UserTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, context *context.RecommendContext) ItemTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, item *module.Item, context *context.RecommendContext) }
func NewFeatureOp ¶
type FeatureService ¶
type FeatureService struct { FeatureSceneMap map[string][]*Feature FeatureSceneSigns map[string]string FeatureSceneAsyncMap map[string]bool FeatureFuncMap map[string]FeatureFunc LoadFeatureFuncMap map[string]LoadFeatureFunc }
func DefaultFeatureService ¶
func DefaultFeatureService() *FeatureService
func NewFeatureService ¶
func NewFeatureService() *FeatureService
func (*FeatureService) AddFeatureFunc ¶
func (s *FeatureService) AddFeatureFunc(sceneName string, f FeatureFunc)
func (*FeatureService) AddLoadFeatureFunc ¶
func (s *FeatureService) AddLoadFeatureFunc(sceneName string, f LoadFeatureFunc)
func (*FeatureService) LoadFeatures ¶
func (s *FeatureService) LoadFeatures(user *module.User, items []*module.Item, context *context.RecommendContext) []*module.Item
LoadFeatures load user or item feature use feature.Feature
func (*FeatureService) LoadFeaturesForGeneralRank ¶
func (s *FeatureService) LoadFeaturesForGeneralRank(user *module.User, items []*module.Item, context *context.RecommendContext, pipeline string)
func (*FeatureService) LoadFeaturesForPipelineRank ¶
func (s *FeatureService) LoadFeaturesForPipelineRank(user *module.User, items []*module.Item, context *context.RecommendContext, pipeline string)
func (*FeatureService) SetFeatureSceneAsync ¶
func (s *FeatureService) SetFeatureSceneAsync(sceneName string, async bool)
func (*FeatureService) SetFeatures ¶
func (s *FeatureService) SetFeatures(sceneName string, features []*Feature)
type FeatureTrans ¶
type FeatureTrans interface {
FeatureTran(user *module.User, items []*module.Item, context *context.RecommendContext)
}
func NewFeatureTrans ¶
func NewFeatureTrans(t, name, store string, source string, remove bool, normalizer, expression string) FeatureTrans
type LoadFeatureFunc ¶
type LoadFeatureFunc func(user *module.User, items []*module.Item, context *context.RecommendContext)
LoadFeatureFunc is the function you can custom define to load features.
type Normalizer ¶
type Normalizer interface {
Apply(value interface{}) interface{}
}
func NewNormalizer ¶
func NewNormalizer(name, expression string) Normalizer
type RawFeatureOp ¶
type RawFeatureOp struct {
// contains filtered or unexported fields
}
func (RawFeatureOp) ItemTransOp ¶
func (op RawFeatureOp) ItemTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, item *module.Item, context *context.RecommendContext)
ItemTransOp of RawFeatureOp to Trans item or user feature it create new feature store in item properties
func (RawFeatureOp) UserTransOp ¶
func (op RawFeatureOp) UserTransOp(featureName string, source string, remove bool, normalizer Normalizer, user *module.User, context *context.RecommendContext)
UserTransOp of RawFeatureOp to Trans user feature it create new feature store in user properties
type UserFeatureFunc ¶
UserFeatureFunc is use for feature engineering, after all the features loaded
type UserFeatureService ¶
type UserFeatureService struct { *FeatureService FeatureAsyncLoadMap map[*Feature]bool }
func DefaultUserFeatureService ¶
func DefaultUserFeatureService() *UserFeatureService
func NewUserFeatureService ¶
func NewUserFeatureService() *UserFeatureService
func (*UserFeatureService) GetLoadFeaturesStageNames ¶
func (s *UserFeatureService) GetLoadFeaturesStageNames(context *context.RecommendContext) (stageNames []string)
func (*UserFeatureService) LoadUserFeatures ¶
func (s *UserFeatureService) LoadUserFeatures(user *module.User, context *context.RecommendContext)
LoadUserFeatures load user feature use feature.Feature
func (*UserFeatureService) LoadUserFeaturesForCallback ¶
func (s *UserFeatureService) LoadUserFeaturesForCallback(user *module.User, context *context.RecommendContext)
type UserLoadFeatureFunc ¶
type UserLoadFeatureFunc func(user *module.User, context *context.RecommendContext)
LoadFeatureFunc is the function you can custom define to load features.