Documentation
Classes
PrecisionRecallDisplay

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 (opens in a new tab)

Constructors

constructor()

Signature

new PrecisionRecallDisplay(opts?: object): PrecisionRecallDisplay;

Parameters

NameTypeDescription
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 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

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

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/metrics/PrecisionRecallDisplay.ts:129 (opens in a new tab)

from_estimator()

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

Signature

from_estimator(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeInput values.
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. Default Value false
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. Default Value false
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. Default Value 'auto'
opts.sample_weight?ArrayLikeSample weights.
opts.y?ArrayLikeTarget values.

Returns

Promise<any>

Defined in: generated/metrics/PrecisionRecallDisplay.ts:146 (opens in a new tab)

from_predictions()

Plot precision-recall curve given binary class predictions.

Signature

from_predictions(opts: object): Promise<any>;

Parameters

NameTypeDescription
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. Default Value false
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. Default Value false
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:261 (opens in a new tab)

init()

Initializes the underlying Python resources.

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

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/metrics/PrecisionRecallDisplay.ts:73 (opens in a new tab)

plot()

Plot visualization.

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

Signature

plot(opts: object): Promise<any>;

Parameters

NameTypeDescription
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. Default Value false

Returns

Promise<any>

Defined in: generated/metrics/PrecisionRecallDisplay.ts:366 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/metrics/PrecisionRecallDisplay.ts:23 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/metrics/PrecisionRecallDisplay.ts:22 (opens in a new tab)

_py

PythonBridge

Defined in: generated/metrics/PrecisionRecallDisplay.ts:21 (opens in a new tab)

id

string

Defined in: generated/metrics/PrecisionRecallDisplay.ts:18 (opens in a new tab)

opts

any

Defined in: generated/metrics/PrecisionRecallDisplay.ts:19 (opens in a new tab)

Accessors

ax_

Axes with precision recall curve.

Signature

ax_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/metrics/PrecisionRecallDisplay.ts:481 (opens in a new tab)

chance_level_

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

Signature

chance_level_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/metrics/PrecisionRecallDisplay.ts:454 (opens in a new tab)

figure_

Figure containing the curve.

Signature

figure_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/metrics/PrecisionRecallDisplay.ts:508 (opens in a new tab)

line_

Precision recall curve.

Signature

line_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/metrics/PrecisionRecallDisplay.ts:427 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/metrics/PrecisionRecallDisplay.ts:60 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/metrics/PrecisionRecallDisplay.ts:64 (opens in a new tab)