Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (56 sloc) 2.45 KB
from ..dise import DISExplainer
class BRCGExplainer(DISExplainer):
Boolean Rule Column Generation explainer. Provides access to
:class:`aix360.algorithms.rbm.boolean_rule_cg.BooleanRuleCG`, which
implements a directly interpretable supervised learning method
for binary classification that learns a Boolean rule in disjunctive
normal form (DNF) or conjunctive normal form (CNF) using column generation (CG).
AIX360 implements a heuristic beam search version of BRCG that is less
computationally intensive than the published integer programming version [#NeurIPS2018]_.
.. [#NeurIPS2018] `S. Dash, O. Günlük, D. Wei, "Boolean decision rules via
column generation." Neural Information Processing Systems (NeurIPS), 2018.
def __init__(self, model):
Initialize a BRCGExplainer object.
model: model to operate on, instance of :class:`aix360.algorithms.rbm.boolean_rule_cg.BooleanRuleCG`
super(BRCGExplainer, self).__init__()
self._model = model
def set_params(self, *argv, **kwargs):
Set parameters for the explainer.
def fit(self, X_train, Y_train, *argv, **kwargs):
"""Fit model to training data.
X_train (DataFrame): Binarized features with MultiIndex column labels
Y_train (array): Binary-valued target variable
BRCGExplainer: Self
""", Y_train, **kwargs)
def predict(self, X, *argv, **kwargs):
"""Predict class labels.
X (DataFrame): Binarized features with MultiIndex column labels
array: y -- Predicted labels
return self._model.predict(X, **kwargs)
def explain(self, *argv, **kwargs):
"""Return rules comprising the underlying model.
maxConj (int, optional): Maximum number of conjunctions to show
prec (int, optional): Number of decimal places to show for floating-value thresholds
Dictionary containing
* isCNF (bool): flag signaling whether model is CNF or DNF
* rules (list): selected conjunctions formatted as strings
return self._model.explain(**kwargs)
You can’t perform that action at this time.