Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion giskard/push/contribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
- existing_shap_values: Check if SHAP values exist.

"""
from typing import Optional

import numpy as np
import pandas as pd
from scipy.stats import zscore
Expand Down Expand Up @@ -126,7 +128,7 @@ def _create_text_contribution_push(shap_feature, sliced_ds, model, raw_predictio
)


def create_contribution_push(model: BaseModel, ds: Dataset, df: pd.DataFrame) -> ContributionPush:
def create_contribution_push(model: BaseModel, ds: Dataset, df: pd.DataFrame) -> Optional[ContributionPush]:
"""
Create contribution notification from SHAP values.

Expand All @@ -143,6 +145,9 @@ def create_contribution_push(model: BaseModel, ds: Dataset, df: pd.DataFrame) ->
Returns:
ContributionPush if outlier contribution found, else None
"""
if model.is_text_generation:
return None

# Check if there is only one feature type in the dataset, and if it's "text"
_text_is_the_only_feature = len(ds.column_types.values()) == 1 and list(ds.column_types.values())[0] == "text"

Expand Down