master

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RankingTop10NDCG      = "NDCG@10"
	RankingTop10Precision = "Precision@10"
	RankingTop10Recall    = "Recall@10"
	ClickPrecision        = "Precision"
	ClickThroughRate      = "ClickThroughRate"
	ActiveUsersYesterday  = "ActiveUsersYesterday"
	ActiveUsersMonthly    = "ActiveUsersMonthly"
)
View Source
const (
	ServerNode = "Server"
	WorkerNode = "Worker"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Feedback

type Feedback struct {
	FeedbackType string
	UserId       string
	Item         data.Item
	Timestamp    time.Time
	Comment      string
}

type LocalCache

type LocalCache struct {
	RankingModelName    string
	RankingModelVersion int64
	RankingModel        ranking.Model
	RankingModelScore   ranking.Score
	UserIndexVersion    int64
	UserIndex           base.Index
	ClickModelVersion   int64
	ClickModelScore     click.Score
	ClickModel          click.FactorizationMachine
	// contains filtered or unexported fields
}

LocalCache is local cache for the master node.

func LoadLocalCache

func LoadLocalCache(path string) (*LocalCache, error)

LoadLocalCache loads local cache from a file. If the ranking model is invalid, RankingModel == nil. If the click model is invalid, ClickModel == nil.

func (*LocalCache) WriteLocalCache

func (c *LocalCache) WriteLocalCache() error

WriteLocalCache writes local cache to a file.

type Master

type Master struct {
	protocol.UnimplementedMasterServer
	server.RestServer
	// contains filtered or unexported fields
}

Master is the master node.

func NewMaster

func NewMaster(cfg *config.Config) *Master

NewMaster creates a master node.

func (*Master) AnalyzeLoop added in v0.2.1

func (m *Master) AnalyzeLoop()

func (*Master) CreateWebService

func (m *Master) CreateWebService()

func (*Master) FitLoop

func (m *Master) FitLoop()

func (*Master) GetClickModel added in v0.2.2

func (m *Master) GetClickModel(context.Context, *protocol.NodeInfo) (*protocol.Model, error)

GetClickModel returns latest click model.

func (*Master) GetMeta

func (m *Master) GetMeta(ctx context.Context, nodeInfo *protocol.NodeInfo) (*protocol.Meta, error)

GetMeta returns latest configuration.

func (*Master) GetRankingModel

func (m *Master) GetRankingModel(context.Context, *protocol.NodeInfo) (*protocol.Model, error)

GetRankingModel returns latest ranking model.

func (*Master) GetUserIndex

func (m *Master) GetUserIndex(context.Context, *protocol.NodeInfo) (*protocol.UserIndex, error)

GetUserIndex returns latest user index.

func (*Master) SearchLoop

func (m *Master) SearchLoop()

SearchLoop searches optimal recommendation model in background. It never modifies variables other than rankingModelSearcher, clickSearchedModel and clickSearchedScore.

func (*Master) Serve

func (m *Master) Serve()

Serve starts the master node.

func (*Master) StartHttpServer

func (m *Master) StartHttpServer()

type Node

type Node struct {
	Name     string
	Type     string
	IP       string
	HttpPort int64
}

Node could be worker node for server node.

func NewNode

func NewNode(ctx context.Context, nodeInfo *protocol.NodeInfo) *Node

NewNode creates a node from Context and NodeInfo.

type SinglePageAppFileSystem

type SinglePageAppFileSystem struct {
	// contains filtered or unexported fields
}

SinglePageAppFileSystem is the file system for single page app.

func (*SinglePageAppFileSystem) Open

func (fs *SinglePageAppFileSystem) Open(name string) (http.File, error)

Open index.html if required file not exists.

type Status

type Status struct {
	NumUsers       string
	NumItems       string
	NumPosFeedback string
	RankingScore   float32
	ClickScore     float32
}

type User

type User struct {
	data.User
	LastActiveTime string
	LastUpdateTime string
}

type UserIterator

type UserIterator struct {
	Cursor string
	Users  []User
}

Jump to

Keyboard shortcuts

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