ml

package
v0.0.0-...-2f6b29f Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEstimator

type BaseEstimator interface {
	SetParams(params map[string]interface{})
	Predict(userID, channelID string) (float64, error)
	Fit(activities map[string]map[string]int64)
}

BaseEstimator determines interface for all estimators for user-channel suggestions

func NewSimpleKNN

func NewSimpleKNN(params map[string]interface{}) BaseEstimator

NewSimpleKNN returns Simple KNN Estimator

type Item

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

An Item is something we manage in a max heap.

type MaxHeapK

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

A MaxHeapK implements heap.Interface and holds k Items with highest priority

func NewMaxHeapK

func NewMaxHeapK(k int) *MaxHeapK

NewMaxHeapK returns a brand new max heap with capacity k

func (*MaxHeapK) Add

func (pq *MaxHeapK) Add(x interface{})

Add method adds element into the PQ

func (MaxHeapK) Len

func (pq MaxHeapK) Len() int

func (MaxHeapK) Less

func (pq MaxHeapK) Less(i, j int) bool

func (*MaxHeapK) Pop

func (pq *MaxHeapK) Pop() interface{}

Pop method pops item of hightest priority from the PQ

func (*MaxHeapK) Push

func (pq *MaxHeapK) Push(x interface{})

Push method pushes an item into the PQ

func (MaxHeapK) Swap

func (pq MaxHeapK) Swap(i, j int)

type SimpleKNN

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

SimpleKNN struct

func (*SimpleKNN) Fit

func (knn *SimpleKNN) Fit(activities map[string]map[string]int64)

Fit the KNN estimator

func (*SimpleKNN) Predict

func (knn *SimpleKNN) Predict(userID, channelID string) (float64, error)

Predict the activity of channel channelID for userID

func (*SimpleKNN) SetParams

func (knn *SimpleKNN) SetParams(params map[string]interface{})

SetParams sets parameters for KNN estimator

Jump to

Keyboard shortcuts

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