henchman.plotting.f1

henchman.plotting.f1(X, y, model, n_precs=1000, n_splits=1, figargs=None)[source]

Plots the precision, recall and f1 at various thresholds. This function creates a fit model and shows the precision, recall and f1 results at multiple thresholds.

Parameters:
  • X (pd.DataFrame) – The dataframe on which to create a model.
  • y (pd.Series) – The labels for which to create a model.
  • n_precs (int) – The number of thresholds to sample between 0 and 1.
  • n_splits (int) – The number of splits to use in validation.

Example

If the dataframe X has a binary classification label y:

>>> import henchman.plotting as hplot
>>> from sklearn.ensemble import RandomForestClassifier
>>> plot = hplot.f1(X, y, RandomForestClassifier())
>>> hplot.show(plot)