stats

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IdempotentID added in v0.0.2

func IdempotentID(created time.Time, query string) string

Types

type BestMatches added in v0.0.2

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

func NewBestMatches added in v0.0.2

func NewBestMatches(size int) *BestMatches

func (*BestMatches) At added in v0.0.2

func (bm *BestMatches) At(idx int) MatchItem

func (*BestMatches) AvgBenchTime added in v0.0.2

func (bm *BestMatches) AvgBenchTime() float64

func (*BestMatches) Items added in v0.0.2

func (bm *BestMatches) Items() []MatchItem

func (*BestMatches) Print added in v0.0.2

func (bm *BestMatches) Print()

func (*BestMatches) SmartBenchTime added in v0.0.2

func (bm *BestMatches) SmartBenchTime() float64

func (*BestMatches) TryAdd added in v0.0.2

func (bm *BestMatches) TryAdd(rec *DBRecord, dist int) bool

func (*BestMatches) WorstBenchTime added in v0.0.2

func (bm *BestMatches) WorstBenchTime() float64

type DBRecord added in v0.0.2

type DBRecord struct {

	// ID is a idempotent identifier derived from other attributes
	// (typically date and query).
	// Please note that the value should not be derived just from
	// the query because we want some variance with repeated queries.
	// (with a single query try, the result can be affected by (bad)luck).
	ID string

	// Datetime specifies date and time when the record was imported
	// (i.e. not benchmarked)
	Datetime int64

	// Query contains the original version of imported query
	Query string

	// QueryNormalized contains the original version of imported query
	QueryNormalized string

	// Corpname is the original corpus query was run with
	Corpname string

	// ProcTime is a procTime reported by KonText in its log.
	// Please note that this time cannot be reliably used to measure
	// queries complexity as most KonText queries run in an async.
	// mode and the query_submit response may occur even if there are
	// no data yet.
	// We store this for further analysis - e.g. if there is at least
	// some correlation between those times and benchmark times.
	ProcTime float64

	// BenchTime is a time of a query measured in a controlled environment.
	// This means running it on MQuery on a computer not doing much other
	// work.
	BenchTime float64

	// TrainingExclude excluded the record from training. Typically, this
	// is for additional validation of the model.
	TrainingExclude bool
}

type Database

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

func NewDatabase

func NewDatabase(path string) (*Database, error)

func (*Database) AddBenchmarkResult added in v0.0.2

func (database *Database) AddBenchmarkResult(id string, dur time.Duration) error

func (*Database) AddRecord

func (database *Database) AddRecord(rec DBRecord) (int64, error)

func (*Database) CommitTx added in v0.0.2

func (database *Database) CommitTx() error

func (*Database) CreateNewTraining added in v0.0.2

func (database *Database) CreateNewTraining(threshold float64) (int, error)

func (*Database) GetAllRecords added in v0.0.2

func (database *Database) GetAllRecords(filter ListFilter) ([]DBRecord, error)

GetAllRecords loads stats records containing imported queries with their benchmark times (if already benchmarked).

func (*Database) GetCorpusSize added in v0.0.2

func (database *Database) GetCorpusSize(corpname string) int

func (*Database) GetCzechBenchmarkedRecords added in v0.0.2

func (database *Database) GetCzechBenchmarkedRecords() ([]DBRecord, error)

func (*Database) GetLatestTrainingID added in v0.0.2

func (database *Database) GetLatestTrainingID() (int, error)

func (*Database) GetQueryAvgBenchTime added in v0.0.2

func (database *Database) GetQueryAvgBenchTime(q string) (float64, error)

func (*Database) GetTrainingData added in v0.0.2

func (database *Database) GetTrainingData(trainingId int) ([]DBRecord, error)

func (*Database) GetTrainingThreshold added in v0.0.2

func (database *Database) GetTrainingThreshold(trainingId int) (float64, error)

func (*Database) GetTrainingValidationData added in v0.0.2

func (database *Database) GetTrainingValidationData(trainingID int) ([]TrainingResult, error)

func (*Database) ImportCorpusSizesFromCSV added in v0.0.2

func (database *Database) ImportCorpusSizesFromCSV(path string) error

func (*Database) Init

func (database *Database) Init() error

func (*Database) MixBiasedTrainingList added in v0.0.2

func (database *Database) MixBiasedTrainingList(
	threshold float64,
	ratioOfTrues float64,
	syn2020Compat bool,
) ([]DBRecord, error)

func (*Database) RollbackTx added in v0.0.2

func (database *Database) RollbackTx() error

func (*Database) SetTrainingQuery added in v0.0.2

func (database *Database) SetTrainingQuery(training_id int, qid string) error

func (*Database) SetValidationQuery added in v0.0.2

func (database *Database) SetValidationQuery(training_id int, qid string, result bool) error

func (*Database) StartTx added in v0.0.2

func (database *Database) StartTx() error

func (*Database) UpdateRecord added in v0.0.2

func (database *Database) UpdateRecord(rec DBRecord) error

type ListFilter added in v0.0.2

type ListFilter struct {
	Benchmarked         *bool
	TrainingExcluded    *bool
	WithNormalizedQuery *bool
	AnyCorpus           *bool
}

func (ListFilter) SetAnyCorpus added in v0.0.2

func (filter ListFilter) SetAnyCorpus(v bool) ListFilter

func (ListFilter) SetBenchmarked added in v0.0.2

func (filter ListFilter) SetBenchmarked(v bool) ListFilter

func (ListFilter) SetTrainingExcluded added in v0.0.2

func (filter ListFilter) SetTrainingExcluded(v bool) ListFilter

func (ListFilter) SetWithNormalizedQuery added in v0.0.2

func (filter ListFilter) SetWithNormalizedQuery(v bool) ListFilter

type MatchItem added in v0.0.2

type MatchItem struct {
	Record   *DBRecord
	Distance int
}

type TrainingResult added in v0.0.2

type TrainingResult struct {
	IsValidation bool
	Prediction   int
	Truth        int
	BenchTime    float64
	Query        string
	QueryID      string
}

Jump to

Keyboard shortcuts

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