brk-code

shap の API リファレンス

shap (shap/shap) の公開 API 76 件 —— クラス 28、関数 27、メソッド 21。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。

リポジトリ: shap/shap

種別件数
クラス28
関数27
メソッド21

API 一覧

classshap._explanation.Explanation
A sliceable set of parallel arrays representing a SHAP explanation.
methodshap._explanation.Explanation.cohorts(cohorts:int | list[int] | tuple[int] | np.ndarray) -> Cohorts
Split this explanation into several cohorts.
methodshap._explanation.Explanation.hstack(other:Explanation) -> Explanation
Stack two explanations column-wise.
methodshap._explanation.Explanation.max(axis:int) -> Explanation
Numpy-style max function.
methodshap._explanation.Explanation.mean(axis:int) -> Explanation
Numpy-style mean function.
methodshap._explanation.Explanation.min(axis:int) -> Explanation
Numpy-style min function.
methodshap._explanation.Explanation.shape() -> tuple[int, ...]
Compute the shape over potentially complex data nesting.
methodshap._explanation.Explanation.sum(axis:int | None=None, grouping:dict[str, str] | None=None) -> Explanation
Numpy-style sum function.
methodshap._explanation.Explanation.values()
Pass-through from the underlying slicer object.
classshap._explanation.OpHistoryItem
An operation that has been applied to an Explanation object.
classshap._serializable.Deserializer
Load data items from an input stream.
classshap._serializable.Serializable
This is the superclass of all serializable objects.
methodshap._serializable.Serializable.save(out_file)
Save the model to the given file stream.
classshap._serializable.Serializer
Save data items to an input stream.
classshap.actions._action.Action
Abstract action class.
funcshap.datasets.a1a(n_points:int | None=None) -> tuple[ssp.csr_matrix, np.ndarray]
Return a sparse dataset in scipy csr matrix format.
funcshap.datasets.adult(display:bool=False, n_points:int | None=None) -> tuple[pd.DataFrame, np.ndarray]
Return the Adult census data in a structured format.
funcshap.datasets.cache(url:str, file_name:str | None=None) -> str
Loads a file from the URL and caches it locally.
funcshap.datasets.california(n_points:int | None=None) -> tuple[pd.DataFrame, np.ndarray]
Return the California housing data in a tabular format.
funcshap.datasets.diabetes(n_points:int | None=None) -> tuple[pd.DataFrame, np.ndarray]
Return the diabetes data in a nice package.
funcshap.datasets.imagenet50(resolution:int=224, n_points:int | None=None) -> tuple[np.ndarray, np.ndarray]
Return a set of 50 images representative of ImageNet images.
classshap.explainers._additive.AdditiveExplainer
Computes SHAP values for generalized additive models.
methodshap.explainers._additive.AdditiveExplainer.supports_model_with_masker(model:Any, masker:Any) -> bool
Determines if this explainer can handle the given model.
classshap.explainers._deep.DeepExplainer
Meant to approximate SHAP values for deep learning models.
funcshap.explainers._deep.deep_pytorch.linear_1d(module, grad_input, grad_output)
No change made to gradients.
funcshap.explainers._deep.deep_pytorch.passthrough(module, grad_input, grad_output)
No change made to gradients
classshap.explainers._exact.ExactExplainer
Computes SHAP values via an optimized exact enumeration.
funcshap.explainers._exact.gray_code_indexes(nbits:int) -> npt.NDArray[np.intp]
Produces an array of which bits flip at which position.
classshap.explainers._gpu_tree.GPUTreeExplainer
Experimental GPU accelerated version of TreeExplainer.
classshap.explainers._tree.SingleTree
A single decision tree.
classshap.explainers._tree.TreeEnsemble
An ensemble of decision trees.
methodshap.explainers._tree.TreeEnsemble.get_transform() -> str
A consistent interface to make predictions from this model.
methodshap.explainers._tree.TreeExplainer.supports_model_with_masker(model:Any, masker:Any) -> bool
Determines if this explainer can handle the given model.
classshap.explainers._tree.XGBTreeModelLoader
This loads an XGBoost model directly from a raw memory dump.
funcshap.explainers._tree.XGBTreeModelLoader.to_integers(data:list[int]) -> np.ndarray
Handle u8 array from UBJSON.
classshap.explainers.other._maple.Maple
Simply wraps MAPLE into the common SHAP interface.
classshap.explainers.other._maple.TreeMaple
Simply tree MAPLE into the common SHAP interface.
classshap.explainers.pytree.TreeExplainer
A pure Python (slow) implementation of Tree SHAP.
funcshap.links.identity(x:npt.NDArray[Any] | float) -> npt.NDArray[Any] | float
A no-op link function.
methodshap.maskers._composite.Composite.data_transform(*args:Any) -> list[Any]
Transform the argument
methodshap.maskers._composite.Composite.mask_shapes(*args:Any) -> list[Any]
The shape of the masks we expect.
classshap.maskers._image.Image
Masks out image regions with blurring or inpainting.
methodshap.maskers._image.Image.save(out_file)
Write a Image masker to a file stream.
classshap.maskers._masker.Masker
This is the superclass of all maskers.
classshap.maskers._tabular.Tabular
A common base class for Independent and Partition.
methodshap.maskers._tabular.Tabular.save(out_file)
Write a Tabular masker to a file stream.
classshap.maskers._text.SimpleTokenizer
A basic model agnostic tokenizer.
classshap.maskers._text.Text
This masks out tokens according to the given tokenizer.
methodshap.maskers._text.Text.load(in_file, instantiate=True)
Load a Text masker from a file stream.
methodshap.maskers._text.Text.mask_shapes(s)
The shape of the masks we expect.
methodshap.maskers._text.Text.save(out_file)
Save a Text masker to a file stream.
methodshap.maskers._text.Text.shape(s)
The shape of what we return as a masker.
classshap.maskers._text.Token
A token representation used for token clustering.
classshap.models._model.Model
This is the superclass of all models.
methodshap.models._model.Model.save(out_file:BinaryIO) -> None
Save the model to the given file stream.
classshap.models._text_generation.TextGeneration
Generates target sentence/ids using a base model.
classshap.plots._decision.DecisionPlotResult
The optional return value of decision_plot.
funcshap.plots._decision.multioutput_decision(base_values, shap_values, row_index, **kwargs) -> DecisionPlotResult | None
Decision plot for multioutput models.
classshap.plots._force.AdditiveForceVisualizer
Visualizer for a single Additive Force plot.
funcshap.plots._force.save_html(out_file, plot, full_html=True)
Save html plots to an output file.
funcshap.plots._force_matplotlib.draw_additive_plot(data, figsize, show, text_rotation=0, min_perc=0.05)
Draw additive plot.
funcshap.plots._force_matplotlib.draw_bars(out_value, features, feature_type, width_separators, width_bar)
Draw the bars and separators.
funcshap.plots._force_matplotlib.format_data(data)
Format data.
funcshap.plots._monitoring.monitoring(ind, shap_values, features, feature_names=None, show=True)
Create a SHAP monitoring plot.
classshap.plots._style.StyleOptions
A TypedDict of partial updates to a style configuration
funcshap.plots._style.get_style() -> StyleConfig
Return all currently active global style configuration options.
funcshap.plots._style.load_default_style() -> StyleConfig
Load the default style configuration.
funcshap.plots._style.set_style(_style:StyleConfig | None=None, **options:Unpack[StyleOptions]) -> None
Set options in the currently active global style configuration.
funcshap.plots._text.values_min_max(values, base_values)
Used to pick our axis limits.
funcshap.plots._utils.fill_counts(partition_tree)
This updates the
funcshap.plots.colors._colorconv.xyz2rgb(xyz)
XYZ to RGB color space conversion.
classshap.utils._exceptions.ExplainerError
Generic errors related to Explainers
funcshap.utils._general.format_value(s:Any, format_str:str) -> str
Strips trailing zeros and uses a unicode minus sign.
funcshap.utils._general.ordinal_str(n:int) -> str
Converts a number to and ordinal string.
funcshap.utils._general.sample(X:_ArrayT, nsamples:int=100, random_state:int=0) -> _ArrayT
Performs sampling without replacement of the input data ``X``.
funcshap.utils._legacy.convert_to_model(val, keep_index=False)
Convert a model to a Model object.

この情報について

掲載しているシグネチャは shap/shap の公開ソースコードを Python の ast モジュールで静的解析し、引数名・デフォルト値・ 型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。 詳しくは仕組みの解説をご覧ください。

収録ライブラリ一覧(全 805 件)へ戻る