bigframes.ml.linear_model.LogisticRegression.predict_explain#
- LogisticRegression.predict_explain(X: DataFrame | Series | DataFrame | Series, *, top_k_features: int = 5) DataFrame[source]#
Explain predictions for a logistic regression model.
Note
Output matches that of the BigQuery ML.EXPLAIN_PREDICT function. See: https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-explain-predict
- Parameters:
or (X (bigframes.dataframe.DataFrame or bigframes.series.Series)
pandas.core.series.Series) (pandas.core.frame.DataFrame or) – Series or a DataFrame to explain its predictions.
top_k_features (int, default 5) –
an INT64 value that specifies how many top feature attribution pairs are generated for each row of input data. The features are ranked by the absolute values of their attributions.
By default, top_k_features is set to 5. If its value is greater than the number of features in the training data, the attributions of all features are returned.
- Returns:
The predicted DataFrames with explanation columns.
- Return type: