SVEKER.ExplainingSVM

class SVEKER.ExplainingSVM(kernel_type='tanimoto', degree=3, gamma=1.0, coef0=0.0, no_player_value=0.0)

Base class for SVMs with exact Shapley values

__init__(kernel_type='tanimoto', degree=3, gamma=1.0, coef0=0.0, no_player_value=0.0) None

Initializes a SVM with exact Shapley values

Parameters:
  • kernel_type (str) – Kernel to be used, must be in ['tanimoto', 'rbf', 'poly', 'sigmoid']

  • gamma (float) – Parameter \(\gamma\), only for Polynomial, RBF, Sigmoid kernel.

  • degree (float) – Parameter \(d\), only for Polynomial kernel, must be non-negative.

  • coef0 (float) – Parameter \(r\), only for Polynomial, Sigmoid kernel.

shapley_values(x: ndarray)

Calculate the Shapley values for multiple query vectors.

Parameters:

vector (np.ndarray) – Vector(s) to be explained using Shapley values

Returns:

Shapley values for each feature in vector(s)

Return type:

np.ndarray