scorer

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NameFromFilepath

func NameFromFilepath(filepath string) string

Types

type Condition

type Condition struct {
	Not         *Condition `yaml:"not"`
	FieldExists string     `yaml:"field_exists"`
}

type Config

type Config struct {
	Name   string   `yaml:"algorithm"`
	Inputs []*Input `yaml:"inputs"`
}

Config is used to specify an algorithm and its given set of Fields and Options.

This structure is used for parsing a YAML file and returning an instance of an Algorithm based on the configuration.

func LoadConfig

func LoadConfig(r io.Reader) (*Config, error)

LoadConfig will parse the YAML data from the reader and return a Config that can be used to obtain an Algorithm instance.

If the data cannot be parsed an error will be returned.

func (*Config) Algorithm

func (c *Config) Algorithm() (algorithm.Algorithm, error)

Algorithm returns an instance of Algorithm that is constructed from the Config.

nil will be returned if the algorithm cannot be returned.

type Input

type Input struct {
	Bounds       *algorithm.Bounds `yaml:"bounds"`
	Condition    *Condition        `yaml:"condition"`
	Field        string            `yaml:"field"`
	Distribution string            `yaml:"distribution"`
	Tags         []string          `yaml:"tags"`
	Weight       float64           `yaml:"weight"`
}

func (*Input) ToAlgorithmInput

func (i *Input) ToAlgorithmInput() (*algorithm.Input, error)

ToAlgorithmInput returns an instance of algorithm.Input that is constructed.

func (*Input) UnmarshalYAML

func (i *Input) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML Implements yaml.Unmarshaler interface.

type Scorer

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

func FromConfig

func FromConfig(name string, r io.Reader) (*Scorer, error)

func FromDefaultConfig

func FromDefaultConfig() *Scorer

func (*Scorer) Name

func (s *Scorer) Name() string

func (*Scorer) Score

func (s *Scorer) Score(signals []signal.Set) float64

func (*Scorer) ScoreRaw

func (s *Scorer) ScoreRaw(raw map[string]string) float64

Directories

Path Synopsis
wam
Package wam implements the Weighted Arithmetic Mean, which forms the basis of Rob Pike's criticality score algorithm as documented in Quantifying_criticality_algorithm.pdf.
Package wam implements the Weighted Arithmetic Mean, which forms the basis of Rob Pike's criticality score algorithm as documented in Quantifying_criticality_algorithm.pdf.

Jump to

Keyboard shortcuts

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