brain-decorrelator
Strategy-agnostic alpha decorrelation engine with plugin-based orthogonalization axes.
brain_decorrelator transforms correlated alpha expressions into orthogonal variants that pass WorldQuant BRAIN's correlation gate ($|\rho| < 0.70$) while preserving underlying economic Sharpe. It operates across all quantitative domains (Options, Sentiment, Risk Models) via an extensible plugin registry. For detailed mathematical formulations and before/after empirical benchmarks, see the Axes Guide.
Installation
pip install brain-decorrelator
Quickstart
from brain_decorrelator import DecorrelationEngine
engine = DecorrelationEngine()
# Automatically applies all 6 registered orthogonal axes
variants = engine.generate_orthogonal_variants(
expression="rank(implied_volatility_call_30)",
base_sharpe=1.65,
max_variants=5,
)
for v in variants:
print(f"[{v.axis_name}] -> {v.transformed_expression}")
The 6 Universal Orthogonal Axes
| Axis | Transformation Logic | WorldQuant BRAIN Syntax | Typical $\rho$ | Sharpe Retention |
|---|---|---|---|---|
| Velocity | Temporal phase shift via rate-of-change and decay | decay_linear(ts_delta(expr, 5), 10) |
0.35–0.50 | $85-92%$ |
| Neutralization | Multi-level factor and sector group residualization | group_neutralize(rank(expr), sector) |
0.42–0.58 | $95-110%$ |
| Volatility Gating | Regime scaling conditional on market variance | expr / (ts_std_dev(returns, 20) + 1e-4) |
0.48–0.62 | $90-96%$ |
| Rank Convexity | Concentrating portfolio weight in extreme tails | power(rank(expr) - 0.5, 3) |
0.55–0.68 | $92-98%$ |
| Volume Weighting | Tilting towards liquid names to damp market friction | expr * rank(volume / (adv20 + 1e-4)) |
0.38–0.55 | $88-94%$ |
| Calendar Modulation | Seasonality & turn-of-month institutional rebalancing | if_else(day_of_month(0) <= 5, expr*1.2, expr*0.8) |
0.60–0.68 | $92-95%$ |
Extending with Custom Plugins
from brain_decorrelator import AxisPlugin, register_axis
@register_axis
class MoneynessInversionAxis(AxisPlugin):
name = "moneyness_inversion"
def apply(self, expression: str, context: dict) -> list[str]:
return [f"-({expression})"]
Architecture
brain_decorrelator/
├── brain_decorrelator/
│ ├── __init__.py # Public re-exports (DecorrelationEngine, register_axis, unregister_axis)
│ ├── plugin.py # AxisPlugin ABC + thread-safe registry
│ ├── engine.py # DecorrelationEngine — orchestrator & variant dedup
│ ├── py.typed # PEP 561 typing marker
│ └── axes/
│ └── universal.py # 6 domain-agnostic built-in orthogonal axes
├── tests/ # Unit tests covering registry and all 6 axes
└── docs/
├── API.md # Complete API specification
└── AXES.md # Mathematical formulations & worked examples
Testing
pytest tests/ -v
Security
Report vulnerabilities per SECURITY.md.
Contributing
See CONTRIBUTING.md for contribution guidelines.
License
Released under the MIT License. Maintained by Xtley001.
Metadata
Release files for brain-decorrelator 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| brain_decorrelator-0.1.1.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| brain_decorrelator-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.8 kB
Release files / brain_decorrelator-0.1.1.tar.gz
| Download URL | brain_decorrelator-0.1.1.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e92a739d4dda83b7cb88ff45f0d6a8cd0792cf9073aff63f66e9d81c96c05ef
|
|
BLAKE2b-256 checksum How to use checksums |
39cc2faaac2695f1e93ff9471ee81210fa330b92b60ed097f455670ba460f406
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / brain_decorrelator-0.1.1-py3-none-any.whl
| Download URL | brain_decorrelator-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8186218443acca5abc9001b65acfb17fa21a66feaed72bff43ae6706975f12d
|
|
BLAKE2b-256 checksum How to use checksums |
ed62c723c7b8312573c8068ad197d057a1f8c28e35451259e7a55fb15714e3f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|