Class ShannonEntropyIndicators
Running Shannon entropy over a source indicator's values — the two
variants (fixed sample count, fixed time window) mirror
SimpleMovingAverage<TTime, TValue>'s own two variants, but
composed from the general Take/TimeWindow combinators rather
than a specialized O(1) fold: entropy has no cheap incremental update the
way a sum does (evicting one sample from a frequency table doesn't cheaply
update -Σp·log(p)), so both variants materialize the window on
every Value read (O(window size)).
public static class ShannonEntropyIndicators
- Inheritance
-
ShannonEntropyIndicators
- Inherited Members
Methods
RunningShannonEntropy<TSelf, TSample, TValue>(IIndicator<TSelf, TSample, TValue>, int, double)
Running Shannon entropy over the last count values
the source indicator held — the count-bounded variant.
public static MappedIndicator<TakeIndicator<TSelf, TSample, TValue>, TSample, ImmutableArray<TValue>, double> RunningShannonEntropy<TSelf, TSample, TValue>(this IIndicator<TSelf, TSample, TValue> source, int count, double logBase = 2) where TSelf : IIndicator<TSelf, TSample, TValue>
Parameters
sourceIIndicator<TSelf, TSample, TValue>The source indicator whose values are the symbols.
countintThe window size. Must be positive.
logBasedoubleThe logarithm base — bits (2, the default) or nats (E).
Returns
- MappedIndicator<TakeIndicator<TSelf, TSample, TValue>, TSample, ImmutableArray<TValue>, double>
Type Parameters
TSelfTSampleTValue
RunningShannonEntropy<TSelf, TSample, TValue, TTime>(IIndicator<TSelf, TSample, TValue>, Func<TSample, TTime>, Func<TTime, TTime, bool>, double)
Running Shannon entropy over the trailing time window — the duration-bounded variant.
public static MappedIndicator<TimeWindowIndicator<TSelf, TSample, TValue, TTime>, TSample, ImmutableArray<TimestampedSample<TTime, TValue>>, double> RunningShannonEntropy<TSelf, TSample, TValue, TTime>(this IIndicator<TSelf, TSample, TValue> source, Func<TSample, TTime> timeOf, Func<TTime, TTime, bool> isExpired, double logBase = 2) where TSelf : IIndicator<TSelf, TSample, TValue> where TTime : IComparable<TTime>
Parameters
sourceIIndicator<TSelf, TSample, TValue>The source indicator whose values are the symbols.
timeOfFunc<TSample, TTime>Extracts the observation time from an incoming sample.
isExpiredFunc<TTime, TTime, bool>Called as
isExpired(oldestTime, latestTime)during eviction to decide whether the oldest in-window observation has aged out.logBasedoubleThe logarithm base — bits (2, the default) or nats (E).
Returns
- MappedIndicator<TimeWindowIndicator<TSelf, TSample, TValue, TTime>, TSample, ImmutableArray<TimestampedSample<TTime, TValue>>, double>
Type Parameters
TSelfTSampleTValueTTime