waterfall_plot¶
- class virtualitics_sdk.elements.waterfall_plot.DataType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
- CATEGORICAL = 'categorical'¶
- NUMERICAL = 'numerical'¶
- class virtualitics_sdk.elements.waterfall_plot.WaterfallPlot(title, expected, returned, pred_explanation, x_axis_label, data, description='', positive_color=None, negative_color=None, expected_title=None, predicted_title=None, show_title=True, show_description=True, **kwargs)¶
Bases:
Plot
Waterfall plots are usually generated by the
Explainer
class and are not recommended creating manually.EXAMPLE:
# Imports from xgboost import XGBRegressor from virtualitics_sdk.assets.explainer import Explainer . . . # Example usage def produce_waterfall_xai_plot(data): . . . # Creating Virtualitics Ensemble Model xgb = Model( XGBRegressor(learning_rate=0.1, n_jobs=-1, n_estimators=100, max_depth=5, eval_metric="mae", random_state=42), label="pmx", name="remaining useful life predictor", ) # Training Virtualitics Ensemble Model xgb.fit(modeling_data[ohe_features], modeling_data[target]) # Create explainer training data asset explain_data = Dataset( modeling_data[ohe_features], label="pmx", name="explainer modeling set", categorical_cols=categorical_ft_cols, encoding=DataEncoding.ONE_HOT, ) # Create explainer for ensemble model explainer = Explainer( model=xgb, training_data=explain_data, output_names=target, mode="regression", label="pmx project", name="ensemble model", use_shap=True, use_lime=False, ) plot = explainer.explain( explain_instances[ohe_features], method="manual", titles=titles, expected_title="Average Gearbox Lifespan", predicted_title="Predicted Gearbox Lifespan", return_as="plots", )
- to_json()¶
Convert the element to a JSON.
- Returns:
A JSON dictionary of the element.
- class virtualitics_sdk.elements.waterfall_plot.WaterfallPlotData(name, weight, value, explanation, type, _min=None, _max=None, percentile=None, count=None, frequency=None)¶
Bases:
PlotDataPoint
- to_json()¶