class_docstr: AlphaBeta advanced as proposed by Alexander Binder.
class_docstr_tok: ["AlphaBeta","advanced","as","proposed","by","Alexander","Binder","."]
code: def __init__(
      self,
      layer: Layer,
      _state,
      alpha: tuple[float, float] = (0.5, 0.5),
      beta: tuple[float, float] = (0.5, 0.5),
      bias: bool = True,
      copy_weights: bool = False,
  ) -> None:
      self._alpha = alpha
      self._beta = beta
  
      # prepare positive and negative weights for computing positive
      # and negative preactivations z in apply_accordingly.
      if copy_weights:
          weights = layer.get_weights()
          if not bias and getattr(layer, "use_bias", False):
              weights = weights[:-1]
          positive_weights = [x * (x > 0) for x in weights]
          negative_weights = [x * (x < 0) for x in weights]
      else:
          weights = layer.weights
          if not bias and getattr(layer, "use_bias", False):
              weights = weights[:-1]
          positive_weights = [
              x * ibackend.cast_to_floatx(x > 0) for x in weights
          ]
          negative_weights = [
              x * ibackend.cast_to_floatx(x < 0) for x in weights
          ]
  
      self._layer_wo_act_positive = igraph.copy_layer_wo_activation(
          layer,
          keep_bias=bias,
          weights=positive_weights,
          name_template="reversed_kernel_positive_%s",
      )
      self._layer_wo_act_negative = igraph.copy_layer_wo_activation(
          layer,
          keep_bias=bias,
          weights=negative_weights,
          name_template="reversed_kernel_negative_%s",
      )
  
imports: from __future__ import annotations
  import numpy
  import tensorflow.keras.backend
  import tensorflow.keras.layers
  import innvestigate.analyzer.relevance_based.utils
  import innvestigate.backend
  import innvestigate.backend.graph
  import innvestigate.layers
  from innvestigate.backend.types import Layer, OptionalList, Tensor
label_desc: Use image node_id 1 to create a new AlphaBetaXRule object from inherited base classes: igraph with example: obj = AlphaBetaXRule(layer, _state, alpha, beta, bias, copy_weights)