Documentation
¶
Overview ¶
Package costforecast provides cost forecasting capabilities for TokMan
Index ¶
- type AggregatedForecast
- type Config
- type DataPoint
- type ExponentialSmoothingModel
- type ForecastReport
- type Forecaster
- type LinearRegressionModel
- type Model
- type MovingAverageModel
- type Prediction
- type Recommendation
- type RiskLevel
- type SeasonalDecompositionModel
- type SeasonalityPattern
- type TrendDirection
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
type ExponentialSmoothingModel ¶
type ExponentialSmoothingModel struct {
// contains filtered or unexported fields
}
ExponentialSmoothingModel uses exponential smoothing
func (*ExponentialSmoothingModel) Name ¶
func (m *ExponentialSmoothingModel) Name() string
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 SeasonalDecompositionModel ¶
type SeasonalDecompositionModel struct {
// contains filtered or unexported fields
}
SeasonalDecompositionModel detects and uses seasonality
func (*SeasonalDecompositionModel) Name ¶
func (m *SeasonalDecompositionModel) Name() string
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" )