Metadata-Version: 2.2
Name: hgraph-analytics
Version: 0.8.18
Summary: C++-first numerical analytics for hgraph
License: MIT
Project-URL: Homepage, https://github.com/hhenson/hgraph
Project-URL: Repository, https://github.com/hhenson/hgraph.git
Requires-Python: >=3.12
Requires-Dist: hgraph>=0.8.0
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Description-Content-Type: text/markdown

# hgraph-analytics

C++-first numerical analytics for hgraph. The package owns the numerical
analytical family migrated from core—`diff`, `count`, `clip`, `ewma`, and
`pct_change`—plus `quantile`, shaped-array `array_std`, shaped-array
`rolling_window`, `window_values`, `array_get_item`, `cumulative_sum`,
`correlation`, generic `std`/`var`, trailing `rolling_mean`, scheduled
`resample`, and the EWMA parameter conversion helpers.

For installation, semantics, and Python/C++ usage patterns, see the
[analytics user guide](https://github.com/hhenson/hgraph/blob/main/docs/source/user_guide/analytics.rst).

```python
import hgraph as hg
import hgraph_analytics as hga

change = hga.pct_change(
    value,
    period=12,
    divide_by_zero=hg.DivideByZero.NAN,
)

bounded = hga.clip(change, -0.25, 0.25)
smoothed = hga.ewma(bounded, alpha=0.2)
median = hga.quantile(observations, 0.5)
volatility = hga.array_std(observations, ddof=1)
recent = hga.rolling_window(value, period=20, min_window_period=5)
window = hga.window_values(hg.to_window(value, 20))
running = hga.cumulative_sum(observations, axis=0)
correlation = hga.correlation(observations, rowvar=False)
sample_volatility = hga.std(hg.to_window(change, 20, 20), ddof=1)
moving_average = hga.rolling_mean(value, period=20)
```

The result is fractional: `0.05` denotes five percent. `period` counts valid
source observations and must be positive. The operator does not infer
dataframe ordering, elapsed-time sampling, market sessions, or financial price
adjustment.

Native consumers link `hgraph::analytics`, call
`hgraph::analytics::register_analytics_operators()`, and wire
the markers in `hgraph::analytics`, including `diff`, `count`, `clip`, `ewma`,
`pct_change`, `window_values`, `array_get_item`, `cumulative_sum`,
`correlation`, `quantile`, `array_std`, `rolling_window`, `std_`, `var_`,
`rolling_mean`, and `resample`.

See the hgraph user-guide migration note for the complete Python and C++ name
mapping from the former core API.
