***********************
:py:mod:`wildboar.base`
***********************
.. py:module:: wildboar.base
.. autoapi-nested-parse::
Base classes for all estimators.
..
!! processed by numpydoc !!
Classes
-------
.. autoapisummary::
wildboar.base.BaseEstimator
wildboar.base.CounterfactualMixin
wildboar.base.ExplainerMixin
Functions
---------
.. autoapisummary::
wildboar.base.is_counterfactual
wildboar.base.is_explainer
.. raw:: html
.. py:class:: BaseEstimator
Base estimator for all Wildboar estimators.
..
!! processed by numpydoc !!
.. py:method:: get_metadata_routing()
Get metadata routing of this object.
Please check :ref:`User Guide ` on how the routing
mechanism works.
:Returns:
**routing** : MetadataRequest
A :class:`~sklearn.utils.metadata_routing.MetadataRequest` encapsulating
routing information.
..
!! processed by numpydoc !!
.. py:method:: get_params(deep=True)
Get parameters for this estimator.
:Parameters:
**deep** : bool, default=True
If True, will return the parameters for this estimator and
contained subobjects that are estimators.
:Returns:
**params** : dict
Parameter names mapped to their values.
..
!! processed by numpydoc !!
.. py:method:: set_params(**params)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as :class:`~sklearn.pipeline.Pipeline`). The latter have
parameters of the form ``__`` so that it's
possible to update each component of a nested object.
:Parameters:
**\*\*params** : dict
Estimator parameters.
:Returns:
**self** : estimator instance
Estimator instance.
..
!! processed by numpydoc !!
.. py:class:: CounterfactualMixin
Mixin class for counterfactual explainer.
..
!! processed by numpydoc !!
.. py:method:: score(x, y)
Score the counterfactual explainer in terms of closeness of fit.
:Parameters:
**x** : array-like of shape (n_samples, n_timestep)
The samples.
**y** : array-like of shape (n_samples, )
The desired counterfactal label.
:Returns:
float
The proximity.
..
!! processed by numpydoc !!
.. py:class:: ExplainerMixin
Mixin class for all explainers in wildboar.
..
!! processed by numpydoc !!
.. py:method:: fit_explain(estimator, x=None, y=None, **kwargs)
Fit and return the explanation.
:Parameters:
**estimator** : Estimator
The estimator to explain.
**x** : time-series, optional
The input time series.
**y** : array-like of shape (n_samples, ), optional
The labels.
**\*\*kwargs** : dict, optional
Optional extra arguments.
:Returns:
ndarray
The explanation.
..
!! processed by numpydoc !!
.. py:method:: plot(x=None, y=None, ax=None)
Plot the explanation.
:Parameters:
**x** : array-like, optional
Optional imput samples.
**y** : array-like, optional
Optional target labels.
**ax** : Axes, optional
Optional axes to plot to.
:Returns:
Axes
The axes object.
..
!! processed by numpydoc !!
.. py:function:: is_counterfactual(estimator)
Check if estimator is a counterfactual explainer.
:Parameters:
**estimator** : object
The estimator.
:Returns:
bool
True if the estimator probably is a counterfactual explainer.
..
!! processed by numpydoc !!
.. py:function:: is_explainer(estimator)
Check if estimator is an explainer.
:Parameters:
**estimator** : object
The estimator.
:Returns:
bool
True if the estimator probably is an explainer.
..
!! processed by numpydoc !!