causy-dev / causy

Causal discovery made easy.
https://causy-dev.github.io/causy/
MIT License
40 stars 1 forks source link

feat(export): make algorithm/pipeline info part of export + add in no… #6

Closed LilithWittmann closed 1 year ago

LilithWittmann commented 1 year ago

Until now we internally used the node names as references. But this has a lot of potential pitfalls (e.g. naming two dimensions the same…). Therefore we now internally use uuids instead of dimension names.

Also the format of the output file changes quite a bit. This also us to store additional meta data which will be helpful when displaying results in causy-ui.

Old format:

[
    {
        "step": "CalculateCorrelations",
        "actions": [
            {
                "x": "A",
                "y": "B",
                "action": "UPDATE_EDGE"
            },
          …
        ]
   }
]

New format:

{
    "name": "PC",
    "created_at": "2023-10-20T21:43:40.493296",
    "algorithm": {
        "type": "default",
        "reference": "PC"
    },
    "steps": [
        {
            "step": "CalculateCorrelations",
            "actions": []
        },
        {
            "step": "ExtendedPartialCorrelationTestMatrix",
            "actions": []
        },
        {
            "step": "ColliderTest",
            "actions": [
                {
                    "x": {
                        "id": "5cf5c39d-22aa-4e52-a05e-0d7f91061939",
                        "name": "D"
                    },
                    "y": {
                        "id": "987d8977-7c6f-45b2-b39e-d47c0b85a219",
                        "name": "A"
                    },
                    "action": "REMOVE_EDGE_DIRECTED"
                }
            ]
        },
        {
            "step": "NonColliderTest",
            "actions": []
        },
        {
            "step": "FurtherOrientTripleTest",
            "actions": []
        },
        {
            "step": "OrientQuadrupleTest",
            "actions": []
        },
        {
            "step": "FurtherOrientQuadrupleTest",
            "actions": []
        }
    ],
    "nodes": {
        "987d8977-7c6f-45b2-b39e-d47c0b85a219": {
            "id": "987d8977-7c6f-45b2-b39e-d47c0b85a219",
            "name": "A"
        },
        "a7d45b15-186d-47a2-9ec9-118395f4e714": {
            "id": "a7d45b15-186d-47a2-9ec9-118395f4e714",
            "name": "C"
        },
    },
    "edges": [
        [
            {
                "id": "987d8977-7c6f-45b2-b39e-d47c0b85a219",
                "name": "A"
            },
            {
                "id": "b6f7484e-ac14-4261-ac80-a441f2a33465",
                "name": "C"
            }
        ]
    ]
}