feature

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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 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

func (f *Feature) LoadFeatures(user *module.User, items []*module.Item, context *context.RecommendContext)

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

func NewFeatureOp(t string) FeatureOp

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

type UserFeatureFunc func(user *module.User, context *context.RecommendContext) []*module.Item

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.

Jump to

Keyboard shortcuts

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