costforecast

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package costforecast provides cost forecasting capabilities for TokMan

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedForecast

type AggregatedForecast struct {
	DailyAverage     float64
	MonthlyTotal     float64
	YearlyProjection float64
	GrowthRate       float64
	Seasonality      SeasonalityPattern
	RiskLevel        RiskLevel
}

AggregatedForecast combines all forecasts

type Config

type Config struct {
	DefaultHorizon    time.Duration
	ConfidenceLevel   float64
	SeasonalityWindow int
	MinDataPoints     int
}

Config holds forecaster configuration

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns default configuration

type DataPoint

type DataPoint struct {
	Timestamp time.Time
	Value     float64
	Metadata  map[string]string
}

DataPoint represents a historical data point

type ExponentialSmoothingModel

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

ExponentialSmoothingModel uses exponential smoothing

func (*ExponentialSmoothingModel) Name

func (*ExponentialSmoothingModel) Predict

func (m *ExponentialSmoothingModel) Predict(historical []DataPoint, horizon int) (Prediction, error)

func (*ExponentialSmoothingModel) Weight

func (m *ExponentialSmoothingModel) Weight() float64

type ForecastReport

type ForecastReport struct {
	GeneratedAt      time.Time
	Horizon          time.Duration
	Forecasts        map[string]Prediction
	EnsembleForecast Prediction
	Aggregated       AggregatedForecast
	Recommendations  []Recommendation
}

ForecastReport contains comprehensive forecast results

type Forecaster

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

Forecaster predicts future costs based on historical data

func NewForecaster

func NewForecaster(config Config) *Forecaster

NewForecaster creates a cost forecaster

func (*Forecaster) Forecast

func (f *Forecaster) Forecast(historical []DataPoint, horizon time.Duration) (*ForecastReport, error)

Forecast generates a cost forecast

type LinearRegressionModel

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

LinearRegressionModel uses simple linear regression

func (*LinearRegressionModel) Name

func (m *LinearRegressionModel) Name() string

func (*LinearRegressionModel) Predict

func (m *LinearRegressionModel) Predict(historical []DataPoint, horizon int) (Prediction, error)

func (*LinearRegressionModel) Weight

func (m *LinearRegressionModel) Weight() float64

type Model

type Model interface {
	Name() string
	Predict(historical []DataPoint, horizon int) (Prediction, error)
	Weight() float64
}

Model defines a forecasting model interface

type MovingAverageModel

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

MovingAverageModel uses moving average

func (*MovingAverageModel) Name

func (m *MovingAverageModel) Name() string

func (*MovingAverageModel) Predict

func (m *MovingAverageModel) Predict(historical []DataPoint, horizon int) (Prediction, error)

func (*MovingAverageModel) Weight

func (m *MovingAverageModel) Weight() float64

type Prediction

type Prediction struct {
	Model         string
	Horizon       int
	PointForecast []float64
	LowerBound    []float64
	UpperBound    []float64
	Confidence    float64
	Accuracy      float64
	Trend         TrendDirection
}

Prediction holds forecast results

type Recommendation

type Recommendation struct {
	Type        string
	Priority    int
	Title       string
	Description string
	Impact      float64
	Action      string
}

Recommendation provides actionable insights

type RiskLevel

type RiskLevel string

RiskLevel indicates forecast risk

const (
	RiskLow      RiskLevel = "low"
	RiskMedium   RiskLevel = "medium"
	RiskHigh     RiskLevel = "high"
	RiskCritical RiskLevel = "critical"
)

type SeasonalDecompositionModel

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

SeasonalDecompositionModel detects and uses seasonality

func (*SeasonalDecompositionModel) Name

func (*SeasonalDecompositionModel) Predict

func (m *SeasonalDecompositionModel) Predict(historical []DataPoint, horizon int) (Prediction, error)

func (*SeasonalDecompositionModel) Weight

func (m *SeasonalDecompositionModel) Weight() float64

type SeasonalityPattern

type SeasonalityPattern struct {
	HasSeasonality bool
	Period         time.Duration
	PeakDays       []time.Weekday
	LowDays        []time.Weekday
	Strength       float64
}

SeasonalityPattern captures seasonal trends

type TrendDirection

type TrendDirection string

TrendDirection indicates the forecast trend

const (
	TrendUp       TrendDirection = "up"
	TrendDown     TrendDirection = "down"
	TrendStable   TrendDirection = "stable"
	TrendVolatile TrendDirection = "volatile"
)

Jump to

Keyboard shortcuts

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