featurevector

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_SIZE int = 10

Variables

This section is empty.

Functions

func MakeDenseStore

func MakeDenseStore() interface{}

func MakeMapStore

func MakeMapStore() interface{}

func MakeScoredStore

func MakeScoredStore(dense bool) interface{}

Types

type ArrayStore

type ArrayStore struct {
	Generation int
	Data       []int64
	DataArray  []int64
	// contains filtered or unexported fields
}

func (*ArrayStore) Clear

func (s *ArrayStore) Clear()

func (*ArrayStore) Get

func (s *ArrayStore) Get(transition int) (int64, bool)

func (*ArrayStore) Inc

func (s *ArrayStore) Inc(transition int, score int64)

func (*ArrayStore) IncAll

func (s *ArrayStore) IncAll(store TransitionScoreStore, integrated bool)

func (*ArrayStore) Init

func (s *ArrayStore) Init()

func (*ArrayStore) Len

func (s *ArrayStore) Len() int

func (*ArrayStore) Set

func (s *ArrayStore) Set(transition int, score int64)

func (*ArrayStore) SetTransitions

func (s *ArrayStore) SetTransitions(transitions []int)

type AvgSparse

type AvgSparse struct {
	sync.RWMutex
	Dense bool
	Vals  map[Feature]TransitionScoreStore
}

func MakeAvgSparse

func MakeAvgSparse(dense bool) *AvgSparse

func NewAvgSparse

func NewAvgSparse() *AvgSparse

func (*AvgSparse) Add

func (v *AvgSparse) Add(generation, transition int, feature interface{}, amount int64, wg *sync.WaitGroup)

func (*AvgSparse) Deserialize

func (v *AvgSparse) Deserialize(serialized interface{}, generation int)

func (*AvgSparse) Integrate

func (v *AvgSparse) Integrate(generation int) *AvgSparse

func (*AvgSparse) Serialize

func (v *AvgSparse) Serialize(generation int) interface{}

func (*AvgSparse) SetScores

func (v *AvgSparse) SetScores(feature Feature, scores ScoredStore, integrated bool)

func (*AvgSparse) String

func (v *AvgSparse) String() string

func (*AvgSparse) UpdateScalarDivide

func (v *AvgSparse) UpdateScalarDivide(byValue int64) *AvgSparse

func (*AvgSparse) Value

func (v *AvgSparse) Value(transition int, feature interface{}) int64

type Feature

type Feature interface{}

type FeatureTransMap

type FeatureTransMap map[Feature]map[int]bool

type HistoryValue

type HistoryValue struct {
	sync.Mutex
	Generation     int
	PrevGeneration int
	Value, Total   int64
}

func NewHistoryValue

func NewHistoryValue(generation int, value int64) *HistoryValue

func (*HistoryValue) Add

func (h *HistoryValue) Add(generation int, amount int64)

func (*HistoryValue) Integrate

func (h *HistoryValue) Integrate(generation int)

func (*HistoryValue) IntegratedValue

func (h *HistoryValue) IntegratedValue(generation int) int64

type HybridStore

type HybridStore struct {
	ArrayStore
	MapStore
	// contains filtered or unexported fields
}

func (*HybridStore) Clear

func (s *HybridStore) Clear()

func (*HybridStore) Get

func (s *HybridStore) Get(transition int) (int64, bool)

func (*HybridStore) Inc

func (s *HybridStore) Inc(transition int, score int64)

func (*HybridStore) IncAll

func (s *HybridStore) IncAll(store TransitionScoreStore, integrated bool)

func (*HybridStore) Init

func (s *HybridStore) Init()

func (*HybridStore) Len

func (s *HybridStore) Len() int

func (*HybridStore) Set

func (s *HybridStore) Set(transition int, score int64)

func (*HybridStore) SetTransitions

func (s *HybridStore) SetTransitions(transitions []int)

type LockedArray

type LockedArray struct {
	sync.RWMutex
	Vals []*HistoryValue
}

func (*LockedArray) Add

func (l *LockedArray) Add(generation, transition int, feature interface{}, amount int64)

func (*LockedArray) Each

func (*LockedArray) ExtendFor

func (l *LockedArray) ExtendFor(generation, transition int)

func (*LockedArray) GetValue

func (l *LockedArray) GetValue(key int) *HistoryValue

func (*LockedArray) Integrate

func (l *LockedArray) Integrate(generation int)

func (*LockedArray) Len

func (l *LockedArray) Len() int

func (*LockedArray) SetValue

func (l *LockedArray) SetValue(key int, value *HistoryValue)

type LockedMap

type LockedMap struct {
	sync.RWMutex
	Vals map[int]*HistoryValue
}

func (*LockedMap) Add

func (l *LockedMap) Add(generation, transition int, feature interface{}, amount int64)

func (*LockedMap) Each

func (l *LockedMap) Each(f TransitionScoreKVFunc)

func (*LockedMap) GetValue

func (l *LockedMap) GetValue(key int) *HistoryValue

func (*LockedMap) Integrate

func (l *LockedMap) Integrate(generation int)

func (*LockedMap) Len

func (l *LockedMap) Len() int

func (*LockedMap) SetValue

func (l *LockedMap) SetValue(key int, value *HistoryValue)

type MapStore

type MapStore struct {
	Generation int
	// contains filtered or unexported fields
}

func (*MapStore) Clear

func (s *MapStore) Clear()

func (*MapStore) Get

func (s *MapStore) Get(transition int) (int64, bool)

func (*MapStore) Inc

func (s *MapStore) Inc(transition int, score int64)

func (*MapStore) IncAll

func (s *MapStore) IncAll(store TransitionScoreStore, integrated bool)

func (*MapStore) Init

func (s *MapStore) Init()

func (*MapStore) Len

func (s *MapStore) Len() int

func (*MapStore) ScoreMap

func (s *MapStore) ScoreMap() map[int]int64

func (*MapStore) Set

func (s *MapStore) Set(transition int, score int64)

func (*MapStore) SetTransitions

func (s *MapStore) SetTransitions(transitions []int)

type ScoredStore

type ScoredStore interface {
	Get(transition int) (int64, bool)
	Set(transition int, score int64)
	SetTransitions(transitions []int)
	IncAll(store TransitionScoreStore, integrated bool)
	Inc(transition int, score int64)
	Len() int
	Clear()
	Init()
}

type SimpleTAF

type SimpleTAF struct {
	FTMap FeatureTransMap
}

func (*SimpleTAF) GetTransFeatures

func (s *SimpleTAF) GetTransFeatures() FeatureTransMap

type Sparse

type Sparse map[Feature]int64

func NewSparse

func NewSparse() Sparse

func NewVectorOfOnesFromFeatures

func NewVectorOfOnesFromFeatures(f []Feature) Sparse

func (Sparse) Add

func (v Sparse) Add(other Sparse) Sparse

func (Sparse) Copy

func (v Sparse) Copy() Sparse

func (Sparse) DotProduct

func (v Sparse) DotProduct(other Sparse) int64

func (Sparse) DotProductFeatures

func (v Sparse) DotProductFeatures(f []Feature) int64

func (Sparse) FeatureWeights

func (v Sparse) FeatureWeights(f []Feature) Sparse

func (Sparse) L1Norm

func (v Sparse) L1Norm() int64

func (Sparse) String

func (v Sparse) String() string

func (Sparse) Subtract

func (v Sparse) Subtract(other Sparse) Sparse

func (Sparse) UpdateAdd

func (v Sparse) UpdateAdd(other Sparse) Sparse

func (Sparse) UpdateScalarDivide

func (v Sparse) UpdateScalarDivide(byValue int64) Sparse

func (Sparse) UpdateSubtract

func (v Sparse) UpdateSubtract(other Sparse) Sparse

func (Sparse) Weighted

func (v Sparse) Weighted(other Sparse) Sparse

type TAF

type TAF interface {
	GetTransFeatures() FeatureTransMap
}

type TransitionScoreKVFunc

type TransitionScoreKVFunc func(key int, value *HistoryValue)

type TransitionScoreStore

type TransitionScoreStore interface {
	Add(generation, transition int, feature interface{}, amount int64)
	Integrate(generation int)
	Len() int
	SetValue(key int, value *HistoryValue)
	GetValue(key int) *HistoryValue
	Each(f TransitionScoreKVFunc)
}

Jump to

Keyboard shortcuts

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