feature

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChangepointCompBias  = "bias"
	ChangepointCompSlope = "slope"
)
View Source
const (
	FourierCompSin = "sin"
	FourierCompCos = "cos"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Changepoint

type Changepoint struct {
	Name            string          `json:"name"`
	ChangepointComp ChangepointComp `json:"changepoint_component"`
}

Changepoint feature representing a point in time that we expect a jump or trend change in the training time series. The component is either of type bias (jump) or slope (trend).

func NewChangepoint

func NewChangepoint(name string, comp ChangepointComp) *Changepoint

NewChangepoint creates a new changepoint instance given a name and changepoint component type

func (Changepoint) Decode

func (c Changepoint) Decode() map[string]string

Decode converts the feature into a map of label values

func (Changepoint) Get

func (c Changepoint) Get(label string) (string, bool)

Get returns the value of an arbitrary label annd returns the value along with whether the label exists

func (Changepoint) String

func (c Changepoint) String() string

String returns the string representation of the changepoint feature

func (Changepoint) Type

func (c Changepoint) Type() FeatureType

Type returns the type of this feature

func (*Changepoint) UnmarshalJSON

func (c *Changepoint) UnmarshalJSON(data []byte) error

UnmarshalJSON is the custom unmarshalling to convert a map[string]string to a changepoint feature

type ChangepointComp

type ChangepointComp string

type Feature

type Feature interface {
	// String returns the string representation of the feature
	String() string

	// Get returns the value of an arbitrary label and returns the value along with whether
	// the label exists
	Get(string) (string, bool)

	// Type returns the type of this feature
	Type() FeatureType

	// Decode converts the feature into a map of label values
	Decode() map[string]string

	// UnmarshalJSON is the custom unmarshalling to convert a map[string]string
	// to a feature
	UnmarshalJSON([]byte) error
}

Feature is an interface representing a type of feature e.g. changepoint, seasonality, or time

type FeatureType

type FeatureType string
const (
	FeatureTypeChangepoint FeatureType = "changepoint"
	FeatureTypeSeasonality FeatureType = "seasonality"
	FeatureTypeTime        FeatureType = "time"
)

type FourierComp

type FourierComp string

type Seasonality

type Seasonality struct {
	Name        string      `json:"name"`
	FourierComp FourierComp `json:"fourier_component"`
	Order       int         `json:"order"`
}

Seasonality feature representing a single seasonality component. A seasonality component consists of a name, component (sin or cos), and order (fourier order).

func NewSeasonality

func NewSeasonality(name string, fcomp FourierComp, order int) *Seasonality

NewSeasonality creates a new seasonality feature instance givenn a name, sin/cos component, and Fourier order

func (Seasonality) Decode

func (s Seasonality) Decode() map[string]string

Decode converts the feature innto a map of label values

func (Seasonality) Get

func (s Seasonality) Get(label string) (string, bool)

Get returns the value of an arbitrary label and returns the value along with whether the label exists

func (Seasonality) String

func (s Seasonality) String() string

String returns the string representation of the seasonality feature

func (Seasonality) Type

func (s Seasonality) Type() FeatureType

Type returns the type of this feature

func (*Seasonality) UnmarshalJSON

func (s *Seasonality) UnmarshalJSON(data []byte) error

UnmarshalJSON is the custom unmarshalling to convert a map[string]string to a seasonality feature

type Set added in v0.1.0

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

Set represents a mapping to each feature data keyed by the string representation of the feature.

func NewSet added in v0.2.0

func NewSet() *Set

func (*Set) Del added in v0.2.0

func (s *Set) Del(f Feature)

func (*Set) Get added in v0.2.0

func (s *Set) Get(f Feature) ([]float64, bool)

func (*Set) Labels added in v0.1.0

func (s *Set) Labels() []Feature

Labels returns the sorted slice of all tracked features in the FeatureSet

func (*Set) Len added in v0.2.0

func (s *Set) Len() int

func (*Set) Matrix added in v0.1.0

func (s *Set) Matrix(intercept bool) *mat.Dense

Matrix returns a metric representation of the FeatureSet to be used with matrix methods The matrix has m rows representing the number of observations and n columns representing the number of features.

func (*Set) Set added in v0.2.0

func (s *Set) Set(f Feature, data []float64)

func (*Set) Update added in v0.2.0

func (s *Set) Update(other *Set)

type Time

type Time struct {
	Name string `json:"name"`
}

Time feature representing a time based feature e.g. hour of day.

func NewTime

func NewTime(name string) *Time

NewTime creataes aa new time instance given a name

func (Time) Decode

func (t Time) Decode() map[string]string

Decode converts the feature into a map of label values

func (Time) Get

func (t Time) Get(label string) (string, bool)

Get returns the value of an arbitrary label annd returns the value along with whether the label exists

func (Time) String

func (t Time) String() string

String returns the string representationf of the time feature

func (Time) Type

func (t Time) Type() FeatureType

Type returns the type of this feature

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON is the custom unmarshalling to convert a map[string]string to a time feature

Jump to

Keyboard shortcuts

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