BioExp.graphs package¶
Submodules¶
BioExp.graphs.causal module¶
BioExp.graphs.concept module¶
-
class
BioExp.graphs.concept.
ConceptGraph
(model, weights_pth, metric, layer_names, max_clusters=None)[source]¶ Bases:
object
A class for generating concept graph on a trained keras model instance
-
generate_fmaps
(nodeA_info, nodeB_info, dataset_path, loader, save_path)[source]¶ get link between two nodes, nodeA, nodeB occlude at nodeA and observe changes in nodeB
nodeA_info : {‘layer_name’, ‘layer_idxs’} nodeB_info : {‘layer_name’, ‘layer_idxs’}
-
generate_graph
(graph_info, dataset_path=None, loader=None, save_path=None)[source]¶ generates graph adj matrix for computation
graph_info: {‘concept_name’, ‘layer_name’, ‘feature_map_idxs’} save_path : graph_path or path to save graph
-
generate_link
(fmaps)[source]¶ links is some norm information of feature activation maps
fmaps: activation maps
-
BioExp.graphs.delta module¶
-
class
BioExp.graphs.delta.
DeltaGraph
(model, weights_pth, metric, classinfo=None)[source]¶ Bases:
object
A class for generating concept graph on a trained keras model instance
-
generate_graph
(graph_info, dataset_path=None, loader=None, save_path=None, max_samples=1, nmontecarlo=10)[source]¶ generates graph adj matrix for computation
graph_info: [{‘concept_name’, ‘layer_name’, ‘filter_idxs’}] save_path : graph_path or path to save graph
-
get_link
(nodeA_info, nodeB_info, dataset_path, loader, save_path, max_samples=1)[source]¶ get link between two nodes, nodeA, nodeB occlude at nodeA and observe changes in nodeB
nodeA_info : {‘layer_name’, ‘layer_idxs’} nodeB_info : {‘layer_name’, ‘layer_idxs’}
-
BioExp.graphs.significance module¶
-
class
BioExp.graphs.significance.
SignificanceTester
(model, weights_pth, metric, classinfo=None)[source]¶ Bases:
object
A class for testing significance of each concepts generated in a trained keras model instance