lczerolens.lenses.composite#

Composite lens for XAI.

Classes#

CompositeLens

Composite lens for XAI.

Module Contents#

class lczerolens.lenses.composite.CompositeLens(lenses, merge_results=True)[source]#

Bases: lczerolens.lens.Lens

Composite lens for XAI.

Examples

model = LczeroModel.from_path(model_path)
lens = CompositeLens([ActivationLens(), GradientLens()])
board = LczeroBoard()
results = lens.analyse(board, model=model)
Parameters:
_lens_map[source]#
merge_results = True[source]#
is_compatible(model)[source]#

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, **kwargs)[source]#

Prepare the model for the lens.

Parameters:

model (LczeroModel) – The NNsight model.

Returns:

The prepared model.

Return type:

LczeroModel

_intervene(model, **kwargs)[source]#

Intervene on the model.

Parameters:

model (LczeroModel) – The NNsight model.

Returns:

The intervention results.

Return type:

dict