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 ¶
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"` 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"` }
Config is the configuration for the engine.
func LoadConfig ¶
LoadConfig loads configuration from toml file.
func (*Config) OfflineRecommendDigest ¶
func (config *Config) OfflineRecommendDigest(option ...DigestOption) string
type DataSourceConfig ¶
type DataSourceConfig struct { PositiveFeedbackTypes []string `mapstructure:"positive_feedback_types" validate:"min=1,dive,required"` // positive feedback type ReadFeedbackTypes []string `mapstructure:"read_feedback_types" validate:"min=1,dive,required"` // 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 }
DatabaseConfig is the configuration for the database.
type DigestOption ¶
type DigestOption func(option *digestOptions)
func WithCollaborative ¶
func WithCollaborative(v bool) DigestOption
func WithItemNeighborDigest ¶
func WithItemNeighborDigest(digest string) DigestOption
func WithRanking ¶
func WithRanking(v bool) DigestOption
func WithUserNeighborDigest ¶
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 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 }
MasterConfig is the configuration for the master.
type NeighborsConfig ¶
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 ¶
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 ¶
func (config *OfflineConfig) GetExploreRecommend(key string) (value float64, exist bool)
func (*OfflineConfig) Lock ¶
func (config *OfflineConfig) Lock()
func (*OfflineConfig) UnLock ¶
func (config *OfflineConfig) UnLock()
type OnlineConfig ¶
type PopularConfig ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.