factrix 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. factrix-0.8.0/LICENSE +218 -0
  2. factrix-0.8.0/PKG-INFO +139 -0
  3. factrix-0.8.0/README.md +90 -0
  4. factrix-0.8.0/factrix/__init__.py +122 -0
  5. factrix-0.8.0/factrix/_analysis_config.py +235 -0
  6. factrix-0.8.0/factrix/_axis.py +57 -0
  7. factrix-0.8.0/factrix/_codes.py +194 -0
  8. factrix-0.8.0/factrix/_describe.py +471 -0
  9. factrix-0.8.0/factrix/_errors.py +89 -0
  10. factrix-0.8.0/factrix/_evaluate.py +99 -0
  11. factrix-0.8.0/factrix/_logging.py +45 -0
  12. factrix-0.8.0/factrix/_metric_index.py +229 -0
  13. factrix-0.8.0/factrix/_multi_factor.py +169 -0
  14. factrix-0.8.0/factrix/_ols.py +78 -0
  15. factrix-0.8.0/factrix/_procedures.py +711 -0
  16. factrix-0.8.0/factrix/_profile.py +103 -0
  17. factrix-0.8.0/factrix/_registry.py +176 -0
  18. factrix-0.8.0/factrix/_stats/__init__.py +511 -0
  19. factrix-0.8.0/factrix/_stats/constants.py +61 -0
  20. factrix-0.8.0/factrix/_types.py +120 -0
  21. factrix-0.8.0/factrix/_validators.py +109 -0
  22. factrix-0.8.0/factrix/adapt.py +139 -0
  23. factrix-0.8.0/factrix/datasets.py +275 -0
  24. factrix-0.8.0/factrix/llms-full.txt +325 -0
  25. factrix-0.8.0/factrix/llms.txt +19 -0
  26. factrix-0.8.0/factrix/metrics/__init__.py +148 -0
  27. factrix-0.8.0/factrix/metrics/_helpers.py +343 -0
  28. factrix-0.8.0/factrix/metrics/caar.py +497 -0
  29. factrix-0.8.0/factrix/metrics/clustering.py +101 -0
  30. factrix-0.8.0/factrix/metrics/concentration.py +195 -0
  31. factrix-0.8.0/factrix/metrics/corrado.py +139 -0
  32. factrix-0.8.0/factrix/metrics/event_horizon.py +326 -0
  33. factrix-0.8.0/factrix/metrics/event_quality.py +409 -0
  34. factrix-0.8.0/factrix/metrics/fama_macbeth.py +592 -0
  35. factrix-0.8.0/factrix/metrics/hit_rate.py +97 -0
  36. factrix-0.8.0/factrix/metrics/ic.py +612 -0
  37. factrix-0.8.0/factrix/metrics/mfe_mae.py +304 -0
  38. factrix-0.8.0/factrix/metrics/monotonicity.py +146 -0
  39. factrix-0.8.0/factrix/metrics/oos.py +209 -0
  40. factrix-0.8.0/factrix/metrics/quantile.py +416 -0
  41. factrix-0.8.0/factrix/metrics/spanning.py +406 -0
  42. factrix-0.8.0/factrix/metrics/tradability.py +508 -0
  43. factrix-0.8.0/factrix/metrics/trend.py +151 -0
  44. factrix-0.8.0/factrix/metrics/ts_asymmetry.py +245 -0
  45. factrix-0.8.0/factrix/metrics/ts_beta.py +436 -0
  46. factrix-0.8.0/factrix/metrics/ts_quantile.py +221 -0
  47. factrix-0.8.0/factrix/multi_factor.py +11 -0
  48. factrix-0.8.0/factrix/preprocess/__init__.py +1 -0
  49. factrix-0.8.0/factrix/preprocess/normalize.py +74 -0
  50. factrix-0.8.0/factrix/preprocess/orthogonalize.py +176 -0
  51. factrix-0.8.0/factrix/preprocess/returns.py +104 -0
  52. factrix-0.8.0/factrix/stats/__init__.py +18 -0
  53. factrix-0.8.0/factrix/stats/bootstrap.py +143 -0
  54. factrix-0.8.0/factrix/stats/multiple_testing.py +153 -0
  55. factrix-0.8.0/factrix.egg-info/PKG-INFO +139 -0
  56. factrix-0.8.0/factrix.egg-info/SOURCES.txt +97 -0
  57. factrix-0.8.0/factrix.egg-info/dependency_links.txt +1 -0
  58. factrix-0.8.0/factrix.egg-info/requires.txt +31 -0
  59. factrix-0.8.0/factrix.egg-info/top_level.txt +1 -0
  60. factrix-0.8.0/pyproject.toml +127 -0
  61. factrix-0.8.0/setup.cfg +4 -0
  62. factrix-0.8.0/tests/test_adapt.py +120 -0
  63. factrix-0.8.0/tests/test_adf_persistence.py +56 -0
  64. factrix-0.8.0/tests/test_caar.py +491 -0
  65. factrix-0.8.0/tests/test_caar_procedure.py +367 -0
  66. factrix-0.8.0/tests/test_common_panel_procedures.py +485 -0
  67. factrix-0.8.0/tests/test_concentration.py +96 -0
  68. factrix-0.8.0/tests/test_datasets.py +53 -0
  69. factrix-0.8.0/tests/test_docs_matrix.py +85 -0
  70. factrix-0.8.0/tests/test_evaluate.py +251 -0
  71. factrix-0.8.0/tests/test_evaluate_missing_config.py +63 -0
  72. factrix-0.8.0/tests/test_event_horizon.py +215 -0
  73. factrix-0.8.0/tests/test_fm_procedure.py +200 -0
  74. factrix-0.8.0/tests/test_foundation.py +382 -0
  75. factrix-0.8.0/tests/test_helpers.py +158 -0
  76. factrix-0.8.0/tests/test_hit_rate.py +57 -0
  77. factrix-0.8.0/tests/test_ic.py +238 -0
  78. factrix-0.8.0/tests/test_ic_procedure.py +208 -0
  79. factrix-0.8.0/tests/test_introspection.py +490 -0
  80. factrix-0.8.0/tests/test_list_metrics.py +187 -0
  81. factrix-0.8.0/tests/test_logging_infra.py +45 -0
  82. factrix-0.8.0/tests/test_mfe_mae.py +268 -0
  83. factrix-0.8.0/tests/test_monotonicity.py +49 -0
  84. factrix-0.8.0/tests/test_multi_factor.py +379 -0
  85. factrix-0.8.0/tests/test_normalize.py +80 -0
  86. factrix-0.8.0/tests/test_oos.py +130 -0
  87. factrix-0.8.0/tests/test_orthogonalize.py +86 -0
  88. factrix-0.8.0/tests/test_quantile.py +125 -0
  89. factrix-0.8.0/tests/test_registry.py +455 -0
  90. factrix-0.8.0/tests/test_returns.py +108 -0
  91. factrix-0.8.0/tests/test_significance.py +65 -0
  92. factrix-0.8.0/tests/test_spanning.py +205 -0
  93. factrix-0.8.0/tests/test_tradability.py +265 -0
  94. factrix-0.8.0/tests/test_trend.py +96 -0
  95. factrix-0.8.0/tests/test_ts_asymmetry.py +137 -0
  96. factrix-0.8.0/tests/test_ts_beta_procedure.py +209 -0
  97. factrix-0.8.0/tests/test_ts_dummy_procedure.py +405 -0
  98. factrix-0.8.0/tests/test_ts_quantile.py +164 -0
  99. factrix-0.8.0/tests/test_two_tier_guards.py +179 -0
factrix-0.8.0/LICENSE ADDED
@@ -0,0 +1,218 @@
1
+ Copyright 2026 jason pan
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
15
+ ---
16
+
17
+
18
+ Apache License
19
+ Version 2.0, January 2004
20
+ http://www.apache.org/licenses/
21
+
22
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
23
+
24
+ 1. Definitions.
25
+
26
+ "License" shall mean the terms and conditions for use, reproduction,
27
+ and distribution as defined by Sections 1 through 9 of this document.
28
+
29
+ "Licensor" shall mean the copyright owner or entity authorized by
30
+ the copyright owner that is granting the License.
31
+
32
+ "Legal Entity" shall mean the union of the acting entity and all
33
+ other entities that control, are controlled by, or are under common
34
+ control with that entity. For the purposes of this definition,
35
+ "control" means (i) the power, direct or indirect, to cause the
36
+ direction or management of such entity, whether by contract or
37
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
38
+ outstanding shares, or (iii) beneficial ownership of such entity.
39
+
40
+ "You" (or "Your") shall mean an individual or Legal Entity
41
+ exercising permissions granted by this License.
42
+
43
+ "Source" form shall mean the preferred form for making modifications,
44
+ including but not limited to software source code, documentation
45
+ source, and configuration files.
46
+
47
+ "Object" form shall mean any form resulting from mechanical
48
+ transformation or translation of a Source form, including but
49
+ not limited to compiled object code, generated documentation,
50
+ and conversions to other media types.
51
+
52
+ "Work" shall mean the work of authorship, whether in Source or
53
+ Object form, made available under the License, as indicated by a
54
+ copyright notice that is included in or attached to the work
55
+ (an example is provided in the Appendix below).
56
+
57
+ "Derivative Works" shall mean any work, whether in Source or Object
58
+ form, that is based on (or derived from) the Work and for which the
59
+ editorial revisions, annotations, elaborations, or other modifications
60
+ represent, as a whole, an original work of authorship. For the purposes
61
+ of this License, Derivative Works shall not include works that remain
62
+ separable from, or merely link (or bind by name) to the interfaces of,
63
+ the Work and Derivative Works thereof.
64
+
65
+ "Contribution" shall mean any work of authorship, including
66
+ the original version of the Work and any modifications or additions
67
+ to that Work or Derivative Works thereof, that is intentionally
68
+ submitted to Licensor for inclusion in the Work by the copyright owner
69
+ or by an individual or Legal Entity authorized to submit on behalf of
70
+ the copyright owner. For the purposes of this definition, "submitted"
71
+ means any form of electronic, verbal, or written communication sent
72
+ to the Licensor or its representatives, including but not limited to
73
+ communication on electronic mailing lists, source code control systems,
74
+ and issue tracking systems that are managed by, or on behalf of, the
75
+ Licensor for the purpose of discussing and improving the Work, but
76
+ excluding communication that is conspicuously marked or otherwise
77
+ designated in writing by the copyright owner as "Not a Contribution."
78
+
79
+ "Contributor" shall mean Licensor and any individual or Legal Entity
80
+ on behalf of whom a Contribution has been received by Licensor and
81
+ subsequently incorporated within the Work.
82
+
83
+ 2. Grant of Copyright License. Subject to the terms and conditions of
84
+ this License, each Contributor hereby grants to You a perpetual,
85
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
86
+ copyright license to reproduce, prepare Derivative Works of,
87
+ publicly display, publicly perform, sublicense, and distribute the
88
+ Work and such Derivative Works in Source or Object form.
89
+
90
+ 3. Grant of Patent License. Subject to the terms and conditions of
91
+ this License, each Contributor hereby grants to You a perpetual,
92
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
93
+ (except as stated in this section) patent license to make, have made,
94
+ use, offer to sell, sell, import, and otherwise transfer the Work,
95
+ where such license applies only to those patent claims licensable
96
+ by such Contributor that are necessarily infringed by their
97
+ Contribution(s) alone or by combination of their Contribution(s)
98
+ with the Work to which such Contribution(s) was submitted. If You
99
+ institute patent litigation against any entity (including a
100
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
101
+ or a Contribution incorporated within the Work constitutes direct
102
+ or contributory patent infringement, then any patent licenses
103
+ granted to You under this License for that Work shall terminate
104
+ as of the date such litigation is filed.
105
+
106
+ 4. Redistribution. You may reproduce and distribute copies of the
107
+ Work or Derivative Works thereof in any medium, with or without
108
+ modifications, and in Source or Object form, provided that You
109
+ meet the following conditions:
110
+
111
+ (a) You must give any other recipients of the Work or
112
+ Derivative Works a copy of this License; and
113
+
114
+ (b) You must cause any modified files to carry prominent notices
115
+ stating that You changed the files; and
116
+
117
+ (c) You must retain, in the Source form of any Derivative Works
118
+ that You distribute, all copyright, patent, trademark, and
119
+ attribution notices from the Source form of the Work,
120
+ excluding those notices that do not pertain to any part of
121
+ the Derivative Works; and
122
+
123
+ (d) If the Work includes a "NOTICE" text file as part of its
124
+ distribution, then any Derivative Works that You distribute must
125
+ include a readable copy of the attribution notices contained
126
+ within such NOTICE file, excluding those notices that do not
127
+ pertain to any part of the Derivative Works, in at least one
128
+ of the following places: within a NOTICE text file distributed
129
+ as part of the Derivative Works; within the Source form or
130
+ documentation, if provided along with the Derivative Works; or,
131
+ within a display generated by the Derivative Works, if and
132
+ wherever such third-party notices normally appear. The contents
133
+ of the NOTICE file are for informational purposes only and
134
+ do not modify the License. You may add Your own attribution
135
+ notices within Derivative Works that You distribute, alongside
136
+ or as an addendum to the NOTICE text from the Work, provided
137
+ that such additional attribution notices cannot be construed
138
+ as modifying the License.
139
+
140
+ You may add Your own copyright statement to Your modifications and
141
+ may provide additional or different license terms and conditions
142
+ for use, reproduction, or distribution of Your modifications, or
143
+ for any such Derivative Works as a whole, provided Your use,
144
+ reproduction, and distribution of the Work otherwise complies with
145
+ the conditions stated in this License.
146
+
147
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
148
+ any Contribution intentionally submitted for inclusion in the Work
149
+ by You to the Licensor shall be under the terms and conditions of
150
+ this License, without any additional terms or conditions.
151
+ Notwithstanding the above, nothing herein shall supersede or modify
152
+ the terms of any separate license agreement you may have executed
153
+ with Licensor regarding such Contributions.
154
+
155
+ 6. Trademarks. This License does not grant permission to use the trade
156
+ names, trademarks, service marks, or product names of the Licensor,
157
+ except as required for reasonable and customary use in describing the
158
+ origin of the Work and reproducing the content of the NOTICE file.
159
+
160
+ 7. Disclaimer of Warranty. Unless required by applicable law or
161
+ agreed to in writing, Licensor provides the Work (and each
162
+ Contributor provides its Contributions) on an "AS IS" BASIS,
163
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
164
+ implied, including, without limitation, any warranties or conditions
165
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
166
+ PARTICULAR PURPOSE. You are solely responsible for determining the
167
+ appropriateness of using or redistributing the Work and assume any
168
+ risks associated with Your exercise of permissions under this License.
169
+
170
+ 8. Limitation of Liability. In no event and under no legal theory,
171
+ whether in tort (including negligence), contract, or otherwise,
172
+ unless required by applicable law (such as deliberate and grossly
173
+ negligent acts) or agreed to in writing, shall any Contributor be
174
+ liable to You for damages, including any direct, indirect, special,
175
+ incidental, or consequential damages of any character arising as a
176
+ result of this License or out of the use or inability to use the
177
+ Work (including but not limited to damages for loss of goodwill,
178
+ work stoppage, computer failure or malfunction, or any and all
179
+ other commercial damages or losses), even if such Contributor
180
+ has been advised of the possibility of such damages.
181
+
182
+ 9. Accepting Warranty or Additional Liability. While redistributing
183
+ the Work or Derivative Works thereof, You may choose to offer,
184
+ and charge a fee for, acceptance of support, warranty, indemnity,
185
+ or other liability obligations and/or rights consistent with this
186
+ License. However, in accepting such obligations, You may act only
187
+ on Your own behalf and on Your sole responsibility, not on behalf
188
+ of any other Contributor, and only if You agree to indemnify,
189
+ defend, and hold each Contributor harmless for any liability
190
+ incurred by, or claims asserted against, such Contributor by reason
191
+ of your accepting any such warranty or additional liability.
192
+
193
+ END OF TERMS AND CONDITIONS
194
+
195
+ APPENDIX: How to apply the Apache License to your work.
196
+
197
+ To apply the Apache License to your work, attach the following
198
+ boilerplate notice, with the fields enclosed by brackets "[]"
199
+ replaced with your own identifying information. (Don't include
200
+ the brackets!) The text should be enclosed in the appropriate
201
+ comment syntax for the file format. We also recommend that a
202
+ file or class name and description of purpose be included on the
203
+ same "printed page" as the copyright notice for easier
204
+ identification within third-party archives.
205
+
206
+ Copyright [yyyy] [name of copyright owner]
207
+
208
+ Licensed under the Apache License, Version 2.0 (the "License");
209
+ you may not use this file except in compliance with the License.
210
+ You may obtain a copy of the License at
211
+
212
+ http://www.apache.org/licenses/LICENSE-2.0
213
+
214
+ Unless required by applicable law or agreed to in writing, software
215
+ distributed under the License is distributed on an "AS IS" BASIS,
216
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
217
+ See the License for the specific language governing permissions and
218
+ limitations under the License.
factrix-0.8.0/PKG-INFO ADDED
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: factrix
3
+ Version: 0.8.0
4
+ Summary: Polars-native factor signal validation toolkit for quantitative finance
5
+ Author-email: Jason Pan <atk50715@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://github.com/awwesomeman/factrix
8
+ Project-URL: Issues, https://github.com/awwesomeman/factrix/issues
9
+ Project-URL: Changelog, https://github.com/awwesomeman/factrix/blob/main/CHANGELOG.md
10
+ Keywords: quantitative-finance,factor-analysis,polars,statistics,asset-pricing,cross-sectional,fama-macbeth,ic
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: Topic :: Office/Business :: Financial :: Investment
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: >=3.12
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: polars>=1.38
22
+ Requires-Dist: numpy>=2.0
23
+ Requires-Dist: scipy>=1.13
24
+ Requires-Dist: pandera>=0.29
25
+ Provides-Extra: jupyter
26
+ Requires-Dist: jupyter>=1.0.0; extra == "jupyter"
27
+ Requires-Dist: jupyterlab>=3.4.0; extra == "jupyter"
28
+ Requires-Dist: ipywidgets>=7.7.0; extra == "jupyter"
29
+ Requires-Dist: nbformat>=4.2.0; extra == "jupyter"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest==9.0.3; extra == "dev"
32
+ Requires-Dist: pytest-cov==7.1.0; extra == "dev"
33
+ Requires-Dist: pytest-mock==3.15.1; extra == "dev"
34
+ Requires-Dist: pre-commit>=4.5.1; extra == "dev"
35
+ Requires-Dist: ruff==0.15.12; extra == "dev"
36
+ Requires-Dist: commitizen>=4.10.1; extra == "dev"
37
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
38
+ Requires-Dist: build; extra == "dev"
39
+ Requires-Dist: twine; extra == "dev"
40
+ Provides-Extra: docs
41
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
42
+ Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
43
+ Requires-Dist: mkdocs-jupyter>=0.25; extra == "docs"
44
+ Requires-Dist: mkdocs<2.0,>=1.5.0; extra == "docs"
45
+ Requires-Dist: mike>=2.1; extra == "docs"
46
+ Provides-Extra: all
47
+ Requires-Dist: factrix[jupyter]; extra == "all"
48
+ Dynamic: license-file
49
+
50
+ <div align="center">
51
+
52
+ <img src="docs/assets/factrix_banner_light.png" alt="factrix" />
53
+
54
+ </div>
55
+
56
+ <p align="center">
57
+ <a href="https://github.com/awwesomeman/factrix/releases" title="Version">
58
+ <img src="https://img.shields.io/github/v/release/awwesomeman/factrix?color=3670A0&label=version" />
59
+ </a>
60
+ <a href="https://github.com/awwesomeman/factrix/actions/workflows/test.yml" title="test workflow">
61
+ <img src="https://github.com/awwesomeman/factrix/actions/workflows/test.yml/badge.svg?branch=main" />
62
+ </a>
63
+ <a href="https://github.com/awwesomeman/factrix/actions/workflows/docs-deploy-release.yml" title="docs workflow">
64
+ <img src="https://github.com/awwesomeman/factrix/actions/workflows/docs-deploy-release.yml/badge.svg?branch=main" />
65
+ </a>
66
+ <a href="https://www.python.org/downloads/" title="Python versions">
67
+ <img src="https://img.shields.io/badge/python-3.12+-blue.svg?logo=python&logoColor=white" />
68
+ </a>
69
+ <a href="https://pola.rs/" title="Polars-native">
70
+ <img src="https://img.shields.io/badge/polars-native-CD792C?logo=polars&logoColor=white" />
71
+ </a>
72
+ <a href="https://github.com/awwesomeman/factrix/blob/main/LICENSE" title="License">
73
+ <img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" />
74
+ </a>
75
+ <a href="https://awwesomeman.github.io/factrix/latest/" title="Documentation">
76
+ <img src="https://img.shields.io/badge/docs-mkdocs--material-526CFE?logo=materialformkdocs&logoColor=white" />
77
+ </a>
78
+ <a href="https://github.com/awwesomeman/factrix/stargazers" title="Stars">
79
+ <img src="https://img.shields.io/github/stars/awwesomeman/factrix?style=flat" />
80
+ </a>
81
+ </p>
82
+
83
+ <h3 align="center"><b>Tests one factor. Screens a thousand.</b></h3>
84
+
85
+ A polars-native factor validator. It answers the core question — **Does this factor possess predictive edge?**
86
+
87
+ ## Installation
88
+
89
+ ```bash
90
+ pip install factrix
91
+ # or
92
+ uv add factrix
93
+ ```
94
+
95
+ See the [installation guide](https://awwesomeman.github.io/factrix/latest/getting-started/install/) for version pinning and development setup.
96
+
97
+ ## Typical usage
98
+
99
+ **Single factor — IC evaluation**
100
+
101
+ ```python
102
+ import factrix as fl
103
+ from factrix.preprocess.returns import compute_forward_return
104
+
105
+ raw = fl.datasets.make_cs_panel(n_assets=100, n_dates=500, ic_target=0.08, seed=2024)
106
+ panel = compute_forward_return(raw, forward_periods=5)
107
+
108
+ cfg = fl.AnalysisConfig.individual_continuous(metric=fl.Metric.IC, forward_periods=5)
109
+ profile = fl.evaluate(panel, cfg)
110
+
111
+ print(profile.verdict(), '| primary_p =', round(profile.primary_p, 4))
112
+ print(profile.diagnose()) # WarningCode / InfoCode list
113
+ ```
114
+
115
+ **Multi-factor BHY screening**
116
+
117
+ ```python
118
+ profiles = [fl.evaluate(p, cfg) for p in [panel_a, panel_b, panel_c, panel_d, panel_e]]
119
+ survivors = fl.multi_factor.bhy(profiles, threshold=0.05)
120
+ ```
121
+
122
+ **Single-asset (timeseries) fallback**
123
+
124
+ ```python
125
+ cfg = fl.AnalysisConfig.individual_continuous(metric=fl.Metric.IC, forward_periods=5)
126
+ profile = fl.evaluate(single_asset_panel, cfg) # mode auto-switches to TIMESERIES
127
+ print(profile.stats.get(fl.StatCode.TS_BETA))
128
+ ```
129
+
130
+ ## Documentation
131
+
132
+ - [**Get Started**](https://awwesomeman.github.io/factrix/latest/getting-started/) — install, quickstart, three-axis concepts
133
+ - [**Guides**](https://awwesomeman.github.io/factrix/latest/guides/) — PANEL vs TIMESERIES, BHY batch screening, choosing a metric
134
+ - [**Reference**](https://awwesomeman.github.io/factrix/latest/reference/metric-applicability/) — applicability tables, formulas, statistical methods
135
+ - [**Development**](https://awwesomeman.github.io/factrix/latest/development/architecture/) — architecture, contributing
136
+
137
+ ## License
138
+
139
+ Released under the [Apache License 2.0](LICENSE).
@@ -0,0 +1,90 @@
1
+ <div align="center">
2
+
3
+ <img src="docs/assets/factrix_banner_light.png" alt="factrix" />
4
+
5
+ </div>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/awwesomeman/factrix/releases" title="Version">
9
+ <img src="https://img.shields.io/github/v/release/awwesomeman/factrix?color=3670A0&label=version" />
10
+ </a>
11
+ <a href="https://github.com/awwesomeman/factrix/actions/workflows/test.yml" title="test workflow">
12
+ <img src="https://github.com/awwesomeman/factrix/actions/workflows/test.yml/badge.svg?branch=main" />
13
+ </a>
14
+ <a href="https://github.com/awwesomeman/factrix/actions/workflows/docs-deploy-release.yml" title="docs workflow">
15
+ <img src="https://github.com/awwesomeman/factrix/actions/workflows/docs-deploy-release.yml/badge.svg?branch=main" />
16
+ </a>
17
+ <a href="https://www.python.org/downloads/" title="Python versions">
18
+ <img src="https://img.shields.io/badge/python-3.12+-blue.svg?logo=python&logoColor=white" />
19
+ </a>
20
+ <a href="https://pola.rs/" title="Polars-native">
21
+ <img src="https://img.shields.io/badge/polars-native-CD792C?logo=polars&logoColor=white" />
22
+ </a>
23
+ <a href="https://github.com/awwesomeman/factrix/blob/main/LICENSE" title="License">
24
+ <img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" />
25
+ </a>
26
+ <a href="https://awwesomeman.github.io/factrix/latest/" title="Documentation">
27
+ <img src="https://img.shields.io/badge/docs-mkdocs--material-526CFE?logo=materialformkdocs&logoColor=white" />
28
+ </a>
29
+ <a href="https://github.com/awwesomeman/factrix/stargazers" title="Stars">
30
+ <img src="https://img.shields.io/github/stars/awwesomeman/factrix?style=flat" />
31
+ </a>
32
+ </p>
33
+
34
+ <h3 align="center"><b>Tests one factor. Screens a thousand.</b></h3>
35
+
36
+ A polars-native factor validator. It answers the core question — **Does this factor possess predictive edge?**
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ pip install factrix
42
+ # or
43
+ uv add factrix
44
+ ```
45
+
46
+ See the [installation guide](https://awwesomeman.github.io/factrix/latest/getting-started/install/) for version pinning and development setup.
47
+
48
+ ## Typical usage
49
+
50
+ **Single factor — IC evaluation**
51
+
52
+ ```python
53
+ import factrix as fl
54
+ from factrix.preprocess.returns import compute_forward_return
55
+
56
+ raw = fl.datasets.make_cs_panel(n_assets=100, n_dates=500, ic_target=0.08, seed=2024)
57
+ panel = compute_forward_return(raw, forward_periods=5)
58
+
59
+ cfg = fl.AnalysisConfig.individual_continuous(metric=fl.Metric.IC, forward_periods=5)
60
+ profile = fl.evaluate(panel, cfg)
61
+
62
+ print(profile.verdict(), '| primary_p =', round(profile.primary_p, 4))
63
+ print(profile.diagnose()) # WarningCode / InfoCode list
64
+ ```
65
+
66
+ **Multi-factor BHY screening**
67
+
68
+ ```python
69
+ profiles = [fl.evaluate(p, cfg) for p in [panel_a, panel_b, panel_c, panel_d, panel_e]]
70
+ survivors = fl.multi_factor.bhy(profiles, threshold=0.05)
71
+ ```
72
+
73
+ **Single-asset (timeseries) fallback**
74
+
75
+ ```python
76
+ cfg = fl.AnalysisConfig.individual_continuous(metric=fl.Metric.IC, forward_periods=5)
77
+ profile = fl.evaluate(single_asset_panel, cfg) # mode auto-switches to TIMESERIES
78
+ print(profile.stats.get(fl.StatCode.TS_BETA))
79
+ ```
80
+
81
+ ## Documentation
82
+
83
+ - [**Get Started**](https://awwesomeman.github.io/factrix/latest/getting-started/) — install, quickstart, three-axis concepts
84
+ - [**Guides**](https://awwesomeman.github.io/factrix/latest/guides/) — PANEL vs TIMESERIES, BHY batch screening, choosing a metric
85
+ - [**Reference**](https://awwesomeman.github.io/factrix/latest/reference/metric-applicability/) — applicability tables, formulas, statistical methods
86
+ - [**Development**](https://awwesomeman.github.io/factrix/latest/development/architecture/) — architecture, contributing
87
+
88
+ ## License
89
+
90
+ Released under the [Apache License 2.0](LICENSE).
@@ -0,0 +1,122 @@
1
+ """factrix — Single-factor evaluation toolkit (v0.5).
2
+
3
+ Three orthogonal user-facing axes — ``FactorScope``, ``Signal``,
4
+ ``Metric`` — plus an evaluate-time-derived ``Mode`` define the analysis
5
+ cell. Construct a config via the four type-safe factories on
6
+ ``AnalysisConfig``, dispatch via ``evaluate()``, inspect via the
7
+ returned ``FactorProfile``, and aggregate across factors with
8
+ ``multi_factor.bhy`` for FDR-corrected screening.
9
+
10
+ Single-factor::
11
+
12
+ import factrix as fl
13
+
14
+ cfg = fl.AnalysisConfig.individual_continuous(metric=fl.Metric.IC)
15
+ profile = fl.evaluate(panel, cfg)
16
+ print(profile.verdict(), profile.primary_p)
17
+ print(profile.diagnose())
18
+
19
+ Batch + BHY::
20
+
21
+ profiles = [fl.evaluate(panel, cfg) for cfg in candidate_configs]
22
+ survivors = fl.multi_factor.bhy(profiles, threshold=0.05)
23
+
24
+ Schema reflection::
25
+
26
+ print(fl.describe_analysis_modes())
27
+ print(fl.suggest_config(panel))
28
+
29
+ LLM agent reference: ``llms-full.txt`` covers concepts, public API, and
30
+ typical usage patterns in a single fetch. Two access paths::
31
+
32
+ # Web — deployed at the docs site root
33
+ https://awwesomeman.github.io/factrix/llms-full.txt
34
+
35
+ # Local — shipped inside the wheel as package data
36
+ import importlib.resources
37
+ text = importlib.resources.files("factrix").joinpath("llms-full.txt").read_text()
38
+ """
39
+
40
+ from factrix import datasets, multi_factor
41
+ from factrix._analysis_config import AnalysisConfig
42
+ from factrix._axis import ( # noqa: F401 Mode re-exported for namespace access; intentionally not in __all__
43
+ FactorScope,
44
+ Metric,
45
+ Mode,
46
+ Signal,
47
+ )
48
+ from factrix._codes import InfoCode, StatCode, Verdict, WarningCode
49
+ from factrix._describe import (
50
+ SuggestConfigResult,
51
+ describe_analysis_modes,
52
+ list_metrics,
53
+ suggest_config,
54
+ )
55
+ from factrix._errors import (
56
+ ConfigError,
57
+ FactrixError,
58
+ IncompatibleAxisError,
59
+ InsufficientSampleError,
60
+ MissingConfigError,
61
+ ModeAxisError,
62
+ )
63
+ from factrix._evaluate import _evaluate as _evaluate
64
+ from factrix._profile import FactorProfile
65
+ from factrix._types import MetricOutput
66
+
67
+
68
+ def evaluate(raw, config=None, /):
69
+ """Dispatch ``raw`` through the cell selected by ``config``.
70
+
71
+ Thin public wrapper around the private ``_evaluate`` dispatcher.
72
+ Intercepts the common onboarding miss — ``evaluate(panel)`` — with
73
+ a friendly :class:`MissingConfigError` pointing at
74
+ :func:`suggest_config` and the Get Started guide.
75
+ """
76
+ if config is None:
77
+ raise MissingConfigError(
78
+ "evaluate() requires an AnalysisConfig. "
79
+ "Call factrix.suggest_config(raw) for a recommendation, "
80
+ "or see the Get Started guide: "
81
+ "https://awwesomeman.github.io/factrix/getting-started/"
82
+ )
83
+ return _evaluate(raw, config)
84
+
85
+
86
+ __version__ = "0.8.0"
87
+
88
+ __all__ = [
89
+ # Configuration
90
+ "AnalysisConfig",
91
+ # Axis enums (Mode intentionally NOT exported — it is derived at
92
+ # evaluate-time from N and read off profile.mode, never set by user
93
+ # code; review fix UX-7. Still importable from factrix._axis.)
94
+ "FactorScope",
95
+ "Metric",
96
+ "Signal",
97
+ # Code enums
98
+ "InfoCode",
99
+ "StatCode",
100
+ "Verdict",
101
+ "WarningCode",
102
+ # Errors
103
+ "ConfigError",
104
+ "FactrixError",
105
+ "IncompatibleAxisError",
106
+ "InsufficientSampleError",
107
+ "MissingConfigError",
108
+ "ModeAxisError",
109
+ # Profile + dispatch
110
+ "FactorProfile",
111
+ "MetricOutput",
112
+ "evaluate",
113
+ # Introspection
114
+ "SuggestConfigResult",
115
+ "describe_analysis_modes",
116
+ "list_metrics",
117
+ "suggest_config",
118
+ # Multi-factor namespace
119
+ "multi_factor",
120
+ # Synthetic panels
121
+ "datasets",
122
+ ]