raiwidgets package

Package for the fairness, explanation, and error analysis widgets.

class raiwidgets.ErrorAnalysisDashboard(explanation, model=None, *, dataset=None, true_y=None, classes=None, features=None, port=None, locale=None, public_ip=None, categorical_features=None, true_y_dataset=None)[source]

Bases: raiwidgets.dashboard.Dashboard

ErrorAnalysis Dashboard Class.

Parameters
  • explanation (ExplanationMixin) – An object that represents an explanation.

  • model (object) – An object that represents a model. It is assumed that for the classification case it has a method of predict_proba() returning the prediction probabilities for each class and for the regression case a method of predict() returning the prediction value.

  • dataset (numpy.ndarray or list[][]) – A matrix of feature vector examples (# examples x # features), the same samples used to build the explanation. Overwrites any existing dataset on the explanation object.

  • true_y (numpy.ndarray or list[]) – The true labels for the provided explanation. Overwrites any existing dataset on the explanation object. Note if explanation is sample of dataset, you will need to specify true_y_dataset as well.

  • classes (numpy.ndarray or list[]) – The class names.

  • features (numpy.ndarray or list[]) – Feature names.

  • port (int) – The port to use on locally hosted service.

  • categorical_features (list[str]) – The categorical feature names.

  • true_y_dataset (numpy.ndarray or list[]) – The true labels for the provided dataset. Only needed if the explanation has a sample of instances from the original dataset. Otherwise specify true_y parameter only.

class raiwidgets.ExplanationDashboard(explanation, model=None, dataset=None, true_y=None, classes=None, features=None, public_ip=None, port=None, locale=None)[source]

Bases: raiwidgets.dashboard.Dashboard

The dashboard class, wraps the dashboard component.

Parameters
  • explanation (ExplanationMixin) – An object that represents an explanation.

  • model (object) – An object that represents a model. It is assumed that for the classification case flit has a method of predict_proba() returning the prediction probabilities for each class and for the regression case a method of predict() returning the prediction value.

  • dataset (numpy.ndarray or list[][]) – A matrix of feature vector examples (# examples x # features), the same samples used to build the explanation. Overwrites any existing dataset on the explanation object. Must have fewer than 10000 rows and fewer than 1000 columns.

  • true_y (numpy.ndarray or list[]) – The true labels for the provided dataset. Overwrites any existing dataset on the explanation object.

  • classes (numpy.ndarray or list[]) – The class names.

  • features (numpy.ndarray or list[]) – Feature names.

  • public_ip (str) – Optional. If running on a remote vm, the external public ip address of the VM.

  • port (int) – The port to use on locally hosted service.

class raiwidgets.FairnessDashboard(*, sensitive_features, y_true, y_pred, locale=None, public_ip=None, port=None, fairness_metric_module=None, fairness_metric_mapping=None)[source]

Bases: raiwidgets.dashboard.Dashboard

The dashboard class, wraps the dashboard component.

Parameters
  • sensitive_features (pandas.Series, pandas.DataFrame, list, Dict[str,1d array] or something convertible to numpy.ndarray) – The sensitive features These can be from the initial dataset, or reserved from training. If the input type provides names, they will be used. Otherwise, names of “Sensitive Feature <n>” are generated

  • y_true (numpy.ndarray or list[]) – The true labels or values for the provided dataset.

  • y_pred (pandas.Series, pandas.DataFrame, list, Dict[str,1d array] or something convertible to numpy.ndarray) – Array of output predictions from models to be evaluated. If the input type provides names, they will be used. Otherwise, names of “Model <n>” are generated

class raiwidgets.ModelPerformanceDashboard(model=None, dataset=None, true_y=None, classes=None, features=None, public_ip=None, port=None, locale=None)[source]

Bases: raiwidgets.dashboard.Dashboard

The dashboard class, wraps the dashboard component.

Parameters
  • model (object) – An object that represents a model. It is assumed that for the classification case flit has a method of predict_proba() returning the prediction probabilities for each class and for the regression case a method of predict() returning the prediction value.

  • dataset (numpy.ndarray or list[][]) – A matrix of feature vector examples (# examples x # features), the same samples used to build the explanation. Overwrites any existing dataset on the explanation object. Must have fewer than 10000 rows and fewer than 1000 columns.

  • true_y (numpy.ndarray or list[]) – The true labels for the provided dataset. Overwrites any existing dataset on the explanation object.

  • classes (numpy.ndarray or list[]) – The class names.

  • features (numpy.ndarray or list[]) – Feature names.

  • public_ip (str) – Optional. If running on a remote vm, the external public ip address of the VM.

  • port (int) – The port to use on locally hosted service.