You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Merged three overlapping null-handling entries into two
- Removed implementation details from ts_product convention
- Fixed "compile to" -> "execute as" (more precise)
- Removed redundant code comments and output block from Usage
- Operators listed with space-separated formatting for readability
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+23-37Lines changed: 23 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,28 +10,25 @@
10
10
11
11
</div>
12
12
13
-
Polars-native factor computation engine for quantitative research.
14
-
15
-
All operators compile to Rust-backed Polars expressions -- no Python loops in the hot path.
13
+
Polars-native factor computation engine for quantitative research. All operators execute as Rust-backed Polars expressions with no Python loops in the hot path.
16
14
17
15
## Core Abstractions
18
16
19
17
-**`Panel`** -- Balanced `(timestamp, symbol)` container with strict alignment guarantees. Prevents look-ahead bias by construction.
20
-
-**`Factor`** -- Immutable signal vector. Every operator takes `Factor` and returns `Factor` with eager evaluation. Null propagation follows explicit rules; all division operations are zero-guarded.
18
+
-**`Factor`** -- Immutable signal vector. Every operator takes `Factor` and returns `Factor` with eager evaluation.
21
19
22
20
## Numerical Conventions
23
21
24
22
| Topic | Convention |
25
23
| --- | --- |
26
-
|**Rank range**|`(0, 1]` -- minimum is `1/n`, maximum is `1.0`. Does not pass through zero. Ties use `average` method. Null values are excluded from ranking, not assigned a rank. |
27
-
|**Standard deviation**| Population (ddof=0) for all `std`, `variance`, `zscore`, `normalize` operators. |
28
-
|**Correlation / Covariance**| Sample (ddof=1) for `ts_corr`, `ts_covariance`, `ts_autocorr`. Consistent: `corr(x,y) = cov(x,y) / (std(x) * std(y))` holds when using the same ddof. |
29
-
|**Rolling warmup**| All `ts_*` operators use `min_samples=window`. The first `window-1` values per symbol are null. |
30
-
|**Division by zero**| All divisions are guarded at `abs(denominator) < 1e-10`, returning null. This applies to `divide`, `inverse`, `zscore`, `ts_zscore`, `ts_cv`, `ts_regression`, and all neutralization operators. |
31
-
|**Negative products**|`ts_product` handles negative values via sign-magnitude decomposition: counts negatives in window for sign, computes `exp(sum(log(abs(x))))` for magnitude. Zero in window produces zero. |
32
-
|**Null in arithmetic**| Default: null propagates (`5.0 + null = null`). The `add`, `subtract`, `multiply` operators accept `filter=True` to treat null as the identity element (0 for add/subtract, 1 for multiply), so `add(a, b, filter=True)` yields `5.0 + null = 5.0`. Direct `+`/`-`/`*` operators always propagate null. |
33
-
|**Null propagation**| Nulls propagate naturally through all operations. Boundary cases (constant window, insufficient data, zero denominator) return null explicitly -- never through implicit Inf-to-null conversion. |
34
-
|**NaN / Inf / null**| Polars distinguishes NaN (IEEE 754) from null (missing). Elvers unifies them: the Factor constructor converts both NaN and Inf to null on creation. The entire library operates on a single missing-value semantic (null only), eliminating NaN-propagation bugs. No operator produces NaN or Inf as a valid result. |
24
+
|**Missing values**| NaN and Inf are converted to null on Factor creation. The library operates on a single missing-value semantic (null only). Nulls propagate through all operations; boundary cases (constant window, insufficient data, zero denominator) return null explicitly. |
25
+
|**Null in arithmetic**| Default: `5.0 + null = null`. The `add`, `subtract`, `multiply` functions accept `filter=True` to treat null as the identity element (0 for +/-, 1 for *). |
26
+
|**Division by zero**| All divisions guarded at `abs(denominator) < 1e-10`, returning null. Applies uniformly across `divide`, `inverse`, `zscore`, `ts_zscore`, `ts_cv`, `ts_regression`, and all neutralization operators. |
27
+
|**Rank**| Range `(0, 1]`. Does not pass through zero. Ties use `average` method. Nulls excluded from ranking. |
28
+
|**Standard deviation**| Population (ddof=0) for `std`, `variance`, `zscore`, `normalize`. |
0 commit comments