config

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NeighborTypeAuto    = "auto"
	NeighborTypeSimilar = "similar"
	NeighborTypeRelated = "related"
)

Variables

This section is empty.

Functions

This section is empty.

Types

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

func LoadConfig(path string) (*Config, error)

LoadConfig loads configuration from toml file.

func (*Config) LoadDefaultIfNil

func (config *Config) LoadDefaultIfNil() *Config

LoadDefaultIfNil loads default settings if config is nil.

type DatabaseConfig

type DatabaseConfig struct {
	DataStore            string   `mapstructure:"data_store"`              // database for data store
	CacheStore           string   `mapstructure:"cache_store"`             // database for cache store
	AutoInsertUser       bool     `mapstructure:"auto_insert_user"`        // insert new users while inserting feedback
	AutoInsertItem       bool     `mapstructure:"auto_insert_item"`        // insert new items while inserting feedback
	CacheSize            int      `mapstructure:"cache_size"`              // cache size for recommended/popular/latest items
	PositiveFeedbackType []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"`   // time-to-live of positive feedbacks
	ItemTTL              uint     `mapstructure:"item_ttl"`                // item-to-live of items
}

DatabaseConfig is the configuration for the database.

func (*DatabaseConfig) LoadDefaultIfNil

func (config *DatabaseConfig) LoadDefaultIfNil() *DatabaseConfig

LoadDefaultIfNil loads default settings if config is nil.

type MasterConfig

type MasterConfig struct {
	Port              int    `mapstructure:"port"`                // master port
	Host              string `mapstructure:"host"`                // master host
	HttpPort          int    `mapstructure:"http_port"`           // HTTP port
	HttpHost          string `mapstructure:"http_host"`           // HTTP host
	NumJobs           int    `mapstructure:"n_jobs"`              // number of working jobs
	MetaTimeout       int    `mapstructure:"meta_timeout"`        // 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.

func (*MasterConfig) LoadDefaultIfNil

func (config *MasterConfig) LoadDefaultIfNil() *MasterConfig

LoadDefaultIfNil loads default settings if config is nil.

type RecommendConfig

type RecommendConfig struct {
	PopularWindow                int                `mapstructure:"popular_window"`
	FitPeriod                    int                `mapstructure:"fit_period"`
	SearchPeriod                 int                `mapstructure:"search_period"`
	SearchEpoch                  int                `mapstructure:"search_epoch"`
	SearchTrials                 int                `mapstructure:"search_trials"`
	CheckRecommendPeriod         int                `mapstructure:"check_recommend_period"`
	RefreshRecommendPeriod       int                `mapstructure:"refresh_recommend_period"`
	FallbackRecommend            []string           `mapstructure:"fallback_recommend"`
	NumFeedbackFallbackItemBased int                `mapstructure:"num_feedback_fallback_item_based"`
	ExploreRecommend             map[string]float64 `mapstructure:"explore_recommend"`
	EnableItemNeighborIndex      bool               `mapstructure:"enable_item_neighbor_index"`
	ItemNeighborType             string             `mapstructure:"item_neighbor_type"`
	ItemNeighborIndexRecall      float32            `mapstructure:"item_neighbor_index_recall"`
	ItemNeighborIndexFitEpoch    int                `mapstructure:"item_neighbor_index_fit_epoch"`
	EnableUserNeighborIndex      bool               `mapstructure:"enable_user_neighbor_index"`
	UserNeighborType             string             `mapstructure:"user_neighbor_type"`
	UserNeighborIndexRecall      float32            `mapstructure:"user_neighbor_index_recall"`
	UserNeighborIndexFitEpoch    int                `mapstructure:"user_neighbor_index_fit_epoch"`
	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"`
	EnableColIndex               bool               `mapstructure:"enable_collaborative_index"`
	ColIndexRecall               float32            `mapstructure:"collaborative_index_recall"`
	ColIndexFitEpoch             int                `mapstructure:"collaborative_index_fit_epoch"`
	EnableClickThroughPrediction bool               `mapstructure:"enable_click_through_prediction"`
	EnableReplacement            bool               `mapstructure:"enable_replacement"`
	PositiveReplacementDecay     float64            `mapstructure:"positive_replacement_decay"`
	ReadReplacementDecay         float64            `mapstructure:"read_replacement_decay"`
	// contains filtered or unexported fields
}

RecommendConfig is the configuration of recommendation setup.

func (*RecommendConfig) GetExploreRecommend added in v0.3.1

func (config *RecommendConfig) GetExploreRecommend(key string) (value float64, exist bool)

func (*RecommendConfig) LoadDefaultIfNil

func (config *RecommendConfig) LoadDefaultIfNil() *RecommendConfig

LoadDefaultIfNil loads default settings if config is nil.

func (*RecommendConfig) Lock added in v0.3.1

func (config *RecommendConfig) Lock()

func (*RecommendConfig) UnLock added in v0.3.1

func (config *RecommendConfig) UnLock()

type ServerConfig

type ServerConfig struct {
	APIKey      string `mapstructure:"api_key"`      // default number of returned items
	DefaultN    int    `mapstructure:"default_n"`    // secret key for RESTful APIs (SSL required)
	EpsilonTime int    `mapstructure:"epsilon_time"` // clock error in the cluster in seconds
}

ServerConfig is the configuration for the server.

func (*ServerConfig) LoadDefaultIfNil

func (config *ServerConfig) LoadDefaultIfNil() *ServerConfig

LoadDefaultIfNil loads default settings if config is nil.

Jump to

Keyboard shortcuts

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