lczerolens.lenses.composite#

Composite lens for XAI.

class lczerolens.lenses.composite.CompositeLens(lenses: List[Lens] | Dict[str, Lens], merge_results: bool = True)#

Bases: Lens

Composite lens for XAI.

Examples

model = LczeroModel.from_path(model_path)
lens = CompositeLens([ActivationLens(), GradientLens()])
board = LczeroBoard()
results = lens.analyse(board, model=model)
is_compatible(model: LczeroModel) bool#

Returns whether the lens is compatible with the model.

Parameters:

model (LczeroModel) – The NNsight model.

Returns:

Whether the lens is compatible with the model.

Return type:

bool

prepare(model: LczeroModel, **kwargs) LczeroModel#

Prepare the model for the lens.

Parameters:

model (LczeroModel) – The NNsight model.

Returns:

The prepared model.

Return type:

LczeroModel