SVEKER
.ExplainingSVR¶
- class SVEKER.ExplainingSVR(*, kernel_type: Literal['rbf', 'tanimoto', 'poly', 'simgoid'] = 'rbf', degree: int = 3, gamma: float = 1.0, coef0: float = 0, tol: float = 0.001, C: float = 1, epsilon: float = 0.1, shrinking: bool = True, cache_size: float = 200, verbose: bool = False, max_iter: int = -1, no_player_value=0.0)¶
Class for SVR with exact Shapley values. Inherits from
ExplainingSVM
and from sklearn.SVR.For documentation of the
sklearn
methods, please take a look at the documentation there. Here, only the newly implemented methods will be discussed.- __init__(*, kernel_type: Literal['rbf', 'tanimoto', 'poly', 'simgoid'] = 'rbf', degree: int = 3, gamma: float = 1.0, coef0: float = 0, tol: float = 0.001, C: float = 1, epsilon: float = 0.1, shrinking: bool = True, cache_size: float = 200, verbose: bool = False, max_iter: int = -1, no_player_value=0.0) None ¶
Initializes SVC with exact Shapley values.
- Parameters:
C (float) – Regularization parameter
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.
epsilon (float)
shrinking (bool) – Wheter to use shrinking heuristic
cache_size (float) – Kernel chache size
class_weight (dict or 'balanced') – Set the parameter \(C\) of class :mahtL`i` to
class_weight[i]*C
for SVC, if not given, all classes will have the weight of unity.verbose (bool) – Enables verbose output
max_iter (int) – Maximum number of iterations, if -1 no limit
no_player_value (float) – Defines the no player value
- property expected_value¶
Expected value
- Returns:
Expected value
- Return type:
float
- fit(X, y, sample_weight=None)¶
Fits the classifier and saves the explicit support vectors.
- Parameters:
X (array_like) – Training vectors
y (array_like) – Target values
sample_weights (array_like or None) – Per-sample weight
- set_params(**params)¶
Sets the parameters of the class. Necessary in order to work with sklearn Pipelines and grid searches
- Parameters:
params – parameter to change with corresponding value
- Returns:
Returns Class with changed parameters.
- 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