flopsearch 0.2.1__pp310-pypy310_pp73-musllinux_1_2_aarch64.whl
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.
- flopsearch/__init__.py +5 -0
- flopsearch/__init__.pyi +25 -0
- flopsearch/flopsearch.pypy310-pp73-aarch64-linux-gnu.so +0 -0
- flopsearch/py.typed +0 -0
- flopsearch-0.2.1.dist-info/METADATA +57 -0
- flopsearch-0.2.1.dist-info/RECORD +8 -0
- flopsearch-0.2.1.dist-info/WHEEL +4 -0
- flopsearch.libs/libgcc_s-39080030.so.1 +0 -0
flopsearch/__init__.py
ADDED
flopsearch/__init__.pyi
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
def flop(
|
|
5
|
+
data: np.ndarray,
|
|
6
|
+
lambda_bic: float,
|
|
7
|
+
*,
|
|
8
|
+
restarts: Optional[int] = None,
|
|
9
|
+
timeout: Optional[float] = None,
|
|
10
|
+
) -> np.ndarray:
|
|
11
|
+
"""
|
|
12
|
+
Run the FLOP causal discovery algorithm.
|
|
13
|
+
|
|
14
|
+
Parameters
|
|
15
|
+
----------
|
|
16
|
+
data: A data matrix with rows corresponding to observations and columns to variables/nodes.
|
|
17
|
+
lambda_bic: The penalty parameter of the BIC, a typical value for structure learning is 2.0.
|
|
18
|
+
restarts: Optional parameter specifying the number of ILS restarts. Either restarts or timeout (below) need to be specified.
|
|
19
|
+
timeout: Optional parameter specifying a timeout after which the search returns. At least one local search is run up to a local optimum. Either restarts or timeout need to be specified.
|
|
20
|
+
|
|
21
|
+
Returns
|
|
22
|
+
-------
|
|
23
|
+
A matrix encoding a CPDAG or DAG. The entry in row i and column j is 1 in case of a directed edge from i to j and 2 in case of an undirected edge between those nodes (the entry in row j and column i will also be a 2, that is each undirected edge induces two 2's in the matrix).
|
|
24
|
+
"""
|
|
25
|
+
...
|
|
Binary file
|
flopsearch/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flopsearch
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Summary: Python package providing an implementation of the FLOP causal discovery algorithm for linear additive noise models
|
|
8
|
+
Keywords: causal discovery,DAGs,Bayesian networks,structure learning
|
|
9
|
+
Author: Marcel Wienöbst, Sebastian Weichwald, Leonard Henckel
|
|
10
|
+
License-Expression: MPL-2.0
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
13
|
+
Project-URL: Repository, https://github.com/CausalDisco/flopsearch
|
|
14
|
+
Project-URL: Issues, https://github.com/CausalDisco/flopsearch/issues
|
|
15
|
+
|
|
16
|
+
# flopsearch
|
|
17
|
+
|
|
18
|
+
Python package providing an implementation of the FLOP causal discovery algorithm for linear additive noise models.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
flopsearch can be installed via pip:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install flopsearch
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Citing FLOP
|
|
28
|
+
If you use FLOP in your scientific work, please cite this paper:
|
|
29
|
+
```bibtex
|
|
30
|
+
@article{cifly2025,
|
|
31
|
+
author = {Marcel Wien{"{o}}bst and Leonard Henckel and Sebastian Weichwald},
|
|
32
|
+
title = {{Embracing Discrete Search: A Reasonable Approach to Causal Structure Learning}},
|
|
33
|
+
journal = {{arXiv preprint arXiv:2510.04970}},
|
|
34
|
+
year = {2025}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
A simple example run of the FLOP algorithm provided by flopsearch.
|
|
40
|
+
|
|
41
|
+
``` py
|
|
42
|
+
import flopsearch
|
|
43
|
+
import numpy as np
|
|
44
|
+
from scipy import linalg
|
|
45
|
+
|
|
46
|
+
p = 10
|
|
47
|
+
W = np.diag(np.ones(p - 1), 1)
|
|
48
|
+
X = np.random.randn(10000, p).dot(linalg.inv(np.eye(p) - W))
|
|
49
|
+
X_std = (X - np.mean(X, axis=0)) / np.std(X, axis=0)
|
|
50
|
+
flopsearch.flop(X_std, 2.0, restarts=50)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Input and Output
|
|
54
|
+
As input, FLOP takes the data matrix, the BIC penalty parameter (we recommend ```2.0``` as a default choice) and either a ```timeout``` (in seconds) or the number of ILS restarts to control how long the search runs.
|
|
55
|
+
|
|
56
|
+
The output of FLOP is a CPDAG encoded with an adjacency matrix whose entry in row i and column j is 1 in case of a directed edge from the i-th to the j-th variable and 2 in case of an undirected edge between those variables (in case of an undirected edge, the entry in row j and column i is also 2, that is each undirected edge induces two 2's in the matrix).
|
|
57
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
flopsearch-0.2.1.dist-info/METADATA,sha256=WtG22FLvEokegOCLx0VTFabe3PmXZ7kSaFMxrAaaGUM,2275
|
|
2
|
+
flopsearch-0.2.1.dist-info/WHEEL,sha256=3gtbvScOLf-RZqqhP5oXmH-OzyACot3_IXILT51AfvM,116
|
|
3
|
+
flopsearch.libs/libgcc_s-39080030.so.1,sha256=fIO6GHOh8Ft9CR0Geu7wSUb9Xnl122iTtrxQQ9TAkTQ,789673
|
|
4
|
+
flopsearch/__init__.py,sha256=UqRJYN7saLZWFc0psFyiG39C208VD3OUvagoo2sxfq0,123
|
|
5
|
+
flopsearch/__init__.pyi,sha256=seVc-AOZrar0YHazomEwlN6rVD_vDzOiDDnJ3rlBgjA,1119
|
|
6
|
+
flopsearch/flopsearch.pypy310-pp73-aarch64-linux-gnu.so,sha256=_9eeLRtQqACMuBDhN2QpIQxZDv5E9RDPGWqnrSNHGaI,1051545
|
|
7
|
+
flopsearch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
flopsearch-0.2.1.dist-info/RECORD,,
|
|
Binary file
|