Skip to content

Commit 6837cd7

Browse files
authored
Merge pull request #99868 from trevorbye/master
predict_proba documentation
2 parents 98689b1 + 9e9fbf6 commit 6837cd7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

articles/machine-learning/how-to-configure-auto-train.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,19 @@ LogisticRegression
487487
'warm_start': False}
488488
```
489489

490+
### Predict class probability
491+
492+
Models produced using automated ML all have wrapper objects that mirror functionality from their open-source origin class. Most classification model wrapper objects returned by automated ML implement the `predict_proba()` function, which accepts an array-like or sparse matrix data sample of your features (X values), and returns an n-dimensional array of each sample and it's respective class probability.
493+
494+
Assuming you have retrieved the best run and fitted model using the same calls from above, you can call `predict_proba()` directly from the fitted model, supplying an `X_test` sample in the appropriate format depending on the model type.
495+
496+
```python
497+
best_run, fitted_model = automl_run.get_output()
498+
class_prob = fitted_model.predict_proba(X_test)
499+
```
500+
501+
If the underlying model does not support the `predict_proba()` function or the format is incorrect, a model class-specific exception will be thrown. See the [RandomForestClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier.predict_proba) and [XGBoost](https://xgboost.readthedocs.io/en/latest/python/python_api.html) reference docs for examples of how this function is implemented for different model types.
502+
490503
<a name="explain"></a>
491504

492505
## Model interpretability

0 commit comments

Comments
 (0)