How to efficiently assign forbidden edges by nodes?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 274
- PR merge metrics
- No merged PRs in 30d
Description
I currently use the following code to add forbidden edges, but it's taking so long when the adjacency matrix (in the example below named partial_order) is large for adding background knowledge, is there any way to make this more efficient in the causal-learn package?
import numpy as np
nodenames = final_df.columns
bk= BackgroundKnowledge()
position_matrix = np.argwhere(partial_order == 1)
for coordinate in position_matrix:
x, y = coordinate
node1 = nodenames[x]
node2 = nodenames[y]
bk.add_forbidden_by_node(GraphNode(node2), GraphNode(node1))
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining BackgroundKnowledge.add_forbidden_by_node and the loop over np.argwhere(partial_order == 1). Compare the current approach with the package's existing background-knowledge APIs, then verify that large matrices produce the same forbidden edges with substantially better runtime.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100