classification

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeKNN        = "knn"
	TypeContextual = "text2vec-contextionary-contextual"
	TypeZeroShot   = "zeroshot"
)
View Source
const TransactionPut cluster.TransactionType = "put_single"

Variables

This section is empty.

Functions

func UnmarshalTransaction

func UnmarshalTransaction(txType cluster.TransactionType,
	payload json.RawMessage,
) (interface{}, error)

Types

type Classifier

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

func New

func New(sg schemaUC.SchemaGetter, cr Repo, vr vectorRepo, authorizer authorizer,
	logger logrus.FieldLogger, modulesProvider ModulesProvider,
) *Classifier

func (*Classifier) Get

func (c *Classifier) Get(ctx context.Context, principal *models.Principal, id strfmt.UUID) (*models.Classification, error)

func (*Classifier) Schedule

func (c *Classifier) Schedule(ctx context.Context, principal *models.Principal, params models.Classification) (*models.Classification, error)

type ClassifyItemFn

type ClassifyItemFn func(item search.Result, itemIndex int,
	params models.Classification, filters Filters, writer Writer) error

type Filters

type Filters interface {
	Source() *libfilters.LocalFilter
	Target() *libfilters.LocalFilter
	TrainingSet() *libfilters.LocalFilter
}

type ModulesProvider

type ModulesProvider interface {
	ParseClassifierSettings(name string,
		params *models.Classification) error
	GetClassificationFn(className, name string,
		params modulecapabilities.ClassifyParams) (modulecapabilities.ClassifyItemFn, error)
}

type NeighborRef

type NeighborRef struct {
	// Property indicates which property was aggregated
	Property string

	// The beacon of the most common (kNN) reference
	Beacon strfmt.URI

	OverallCount int
	WinningCount int
	LosingCount  int

	Distances NeighborRefDistances
}

NeighborRef is the result of an aggregation of the ref properties of k neighbors

func (NeighborRef) Meta

type NeighborRefDistances

type NeighborRefDistances struct {
	ClosestOverallDistance float32

	// Winning
	ClosestWinningDistance float32
	MeanWinningDistance    float32

	// Losing (optional)
	MeanLosingDistance    *float32
	ClosestLosingDistance *float32
}

NeighborRefDistances include various distances about the winning and losing groups (knn)

type ParamsKNN

type ParamsKNN struct {
	K *int32 `json:"k"`
}

func (*ParamsKNN) SetDefaults

func (params *ParamsKNN) SetDefaults()

type Repo

type Repo interface {
	Put(ctx context.Context, classification models.Classification) error
	Get(ctx context.Context, id strfmt.UUID) (*models.Classification, error)
}

Repo to manage classification state, should be consistent, not used to store actual data object vectors, see VectorRepo

type TransactionPutPayload

type TransactionPutPayload struct {
	Classification models.Classification `json:"classification"`
}

type Validator

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

func NewValidator

func NewValidator(sg schemaUC.SchemaGetter, subject models.Classification) *Validator

func (*Validator) Do

func (v *Validator) Do() error

type VectorRepo

type VectorRepo interface {
	GetUnclassified(ctx context.Context, class string,
		properties []string, filter *libfilters.LocalFilter) ([]search.Result, error)
	AggregateNeighbors(ctx context.Context, vector []float32,
		class string, properties []string, k int,
		filter *libfilters.LocalFilter) ([]NeighborRef, error)
	VectorSearch(ctx context.Context, params dto.GetParams) ([]search.Result, error)
	ZeroShotSearch(ctx context.Context, vector []float32,
		class string, properties []string,
		filter *libfilters.LocalFilter) ([]search.Result, error)
}

type Writer

type Writer interface {
	Start()
	Store(item search.Result) error
	Stop() WriterResults
}

type WriterResults

type WriterResults interface {
	SuccessCount() int64
	ErrorCount() int64
	Err() error
}

Jump to

Keyboard shortcuts

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