Documentation
¶
Index ¶
- func LoadDataFromBuiltIn(dataSetName string) (*Dataset, *Dataset, error)
- type CFSplit
- type CTRSplit
- type Dataset
- func (d *Dataset) AddFeedback(userId, itemId string)
- func (d *Dataset) AddItem(item data.Item)
- func (d *Dataset) AddUser(user data.User)
- func (d *Dataset) CountFeedback() int
- func (d *Dataset) CountItems() int
- func (d *Dataset) CountUsers() int
- func (d *Dataset) GetCategories() []string
- func (d *Dataset) GetItemColumnValuesIDF() []float32
- func (d *Dataset) GetItemDict() *FreqDict
- func (d *Dataset) GetItemFeedback() [][]int32
- func (d *Dataset) GetItemIDF() []float32
- func (d *Dataset) GetItems() []data.Item
- func (d *Dataset) GetTimestamp() time.Time
- func (d *Dataset) GetUserColumnValuesIDF() []float32
- func (d *Dataset) GetUserDict() *FreqDict
- func (d *Dataset) GetUserFeedback() [][]int32
- func (d *Dataset) GetUserIDF() []float32
- func (d *Dataset) GetUsers() []data.User
- func (d *Dataset) SampleUserNegatives(excludeSet CFSplit, numCandidates int) [][]int32
- func (d *Dataset) SplitCF(numTestUsers int, seed int64) (CFSplit, CFSplit)
- type FreqDict
- func (d *FreqDict) Add(s string) (y int32)
- func (d *FreqDict) AddNoCount(s string) (y int32)
- func (d *FreqDict) Count() int32
- func (d *FreqDict) Freq(id int32) int32
- func (d *FreqDict) Id(s string) int32
- func (d *FreqDict) String(id int32) (s string, ok bool)
- func (d *FreqDict) ToIndex() *base.Index
- type ID
- type Labels
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CFSplit ¶
type CFSplit interface {
// CountUsers returns the number of users.
CountUsers() int
// CountItems returns the number of items.
CountItems() int
// CountFeedback returns the number of (positive) feedback.
CountFeedback() int
// GetUserDict returns the frequency dictionary of users.
GetUserDict() *FreqDict
// GetItemDict returns the frequency dictionary of items.
GetItemDict() *FreqDict
// GetUserFeedback returns the (positive) feedback of users.
GetUserFeedback() [][]int32
// GetItemFeedback returns the (positive) feedback of items.
GetItemFeedback() [][]int32
// SampleUserNegatives samples negative (feedback) for users.
SampleUserNegatives(excludeSet CFSplit, numCandidates int) [][]int32
}
CFSplit is the dataset split for collaborative filtering.
type CTRSplit ¶
type CTRSplit interface {
Count() int
CountUsers() int
CountItems() int
CountUserLabels() int
CountItemLabels() int
CountContextLabels() int
CountPositive() int
CountNegative() int
GetIndex() base.UnifiedIndex
GetTarget(i int) float32
Get(i int) ([]int32, []float32, float32)
}
CTRSplit is the dataset split for click-through rate prediction.
type Dataset ¶
type Dataset struct {
// contains filtered or unexported fields
}
func (*Dataset) AddFeedback ¶
func (*Dataset) CountFeedback ¶
func (*Dataset) CountItems ¶
func (*Dataset) CountUsers ¶
func (*Dataset) GetCategories ¶
func (*Dataset) GetItemColumnValuesIDF ¶
func (*Dataset) GetItemDict ¶
func (*Dataset) GetItemFeedback ¶
func (*Dataset) GetItemIDF ¶
GetItemIDF returns the IDF of items.
IDF(i) = log(U/freq(i))
U is the number of users. freq(i) is the frequency of item i in all feedback.
func (*Dataset) GetTimestamp ¶
func (*Dataset) GetUserColumnValuesIDF ¶
func (*Dataset) GetUserDict ¶
func (*Dataset) GetUserFeedback ¶
func (*Dataset) GetUserIDF ¶
GetUserIDF returns the IDF of users.
IDF(u) = log(I/freq(u))
I is the number of items. freq(u) is the frequency of user u in all feedback.
func (*Dataset) SampleUserNegatives ¶
type FreqDict ¶
type FreqDict struct {
// contains filtered or unexported fields
}
func NewFreqDict ¶
func NewFreqDict() (d *FreqDict)
func (*FreqDict) AddNoCount ¶
Click to show internal directories.
Click to hide internal directories.