@@ -420,7 +420,9 @@ def _get_bokeh_plot_dict(self):
420420
421421
422422class BackgroundGenerator :
423- r"""Generate a background for the SHAP explainer via one of three algorithms:
423+ r"""Generate a background for the SHAP explainer
424+
425+ Generate a background for the SHAP explainer via one of three algorithms:
424426
425427 * `sample`: Randomly sample a set of provided points
426428 * `kmeans`: Summarize a set of provided points into k centroids
@@ -502,33 +504,35 @@ def counterfactual(
502504 The number of background datapoints to generate per goal.
503505 Keyword Arguments:
504506 * k_seeds: int
505- (default=5 ) For each goal, a number of starting seeds from `datapoints` are used
507+ (default= ``5`` ) For each goal, a number of starting seeds from `datapoints` are used
506508 to start the search from. These are the `k_seeds` points within `datapoint`
507509 whose corresponding outputs are closet to the goal output. Choose a larger
508510 number to get a more diverse background dataset, but the search might require
509511 larger `max_attempt_count`, `step_count`, and `timeout_seconds` to get good results.
510512 * goal_threshold: float
511- (default=.01) The distance (percentage) threshold defining whether
513+ (default= `` .01`` ) The distance (percentage) threshold defining whether
512514 a particular output satisfies the goal. Set to 0 to require an exact match, but
513- this will likey require larger `max_attempt_count`, `step_count`,
515+ this will likely require larger `max_attempt_count`, `step_count`,
514516 and `timeout_seconds` to get good results.
515517 * chain: boolean
516- (default=False) If chaining is set to `true`, found counterfactual datapoints
518+ (default= `` False`` ) If chaining is set to `true`, found counterfactual datapoints
517519 will be added to the search seeds for subsequent searches. This is useful when a
518520 range of counterfactual outputs is desired; for example, if the desired goals are
519- [0, 1, 2, 3], whichever goal is closest to the closest point within `datapoints` will
520- be searched for first. The found counterfactuals from that search are then included
521- in the search for the second-closest goal, and so on. This is especially helpful
522- if the extremes of the goal range are far outside the range produced by the
521+ [0, 1, 2, 3], whichever goal is closest to the closest point within `datapoints`
522+ will be searched for first. The found counterfactuals from that search are then
523+ included in the search for the second-closest goal, and so on. This is especially
524+ helpful if the extremes of the goal range are far outside the range produced by the
523525 `datapoints`. If only
524526 * max_attempt_count: int
525- If no valid counterfactual can be found for a starting seed in the search, the point
526- is slightly perturbed and search is retried. This parameter sets the maximum
527- number of perturbation-retry cycles are allowed during generation.
527+ (default= ``5'`) If no valid counterfactual can be found for a starting seed in the
528+ search, the point is slightly perturbed and search is retried. This parameter sets
529+ the maximum number of perturbation-retry cycles are allowed during generation.
528530 * step_count: int
529- (default=10,000 ) The number of datapoints to evaluate during the search
531+ (default= ``5_000`` ) The number of datapoints to evaluate during the search
530532 * timeout_seconds: int
531- (default=30) The maximum number of seconds allowed for each counterfactual search
533+ (default= ``3``) The maximum number of seconds allowed for each counterfactual search.
534+ This will set the maximum runtime of the search to roughly
535+ `timeout_seconds` * `max_attempt_count` * `k_per_goal` * `len(goals)`
532536
533537 Returns
534538 -------
@@ -610,19 +614,19 @@ def __init__(
610614 Otherwise, choose ``IDENTITY``.
611615 Keyword Arguments:
612616 * samples: int
613- (default=None) The number of samples to use when computing SHAP values. Higher
617+ (default= `` None`` ) The number of samples to use when computing SHAP values. Higher
614618 values will increase explanation accuracy, at the cost of runtime. If none,
615619 samples will equal 2048 + 2*n_features
616620 * seed: int
617- (default=0 ) The random seed to be used when generating explanations.
621+ (default= ``0`` ) The random seed to be used when generating explanations.
618622 * batchSize: int
619- (default=20 ) The number of batches passed to the PredictionProvider at once.
620- When uusing :class:`~Model` with `arrow=False ` this parameter has no effect.
623+ (default= ``20`` ) The number of batches passed to the PredictionProvider at once.
624+ When using :class:`~Model` with `disable_arrow=True ` this parameter has no effect.
621625 If `arrow=True`, `batch_sizes` of around
622626 :math:`\frac{{2000}}{{\mathtt{{len(background)}}}}` can produce significant
623627 performance gains.
624628 * trackCounterfactuals : bool
625- (default=False) Keep track of produced byproduct counterfactuals during SHAP run.
629+ (default= `` False`` ) Keep track of produced byproduct counterfactuals during SHAP run.
626630
627631 Returns
628632 -------
0 commit comments