Code Documentation: Plots

mastml.plots Module

This module contains classes used for generating different types of analysis plots

Scatter:

This class contains a variety of scatter plot types, e.g. parity (predicted vs. true) plots

Error:

This class contains plotting methods used to better quantify the model errors and uncertainty quantification.

Histogram:

This class contains methods for constructing histograms of data distributions and visualization of model residuals.

Line:

This class contains methods for making line plots, e.g. for constructing learning curves of model performance vs. amount of data or number of features.

Functions

ceil(x, /)

Return the ceiling of x as an Integral.

check_dimensions(y)

Method to check the dimensions of supplied data.

classification_report(y_true, y_pred, *[, ...])

Build a text report showing the main classification metrics.

figaspect(arg)

Calculate the width and height for a figure with a specified aspect ratio.

get_divisor(high, low)

Method to obtain a sensible divisor based on range of two values

log(x, [base=math.e])

Return the logarithm of x to the given base.

make_axes_locatable(axes)

make_axis_same(ax, max1, min1)

Method to make the x and y ticks for each axis the same.

make_fig_ax([aspect_ratio, x_align, left])

Method to make matplotlib figure and axes objects.

make_fig_ax_square([aspect, aspect_ratio])

Method to make square shaped matplotlib figure and axes objects.

make_plots(plots, y_true, y_pred, groups, ...)

Helper function to make collections of different types of plots after a single or multiple data splits are evaluated.

mark_inset(parent_axes, inset_axes, loc1, ...)

Draw a box to mark the location of an area represented by an inset axes.

nice_mean(ls)

Method to return mean of a list or equivalent array with NaN values

nice_names()

nice_range(lower, upper)

Method to create a range of values, including the specified start and end points, with nicely spaced intervals

nice_std(ls)

Method to return standard deviation of a list or equivalent array with NaN values

plot_avg_score_vs_occurrence(savepath, ...)

Function to plot the average score of each feature against their occurrence in all of the splits

plot_confusion_matrix(estimator, X, y_true, *)

DEPRECATED: Function plot_confusion_matrix is deprecated in 1.0 and will be removed in 1.2.

plot_feature_occurrence(savepath, feature, ...)

Function to plot the occurrence of each feature in all of the splits

plot_stats(fig, stats[, x_align, y_align, ...])

Method that prints stats onto the plot.

r2_score(y_true, y_pred, *[, sample_weight, ...])

\(R^2\) (coefficient of determination) regression score function.

recursive_max(arr)

Method to recursively find the max value of an array of iterables.

recursive_max_and_min(arr)

Method to recursively return max and min of values or iterables in array

recursive_min(arr)

Method to recursively find the min value of an array of iterables.

reset_index(y)

round_down(num, divisor)

Method to return a rounded down number

round_up(num, divisor)

Method to return a rounded up number

rounder(delta)

Method to obtain number of decimal places to report on plots

stat_to_string(name, value, nice_names)

Method that converts a metric object into a string for displaying on a plot

trim_array(arr_list)

Method used to trim a set of arrays to make all arrays the same shape

zoomed_inset_axes(parent_axes, zoom[, loc, ...])

Create an anchored inset axes by scaling a parent axes.

Classes

Classification()

Classification plots

Error()

Class to make plots related to model error assessment and uncertainty quantification

ErrorUtils()

Collection of functions to conduct error analysis on certain types of models (uncertainty quantification), and prepare residual and model error data for plotting, as well as recalibrate model errors with various methods

Figure([figsize, dpi, facecolor, edgecolor, ...])

The top level container for all the plot elements.

FigureCanvas

alias of FigureCanvasAgg

FontProperties([family, style, variant, ...])

A class for storing and manipulating font properties.

Histogram()

Class to generate histogram plots, such as histograms of residual values

Iterable()

Line()

Class containing methods for constructing line plots

LinearRegression(*[, fit_intercept, ...])

Ordinary least squares Linear Regression.

Metrics(metrics_list[, metrics_type])

Class containing access to a wide range of metrics from scikit-learn and a number of MAST-ML custom-written metrics

NotFittedError

Exception class to raise if estimator is used before fitting.

Scatter()

Class to generate scatter plots, such as parity plots showing true vs.

gaussian_kde(dataset[, bw_method, weights])

Representation of a kernel-density estimate using Gaussian kernels.

Class Inheritance Diagram

Inheritance diagram of mastml.plots.Classification, mastml.plots.Error, mastml.plots.Histogram, mastml.plots.Line, mastml.plots.Scatter