Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LinearRegression ¶
LinearRegression computes slope, intercept, and coefficient of determination (R²) using ordinary least squares.
Types ¶
type EMA ¶
type EMA struct {
// contains filtered or unexported fields
}
EMA is an exponential moving average smoother.
type RingBuffer ¶
type RingBuffer[T any] struct { // contains filtered or unexported fields }
RingBuffer is a fixed-capacity circular buffer with concurrent reads.
func NewRingBuffer ¶
func NewRingBuffer[T any](capacity int) *RingBuffer[T]
func (*RingBuffer[T]) Add ¶
func (rb *RingBuffer[T]) Add(item T)
func (*RingBuffer[T]) Cap ¶
func (rb *RingBuffer[T]) Cap() int
func (*RingBuffer[T]) Last ¶
func (rb *RingBuffer[T]) Last() (T, bool)
func (*RingBuffer[T]) Len ¶
func (rb *RingBuffer[T]) Len() int
func (*RingBuffer[T]) Reset ¶
func (rb *RingBuffer[T]) Reset()
func (*RingBuffer[T]) Slice ¶
func (rb *RingBuffer[T]) Slice() []T
type SlidingWindow ¶
type SlidingWindow[T any] struct { // contains filtered or unexported fields }
SlidingWindow is a count-based sliding window built on RingBuffer.
func NewSlidingWindow ¶
func NewSlidingWindow[T any](maxSize int) *SlidingWindow[T]
func (*SlidingWindow[T]) Add ¶
func (sw *SlidingWindow[T]) Add(item T)
func (*SlidingWindow[T]) Cap ¶
func (sw *SlidingWindow[T]) Cap() int
func (*SlidingWindow[T]) Len ¶
func (sw *SlidingWindow[T]) Len() int
func (*SlidingWindow[T]) Reset ¶
func (sw *SlidingWindow[T]) Reset()
func (*SlidingWindow[T]) Slice ¶
func (sw *SlidingWindow[T]) Slice() []T
type Welford ¶
type Welford struct {
// contains filtered or unexported fields
}
Welford computes running mean, variance, and standard deviation in O(1) per update.
func NewWelford ¶
func NewWelford() *Welford