Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug found in model search #197

Closed
konukk opened this issue Jul 16, 2021 · 1 comment · Fixed by #198
Closed

bug found in model search #197

konukk opened this issue Jul 16, 2021 · 1 comment · Fixed by #198
Labels
bug Something isn't working

Comments

@konukk
Copy link

konukk commented Jul 16, 2021

master branch,master/master.go

// SearchLoop searches optimal recommendation model in background. It never modifies variables other than
// rankingModelSearcher, clickSearchedModel and clickSearchedScore.
func (m *Master) SearchLoop() {
	defer base.CheckPanic()
	lastNumUsers, lastNumItems, lastNumFeedback := 0, 0, 0
	for {
		var trainSet, valSet *ranking.DataSet
		// download dataset
		base.Logger().Info("load dataset for model search", zap.Strings("feedback_types", m.GorseConfig.Database.PositiveFeedbackType))
		dataSet, _, _, err := ranking.LoadDataFromDatabase(m.DataClient, m.GorseConfig.Database.PositiveFeedbackType,
			m.GorseConfig.Database.ItemTTL, m.GorseConfig.Database.PositiveFeedbackTTL)
		if err != nil {
			base.Logger().Error("failed to load database", zap.Error(err))
			goto sleep
		}
		// sleep if empty
		if dataSet.Count() == 0 {
			base.Logger().Warn("empty dataset", zap.Strings("feedback_type", m.GorseConfig.Database.PositiveFeedbackType))
			goto sleep
		}
		// sleep if nothing changed
		if dataSet.UserCount() == lastNumUsers && dataSet.ItemCount() == lastNumItems && dataSet.Count() == lastNumFeedback {
			goto sleep
		}
		// start search ranking model
		trainSet, valSet = dataSet.Split(0, 0)
		err = m.rankingModelSearcher.Fit(trainSet, valSet)
		if err != nil {
			base.Logger().Error("failed to search ranking model", zap.Error(err))
		}
		// start search click model
		err = m.searchClickModel()
		if err != nil {
			base.Logger().Error("failed to search click model", zap.Error(err))
		}
	sleep:
		time.Sleep(time.Duration(m.GorseConfig.Recommend.SearchPeriod) * time.Minute)
	}
}

lastNumUsers, lastNumItems, lastNumFeedback always zero

@zhenghaoz zhenghaoz added the bug Something isn't working label Jul 16, 2021
@zhenghaoz
Copy link
Collaborator

Thanks😁

@zhenghaoz zhenghaoz linked a pull request Jul 17, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants