Documentation
¶
Index ¶
Constants ¶
View Source
const ( NeighborTypeAuto = "auto" NeighborTypeSimilar = "similar" NeighborTypeRelated = "related" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollaborativeConfig ¶ added in v0.4.0
type CollaborativeConfig struct {
ModelFitPeriod time.Duration `mapstructure:"model_fit_period" validate:"gt=0"`
ModelSearchPeriod time.Duration `mapstructure:"model_search_period" validate:"gt=0"`
ModelSearchEpoch int `mapstructure:"model_search_epoch" validate:"gt=0"`
ModelSearchTrials int `mapstructure:"model_search_trials" validate:"gt=0"`
EnableModelSizeSearch bool `mapstructure:"enable_model_size_search"`
EnableIndex bool `mapstructure:"enable_index"`
IndexRecall float32 `mapstructure:"index_recall" validate:"gt=0"`
IndexFitEpoch int `mapstructure:"index_fit_epoch" validate:"gt=0"`
}
type Config ¶
type Config struct {
Database DatabaseConfig `mapstructure:"database"`
Master MasterConfig `mapstructure:"master"`
Server ServerConfig `mapstructure:"server"`
Recommend RecommendConfig `mapstructure:"recommend"`
Tracing TracingConfig `mapstructure:"tracing"`
}
Config is the configuration for the engine.
func GetDefaultConfig ¶ added in v0.4.0
func GetDefaultConfig() *Config
func LoadConfig ¶
LoadConfig loads configuration from toml file.
func (*Config) ItemNeighborDigest ¶ added in v0.4.1
func (*Config) OfflineRecommendDigest ¶ added in v0.4.1
func (config *Config) OfflineRecommendDigest(option ...DigestOption) string
func (*Config) UserNeighborDigest ¶ added in v0.4.1
type DataSourceConfig ¶ added in v0.4.0
type DataSourceConfig struct {
PositiveFeedbackTypes []string `mapstructure:"positive_feedback_types"` // positive feedback type
ReadFeedbackTypes []string `mapstructure:"read_feedback_types"` // feedback type for read event
PositiveFeedbackTTL uint `mapstructure:"positive_feedback_ttl" validate:"gte=0"` // time-to-live of positive feedbacks
ItemTTL uint `mapstructure:"item_ttl" validate:"gte=0"` // item-to-live of items
}
type DatabaseConfig ¶
type DatabaseConfig struct {
DataStore string `mapstructure:"data_store" validate:"required,data_store"` // database for data store
CacheStore string `mapstructure:"cache_store" validate:"required,cache_store"` // database for cache store
TablePrefix string `mapstructure:"table_prefix"`
DataTablePrefix string `mapstructure:"data_table_prefix"`
CacheTablePrefix string `mapstructure:"cache_table_prefix"`
}
DatabaseConfig is the configuration for the database.
type DigestOption ¶ added in v0.4.1
type DigestOption func(option *digestOptions)
func WithCollaborative ¶ added in v0.4.1
func WithCollaborative(v bool) DigestOption
func WithItemNeighborDigest ¶ added in v0.4.1
func WithItemNeighborDigest(digest string) DigestOption
func WithRanking ¶ added in v0.4.1
func WithRanking(v bool) DigestOption
func WithUserNeighborDigest ¶ added in v0.4.1
func WithUserNeighborDigest(digest string) DigestOption
type MasterConfig ¶
type MasterConfig struct {
Port int `mapstructure:"port" validate:"gte=0"` // master port
Host string `mapstructure:"host"` // master host
HttpPort int `mapstructure:"http_port" validate:"gte=0"` // HTTP port
HttpHost string `mapstructure:"http_host"` // HTTP host
HttpCorsDomains []string `mapstructure:"http_cors_domains"` // add allowed cors domains
HttpCorsMethods []string `mapstructure:"http_cors_methods"` // add allowed cors methods
NumJobs int `mapstructure:"n_jobs" validate:"gt=0"` // number of working jobs
MetaTimeout time.Duration `mapstructure:"meta_timeout" validate:"gt=0"` // cluster meta timeout (second)
DashboardUserName string `mapstructure:"dashboard_user_name"` // dashboard user name
DashboardPassword string `mapstructure:"dashboard_password"` // dashboard password
DashboardAuthServer string `mapstructure:"dashboard_auth_server"` // dashboard auth server
DashboardRedacted bool `mapstructure:"dashboard_redacted"`
AdminAPIKey string `mapstructure:"admin_api_key"`
}
MasterConfig is the configuration for the master.
type NeighborsConfig ¶ added in v0.4.0
type NeighborsConfig struct {
NeighborType string `mapstructure:"neighbor_type" validate:"oneof=auto similar related ''"`
EnableIndex bool `mapstructure:"enable_index"`
IndexRecall float32 `mapstructure:"index_recall" validate:"gt=0"`
IndexFitEpoch int `mapstructure:"index_fit_epoch" validate:"gt=0"`
}
type OfflineConfig ¶ added in v0.4.0
type OfflineConfig struct {
CheckRecommendPeriod time.Duration `mapstructure:"check_recommend_period" validate:"gt=0"`
RefreshRecommendPeriod time.Duration `mapstructure:"refresh_recommend_period" validate:"gt=0"`
ExploreRecommend map[string]float64 `mapstructure:"explore_recommend"`
EnableLatestRecommend bool `mapstructure:"enable_latest_recommend"`
EnablePopularRecommend bool `mapstructure:"enable_popular_recommend"`
EnableUserBasedRecommend bool `mapstructure:"enable_user_based_recommend"`
EnableItemBasedRecommend bool `mapstructure:"enable_item_based_recommend"`
EnableColRecommend bool `mapstructure:"enable_collaborative_recommend"`
EnableClickThroughPrediction bool `mapstructure:"enable_click_through_prediction"`
// contains filtered or unexported fields
}
func (*OfflineConfig) GetExploreRecommend ¶ added in v0.4.0
func (config *OfflineConfig) GetExploreRecommend(key string) (value float64, exist bool)
func (*OfflineConfig) Lock ¶ added in v0.4.0
func (config *OfflineConfig) Lock()
func (*OfflineConfig) UnLock ¶ added in v0.4.0
func (config *OfflineConfig) UnLock()
type OnlineConfig ¶ added in v0.4.0
type PopularConfig ¶ added in v0.4.0
type RecommendConfig ¶
type RecommendConfig struct {
CacheSize int `mapstructure:"cache_size" validate:"gt=0"`
CacheExpire time.Duration `mapstructure:"cache_expire" validate:"gt=0"`
DataSource DataSourceConfig `mapstructure:"data_source"`
Popular PopularConfig `mapstructure:"popular"`
UserNeighbors NeighborsConfig `mapstructure:"user_neighbors"`
ItemNeighbors NeighborsConfig `mapstructure:"item_neighbors"`
Collaborative CollaborativeConfig `mapstructure:"collaborative"`
Replacement ReplacementConfig `mapstructure:"replacement"`
Offline OfflineConfig `mapstructure:"offline"`
Online OnlineConfig `mapstructure:"online"`
}
RecommendConfig is the configuration of recommendation setup.
type ReplacementConfig ¶ added in v0.4.0
type ServerConfig ¶
type ServerConfig struct {
APIKey string `mapstructure:"api_key"` // default number of returned items
DefaultN int `mapstructure:"default_n" validate:"gt=0"` // secret key for RESTful APIs (SSL required)
ClockError time.Duration `mapstructure:"clock_error" validate:"gte=0"` // clock error in the cluster in seconds
AutoInsertUser bool `mapstructure:"auto_insert_user"` // insert new users while inserting feedback
AutoInsertItem bool `mapstructure:"auto_insert_item"` // insert new items while inserting feedback
CacheExpire time.Duration `mapstructure:"cache_expire" validate:"gt=0"` // server-side cache expire time
}
ServerConfig is the configuration for the server.
type Settings ¶ added in v0.4.4
type Settings struct {
Config *Config
// database clients
CacheClient cache.Database
DataClient data.Database
// recommendation models
RankingModel ranking.MatrixFactorization
RankingModelVersion int64
ClickModel click.FactorizationMachine
ClickModelVersion int64
}
func NewSettings ¶ added in v0.4.4
func NewSettings() *Settings
type TracingConfig ¶ added in v0.4.9
type TracingConfig struct {
EnableTracing bool `mapstructure:"enable_tracing"`
Exporter string `mapstructure:"exporter" validate:"oneof=jaeger zipkin otlp otlphttp"`
CollectorEndpoint string `mapstructure:"collector_endpoint"`
Sampler string `mapstructure:"sampler"`
Ratio float64 `mapstructure:"ratio"`
}
func (*TracingConfig) Equal ¶ added in v0.4.9
func (config *TracingConfig) Equal(other TracingConfig) bool
func (*TracingConfig) NewTracerProvider ¶ added in v0.4.9
func (config *TracingConfig) NewTracerProvider() (trace.TracerProvider, error)
Click to show internal directories.
Click to hide internal directories.