Documentation
¶
Overview ¶
Package wrapper provides the functionalities for the objects being passed to oracles during evaluation.
Index ¶
- type Context
- type Record
- func (w *Record) Cosine(b *Record) float64
- func (w *Record) CosineRange(b *Record, start uint, end uint) float64
- func (w *Record) CosineSub(b *Record, elems uint) float64
- func (w *Record) Dot(b *Record) float64
- func (w *Record) DotRange(b *Record, start uint, end uint) float64
- func (w *Record) DotSub(b *Record, elems uint) float64
- func (w *Record) Equal(b *Record) bool
- func (w *Record) Get(index int) float32
- func (w *Record) Is(b *Record) bool
- func (w *Record) IsNull() bool
- func (w *Record) Jaccard(b *Record) float64
- func (w *Record) JaccardRange(b *Record, start uint, end uint) float64
- func (w *Record) Magnitude() float64
- func (w *Record) Meta(name string) string
- func (w *Record) SetData(data []float32)
- type Records
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
Context is a thread safe object passed to oracles during execution in order to allow them to signal an error.
type Record ¶
type Record struct {
// ID can be used to read the record identifier.
ID uint64
// Number of elements in the vector data.
Size int
// contains filtered or unexported fields
}
Record is the wrapper for a single *pb.Record object used to allow access to specific records to oracles during execution. Every oracle will have this read-only view of the dataset while being evaulated.
func WrapRecord ¶
WrapRecord creates a Record wrapper around a raw *pb.Record object.
func (*Record) CosineRange ¶ added in v1.1.0
CosineRange returns the cosine similarity between a vector and another within a range of elements.
func (*Record) CosineSub ¶
CosineSub returns the cosine similarity between a vector and another using up until the specificed number of elements.
func (*Record) DotRange ¶ added in v1.1.0
DotRange performs the dot product between a vector and another using a range of elements.
func (*Record) DotSub ¶
DotSub performs the dot product between a vector and another using up until the specificed number of elements.
func (*Record) Equal ¶ added in v1.2.0
Equal returns whether the vectors have the same size and are element-wise equal.
func (*Record) Is ¶
Is returns true if this wrapped record and another wrapped record have the same identifier, in other words if they are just two wrappers around the same *pb.Record object.
func (*Record) Jaccard ¶ added in v1.1.0
Jaccard returns the Jaccard distance between a vector and another.
func (*Record) JaccardRange ¶ added in v1.1.0
JaccardRange returns the Jaccard distance between a vector and another within a range of elements.
type Records ¶
type Records struct {
// contains filtered or unexported fields
}
Records is an object that wraps *storage.Records in order to give access to those records to oracles during execution.
func WrapRecords ¶
WrapRecords creates a Records wrapper around a *storage.Records object.
func (Records) AllBut ¶
AllBut returns a wrapped list of records in the current storage but the one specified.
func (Records) CreateRecord ¶ added in v1.1.0
CreateRecord creates a new record from raw data.