bigframes.bigquery.ml.explain_predict#

bigframes.bigquery.ml.explain_predict(model: BaseEstimator | str | Series, input_: DataFrame | DataFrame | str, *, top_k_features: int | None = None, threshold: float | None = None, integrated_gradients_num_steps: int | None = None, approx_feature_contrib: bool | None = None) DataFrame[source]#

Runs explainable prediction on a BigQuery ML model.

See the BigQuery ML EXPLAIN_PREDICT function syntax for additional reference.

Parameters:
  • model (bigframes.ml.base.BaseEstimator or str) – The model to use for prediction.

  • input (Union[bigframes.pandas.DataFrame, str]) – The DataFrame or query to use for prediction.

  • top_k_features (int, optional) – The number of top features to return.

  • threshold (float, optional) – The threshold for binary classification models.

  • integrated_gradients_num_steps (int, optional) – an INT64 value that specifies the number of steps to sample between the example being explained and its baseline. This value is used to approximate the integral in integrated gradients attribution methods. Increasing the value improves the precision of feature attributions, but can be slower and more computationally expensive.

  • approx_feature_contrib (bool, optional) – A BOOL value that indicates whether to use an approximate feature contribution method in the XGBoost model explanation.

Returns:

The prediction results with explanations.

Return type:

bigframes.pandas.DataFrame