features

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package features provides utilities for building feature frames from raw metric data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillMissingValues

func FillMissingValues(frame models.FeatureFrame) models.FeatureFrame

FillMissingValues fills missing values in a FeatureFrame using forward fill strategy. For each feature column, missing values (represented as NaN or not present) are replaced with the last valid value seen.

This is a simple implementation for v0.1. More sophisticated imputation strategies (mean, interpolation) can be added later if needed.

Types

type Builder

type Builder struct{}

Builder constructs feature frames from DataFrames, extracting time-based features and transforming raw metric data into a format suitable for forecasting models.

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new feature builder.

func (*Builder) BuildFeatures

func (b *Builder) BuildFeatures(df adapters.DataFrame) (models.FeatureFrame, error)

BuildFeatures converts a DataFrame from an adapter into a FeatureFrame for a model. It extracts the following features from each row:

  • value: the metric value (required)
  • timestamp: Unix timestamp in seconds (extracted from "ts" field if present)
  • hour: hour of day (0-23) extracted from timestamp
  • day: day of week (0-6, Sunday=0) extracted from timestamp

Rows without a "value" field are skipped. If "ts" field is missing, features derived from timestamps are not included.

Jump to

Keyboard shortcuts

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