Skip to content

Commit

Permalink
update core.py docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
kyosek committed Jul 25, 2023
1 parent 5cec6f0 commit 7438f84
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions focus/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


class Focus:
"""
r"""
FOCUS Lucic, et al. 2022 computes
Counterfactual Explanations (CFE) using the gradient descent
method for predictions of the tree-based models.
Expand Down Expand Up @@ -100,7 +100,7 @@ def __init__(
self.verbose = verbose

def generate(self, model, X, x_train=None):
"""
r"""
Generate counterfactual explanations for the
predictions from a tree-based model.
Expand Down Expand Up @@ -214,7 +214,7 @@ def generate(self, model, X, x_train=None):

@staticmethod
def prepare_features_by_perturb_direction(model, X: np.ndarray, direction: str):
"""
r"""
Prepares the input data `X` based on the perturbation direction.
Args:
Expand Down Expand Up @@ -267,7 +267,7 @@ def compute_gradient(
temperature,
optimizer,
):
"""
r"""
Computes the gradient of the loss function with respect to the variables to optimize.
Returns:
Expand Down Expand Up @@ -302,7 +302,7 @@ def compute_gradient(

@staticmethod
def parse_class_tree(tree, X, sigma: float) -> list:
"""
r"""
Compute impurity of each leaf node in a decision tree and approximate it using sigmoid function.
Args:
Expand Down Expand Up @@ -362,7 +362,7 @@ def parse_class_tree(tree, X, sigma: float) -> list:

@staticmethod
def get_prob_classification_tree(tree, X, sigma: float) -> tf.Tensor:
"""
r"""
get_prob_classification_tree - computes the probability of each sample's classification in a decision tree
Args:
Expand Down Expand Up @@ -420,7 +420,7 @@ def get_prob_classification_tree(tree, X, sigma: float) -> tf.Tensor:
def get_prob_classification_forest(
model, X: tf.Tensor, sigma: float, temperature: float
) -> tf.Tensor:
"""
r"""
Calculate the softmax probabilities for classification for a random forest or AdaBoost model.
Args:
Expand Down Expand Up @@ -472,7 +472,7 @@ def filter_hinge_loss(
temperature,
model,
) -> tf.Tensor:
"""
r"""
Calculates the filtered probabilities of each data point for the given model.
Args:
Expand Down

0 comments on commit 7438f84

Please sign in to comment.