xai_dashboard¶
- class virtualitics_sdk.elements.xai_dashboard.XAIDashboard(model, explainer, plot_data, x_axis_key, y_axis_key, pred_column, title='', description='', bounds=None, waterfall_positive_color=None, waterfall_negative_color=None, expected_title=None, predicted_title=None, top_n=None, train_data=None, encoding=None, color_by_category=False, show_title=True, show_description=True)¶
Bases:
Element
An XAI Dashboard to show the Scenario Planning Tool which allows users to interact with their data an explore scenarios that may have not been included in the original dataset. Using an existing
Model
andDataset
users can create potential new scenarios and use XAI to analyze the model’s prediction for these new inputs.- Parameters:
model (
Model
) – The model that is performing predictions on the data points.explainer (
Explainer
) – The explainer to use for the model.plot_data (
Dataset
) – The data to show on the plot.x_axis_key (
str
) – The key for the X-axis on this plot.y_axis_key (
str
) – The key for the Y-axis on this plot.pred_column (
str
) – The column in the data the prediction lies on.title (
str
) – The title of the element, defaults to ‘’.description (
str
) – The element’s description, defaults to ‘’.bounds (
Optional
[Dict
[str
,List
[Union
[int
,float
,str
]]]]) – An optional Dict of the bounds for the data. The keys will be column names and the values will be list that represent the domain, defaults to None.waterfall_positive_color (
Optional
[str
]) – The color of positive plots in the waterfall plot, defaults to None.waterfall_negative_color (
Optional
[str
]) – The color of negative plots in the waterfall plot, defaults to None.expected_title (
Optional
[str
]) – The expected title to show for the :class:`~virtualitics_sdk.elements.waterfall_plot.WaterfallPlot`s generated from this dashboard, defaults to “Expected Value”.predicted_title (
Optional
[str
]) – The predited title to show for the :class:`~virtualitics_sdk.elements.waterfall_plot.WaterfallPlot`s generated from this dashboard, defaults to “Final Prediction”.top_n (
Optional
[int
]) – Show only the top N values for the waterfall plot, defaults to None.train_data (
Optional
[Dataset
]) – Optionally pass in a separate trainingDataset
to use for the explainer, defaults to Noneencoding (
Optional
[DataEncoding
]) – The encoding of the categorical values in the dataset, Attempts to auto-determine if categorical variables are still found.color_by_category (
bool
) – Whether to color the scatterplot by category.show_title (
bool
) – whether to show the title on the page when rendered, defaults to True.show_description (
bool
) – whether to show the description to the page when rendered, defaults to True.
EXAMPLE:
# Imports from virtualitics_sdk.elements.xai_dashboard import XAIDashboard . . . # Example usage class ExampleStep(Step): def run(self, flow_metadata): . . . dash = XAIDashboard( xgb, explainer, prediction_dataset, "LandContour", "PredictedPrice", "PredictedPrice", title="", bounds=bounds, description=XAIDashboard.xai_dashboard_description(), train_data=explain_dataset, expected_title="Avg. Listed Price", predicted_title="Predicted Price", encoding=DataEncoding.ONE_HOT, )
- get_value()¶
Get the value of an element. If the user has interacted with the value, the default will be updated.
- static xai_dashboard_description()¶