trustworthyAI icon indicating copy to clipboard operation
trustworthyAI copied to clipboard

Allow more algorithm to use prior knowledge

Open xwbxxx opened this issue 2 years ago • 5 comments

Just like the example of PC algorithm,PC demo.py I hope you can provide interfaces to allow more algorithms to adopt a priori knowledge. image

xwbxxx avatar Sep 28 '22 05:09 xwbxxx

Hello,

Prior knowledge is something we plan to include in all algorithms in the future (as also mentioned in #72). However, there is no timeline for this as of yet.

shaido987 avatar Sep 28 '22 06:09 shaido987

@shaido987, is there a way to help with this task as a contributor?

AlxndrMlk avatar Sep 28 '22 07:09 AlxndrMlk

@AlxndrMlk Any contributions in this direction are very welcome! Prior knowledge can be a bit more difficult to integrate into some of the algorithms as compared with PC. If you want to help you can add it to one or multiple algorithms directly for now, and then we can see if the logic can be abstracted into the base class. Or if you have some suggestions in that direction we can look over them.

shaido987 avatar Sep 28 '22 08:09 shaido987

@shaido987

It seems that there were some attempts to introduce the possibility for adding causal knowledge to DirectLiNGAM (https://github.com/huawei-noah/trustworthyAI/blob/master/gcastle/castle/algorithms/lingam/direct_lingam.py), but it seems it does not work in the current version (1.0.3).

I am referring to these (lines 76-77):

@check_args_value(DIRECT_LINGAM_VALID_PARAMS)
def __init__(self, prior_knowledge=None, measure='pwling', thresh=0.3):
   ...

I tried adding a priori knowledge to Direct LiNGAM and it did not work for me (the model was not adding the edges passed to prior_knowlede)

I think that actually it is possible to add the prior knowledge functionality for Direct LiNGAM (it was described in the paper if I'm not mistaken).

Perhaps that would be a good first step for enhancing the palette of models that accept prior knowledge.

What are your thoughts on this?

AlxndrMlk avatar Apr 06 '23 19:04 AlxndrMlk

Yes, I agree that making sure that it works for DirectLiNGAM would be a good first step forward.

For the a prior knowledge added to the PC implementation (added in #73) we added a PrioriKnowledge class that can be used here. I believe it should have the same characteristics as the input matrix in DirectLiNGAM.

shaido987 avatar Apr 12 '23 05:04 shaido987