APIs Reference#

This is the class and function reference of scikit-plots. Please refer to the full user guide for further details, as the raw specifications of classes and functions may not be enough to give full guidelines on their uses. For reference on concepts repeated across the APIs, see scikit-plots Glossary.

Object

Description

config_context

Context manager for global scikit-plots configuration.

get_config

Retrieve current values for configuration set by set_config.

set_config

Set global scikit-plots configuration.

show_config

Show libraries and system information on which SciPy was built

show_versions

Print useful debugging information

online_help

Open the online documentation search page

plot_pca_2d_projection

Plots the 2-dimensional projection of PCA on a given dataset.

plot_pca_component_variance

Plots PCA components’ explained variance ratios. (new in v0.2.2)

plot_feature_importances

Generates a plot of a sklearn model’s feature importances.

plot_learning_curve

Generates a plot of the train and test learning curves for a classifier.

plot_elbow

Plot the elbow curve for different values of K in KMeans clustering.

plot_residuals_distribution

Plot residuals and fit various distributions to assess their goodness of fit.

plot_classifier_eval

Generates various evaluation plots for a classifier, including confusion matrix, precision-recall curve, and ROC curve.

plot_confusion_matrix

Generates a confusion matrix plot from predictions and true labels.

plot_precision_recall

Generates the Precision-Recall AUC Curves from labels and predicted scores/probabilities.

plot_roc

Generates the ROC AUC curves from labels and predicted scores/probabilities.

plot_calibration

Plot calibration curves for a set of classifier probability estimates.

plot_silhouette

Plots silhouette analysis of clusters provided.

validate_labels

Validates the labels passed into arguments such as true_labels or pred_labels

scikitplot.api._utils

cumulative_gain_curve

Generate the data points necessary to plot the Cumulative Gain curve for binary classification tasks.

scikitplot.api._utils

binary_ks_curve

Generate the data points necessary to plot the Kolmogorov-Smirnov (KS)

scikitplot.api._utils

validate_plotting_kwargs

Validate the provided axes and figure or create new ones if needed.

scikitplot.api._utils

save_figure

Combine multiple figures into a single image,

scikitplot.api._utils

save_plot

Save the current plot if the environment variable to save plots is enabled.

scikitplot.api._utils

expit

Compute the expit (sigmoid) function of the input value x0.

scikitplot.experimental._cy_experimental

log_expit

Compute the logarithm of the expit (sigmoid) function for the input value x0.

scikitplot.experimental._cy_experimental

logit

Compute the logit function, which is the inverse of the sigmoid function, for the input value x0.

scikitplot.experimental._cy_experimental

py_print

py_print(message: str = ‘Hello, from Pybind11 C++!’) -> None

scikitplot.experimental._py_experimental

sigmoid

Compute the sigmoid function for the input array x.

scikitplot.experimental._logsumexp

softmax

Compute the softmax function.

scikitplot.experimental._logsumexp

logsumexp

Compute the log of the sum of exponentials of input elements.

scikitplot.experimental._logsumexp

log_softmax

Compute the logarithm of the softmax function.

scikitplot.experimental._logsumexp

print_labels

A legend for the abbreviations of decile table column names.

decile_table

Generates the Decile Table from labels and probabilities

plot_cumulative_gain

Generates the Decile-wise Lift Plot from labels and probabilities

plot_lift

Generates the Decile based cumulative Lift Plot from labels and probabilities.

plot_lift_decile_wise

Generates the Decile-wise Lift Plot from labels and probabilities

plot_ks_statistic

Generates the KS Statistic Plot from labels and probabilities

report

Generates a decile table and four plots:

ModelPlotPy

ModelPlotPy decile analysis.

plot_response

Plotting response curve

plot_cumresponse

Plotting cumulative response curve

plot_cumlift

Plotting cumulative lift curve

plot_cumgains

Plotting cumulative gains curve

plot_all

Plotting cumulative gains curve

plot_costsrevs

Plotting costs / revenue curve

plot_profit

Plotting profit curve

plot_roi

Plotting ROI curve

ProbScale

A probability scale for matplotlib Axes.

probplot

Probability, percentile, and quantile plots.

plot_pos

Compute the plotting positions for a dataset. Heavily borrows from

fit_line

Fits a line to x-y data in various forms (linear, log, prob scales).

CRITICAL

int([x]) -> integer

DEBUG

int([x]) -> integer

ERROR

int([x]) -> integer

FATAL

int([x]) -> integer

INFO

int([x]) -> integer

NOTSET

int([x]) -> integer

WARN

int([x]) -> integer

WARNING

int([x]) -> integer

AlwaysStdErrHandler

A custom logging handler inherited from StreamHandler

GoogleLogFormatter

A custom logging formatter inherited from Formatter

critical

Logs a message at the CRITICAL log level.

debug

Logs a message at the DEBUG log level.

error

Logs a message at the ERROR log level.

error_log

Empty helper method.

fatal

Logs a message at the FATAL - CRITICAL log level.

getEffectiveLevel

Return how much logging output will be produced.

get_logger

Return SP (scikitplot) logger instance.

log_if

Log ‘msg % args’ at level ‘level’ only if condition is fulfilled.

setLevel

Sets the threshold for what messages will be logged.

vlog

Logs a message at the specified log level.

warn

Logs a message at the WARN - WARNING log level.

warning

Logs a message at the WARNING log level.

SpLogger

A singleton logger class that provides a shared logger instance with customizable

sp_logger

An instance of SpLogger, providing logging functionality.

Events

Bayesian blocks fitness for binned or unbinned events.

FitnessFunc

Base class for bayesian blocks fitness functions.

PointMeasures

Bayesian blocks fitness for point measures.

RegularEvents

Bayesian blocks fitness for regular events.

bayesian_blocks

Compute optimal segmentation of data with Scargle’s Bayesian Blocks.

binned_binom_proportion

Binomial proportion and confidence interval in bins of a continuous

binom_conf_interval

Binomial proportion confidence interval given k successes,

bootstrap

Performs bootstrap resampling on numpy arrays.

cdf_from_intervals

Construct a callable piecewise-linear CDF from a pair of arrays.

fold_intervals

Fold the weighted intervals to the interval (0,1).

gaussian_fwhm_to_sigma

Convert a string or number to a floating point number, if possible.

gaussian_sigma_to_fwhm

Convert a string or number to a floating point number, if possible.

histogram_intervals

Histogram of a piecewise-constant weight function.

interval_overlap_length

Compute the length of overlap of two intervals.

kuiper

Compute the Kuiper statistic.

kuiper_false_positive_probability

Compute the false positive probability for the Kuiper statistic.

kuiper_two

Compute the Kuiper statistic to compare two samples.

mad_std

median_absolute_deviation

Calculate the median absolute deviation (MAD).

poisson_conf_interval

Poisson parameter confidence interval given observed counts.

signal_to_noise_oir_ccd

Computes the signal to noise ratio for source being observed in the

calculate_bin_edges

Calculate histogram bin edges like numpy.histogram_bin_edges.

freedman_bin_width

Return the optimal histogram bin width using the Freedman-Diaconis rule.

histogram

Enhanced histogram function, providing adaptive binnings.

knuth_bin_width

Return the optimal histogram bin width using Knuth’s rule.

scott_bin_width

Return the optimal histogram bin width using Scott’s rule.

akaike_info_criterion

Computes the Akaike Information Criterion (AIC).

akaike_info_criterion_lsq

Computes the Akaike Information Criterion assuming that the observations

bayesian_info_criterion

Computes the Bayesian Information Criterion (BIC) given the log of the

bayesian_info_criterion_lsq

Computes the Bayesian Information Criterion (BIC) assuming that the

tweedie_gen

A Tweedie continuous random variable inherited scipy.stats.rv_continuous.

tweedie

An instance of tweedie_gen, providing Tweedie distribution functionality.

graph_view

Generates an architectural visualization for a given linear Keras

layered_view

Generates an architectural visualization for a given linear Keras

SpacingDummyLayer

A dummy layer to add spacing or other custom behavior.

_factory_api

scikit-plots Factory API

plot_roc_curve

Generates the ROC curves from labels and predicted scores/probabilities

plot_precision_recall_curve

Generates the Precision Recall Curve from labels and probabilities