DocumentationClassesPrecisionRecallDisplay

Class: PrecisionRecallDisplay

Precision Recall visualization.

It is recommend to use from_estimator or from_predictions to create a PrecisionRecallDisplay. All parameters are stored as attributes.

Read more in the User Guide.

Python Reference

Constructors

new PrecisionRecallDisplay()

new PrecisionRecallDisplay(opts?): PrecisionRecallDisplay

Parameters

ParameterTypeDescription
opts?object-
opts.average_precision?numberAverage precision. If undefined, the average precision is not shown.
opts.estimator_name?stringName of estimator. If undefined, then the estimator name is not shown.
opts.pos_label?string | number | booleanThe class considered as the positive class. If undefined, the class will not be shown in the legend.
opts.precision?ArrayLikePrecision values.
opts.prevalence_pos_label?numberThe prevalence of the positive label. It is used for plotting the chance level line. If undefined, the chance level line will not be plotted even if plot_chance_level is set to true when plotting.
opts.recall?ArrayLikeRecall values.

Returns PrecisionRecallDisplay

Defined in generated/metrics/PrecisionRecallDisplay.ts:25

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/metrics/PrecisionRecallDisplay.ts:23
_isInitializedbooleanfalsegenerated/metrics/PrecisionRecallDisplay.ts:22
_pyPythonBridgeundefinedgenerated/metrics/PrecisionRecallDisplay.ts:21
idstringundefinedgenerated/metrics/PrecisionRecallDisplay.ts:18
optsanyundefinedgenerated/metrics/PrecisionRecallDisplay.ts:19

Accessors

ax_

Get Signature

get ax_(): Promise<any>

Axes with precision recall curve.

Returns Promise<any>

Defined in generated/metrics/PrecisionRecallDisplay.ts:427


chance_level_

Get Signature

get chance_level_(): Promise<any>

The chance level line. It is undefined if the chance level is not plotted.

Returns Promise<any>

Defined in generated/metrics/PrecisionRecallDisplay.ts:400


figure_

Get Signature

get figure_(): Promise<any>

Figure containing the curve.

Returns Promise<any>

Defined in generated/metrics/PrecisionRecallDisplay.ts:454


line_

Get Signature

get line_(): Promise<any>

Precision recall curve.

Returns Promise<any>

Defined in generated/metrics/PrecisionRecallDisplay.ts:373


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/metrics/PrecisionRecallDisplay.ts:60

Methods

dispose()

dispose(): Promise<void>

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Returns Promise<void>

Defined in generated/metrics/PrecisionRecallDisplay.ts:116


from_estimator()

from_estimator(opts): Promise<any>

Plot precision-recall curve given an estimator and some data.

Parameters

ParameterTypeDescription
optsobject-
opts.ax?anyAxes object to plot on. If undefined, a new figure and axes is created.
opts.chance_level_kw?anyKeyword arguments to be passed to matplotlib’s plot for rendering the chance level line.
opts.drop_intermediate?booleanWhether to drop some suboptimal thresholds which would not appear on a plotted precision-recall curve. This is useful in order to create lighter precision-recall curves.
opts.estimator?anyFitted classifier or a fitted Pipeline in which the last estimator is a classifier.
opts.kwargs?anyKeyword arguments to be passed to matplotlib’s plot.
opts.name?stringName for labeling curve. If undefined, no name is used.
opts.plot_chance_level?booleanWhether to plot the chance level. The chance level is the prevalence of the positive label computed from the data passed during from_estimator or from_predictions call.
opts.pos_label?string | number | booleanThe class considered as the positive class when computing the precision and recall metrics. By default, estimators.classes_\[1\] is considered as the positive class.
opts.response_method?"auto" | "predict_proba" | "decision_function"Specifies whether to use predict_proba or decision_function as the target response. If set to ‘auto’, predict_proba is tried first and if it does not exist decision_function is tried next.
opts.sample_weight?ArrayLikeSample weights.
opts.X?ArrayLikeInput values.
opts.y?ArrayLikeTarget values.

Returns Promise<any>

Defined in generated/metrics/PrecisionRecallDisplay.ts:133


from_predictions()

from_predictions(opts): Promise<any>

Plot precision-recall curve given binary class predictions.

Parameters

ParameterTypeDescription
optsobject-
opts.ax?anyAxes object to plot on. If undefined, a new figure and axes is created.
opts.chance_level_kw?anyKeyword arguments to be passed to matplotlib’s plot for rendering the chance level line.
opts.drop_intermediate?booleanWhether to drop some suboptimal thresholds which would not appear on a plotted precision-recall curve. This is useful in order to create lighter precision-recall curves.
opts.kwargs?anyKeyword arguments to be passed to matplotlib’s plot.
opts.name?stringName for labeling curve. If undefined, name will be set to "Classifier".
opts.plot_chance_level?booleanWhether to plot the chance level. The chance level is the prevalence of the positive label computed from the data passed during from_estimator or from_predictions call.
opts.pos_label?string | number | booleanThe class considered as the positive class when computing the precision and recall metrics.
opts.sample_weight?ArrayLikeSample weights.
opts.y_pred?ArrayLikeEstimated probabilities or output of decision function.
opts.y_true?ArrayLikeTrue binary labels.

Returns Promise<any>

Defined in generated/metrics/PrecisionRecallDisplay.ts:230


init()

init(py): Promise<void>

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Parameters

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/metrics/PrecisionRecallDisplay.ts:73


plot()

plot(opts): Promise<any>

Plot visualization.

Extra keyword arguments will be passed to matplotlib’s plot.

Parameters

ParameterTypeDescription
optsobject-
opts.ax?anyAxes object to plot on. If undefined, a new figure and axes is created.
opts.chance_level_kw?anyKeyword arguments to be passed to matplotlib’s plot for rendering the chance level line.
opts.kwargs?anyKeyword arguments to be passed to matplotlib’s plot.
opts.name?stringName of precision recall curve for labeling. If undefined, use estimator_name if not undefined, otherwise no labeling is shown.
opts.plot_chance_level?booleanWhether to plot the chance level. The chance level is the prevalence of the positive label computed from the data passed during from_estimator or from_predictions call.

Returns Promise<any>

Defined in generated/metrics/PrecisionRecallDisplay.ts:317