plot_raster

pyoptex.analysis.estimators.sams.plot.plot_raster(results, terms, skipn=0, metric_name='metric', forced=None, raster_terms=None, kmeans=None, fig=None)[source]

Plot a raster of the results. This plot contains one row per model, sorted by metric to identify good performing submodels (=densly colored columns).

Parameters

resultsnp.ndarray(1d)

A complex numpy object with ‘metric’, ‘model’ and ‘coeff’ as subtypes. This is the result returned by simulate_sams.

termslist(str)

A list the names of all the terms in the model.

skipnint

The number of terms to indicate as skipped.

metric_namestr

The name of the metric, e.g., r2(adj)

forcedNone or np.array(1d)

The terms to ignore in the raster plot. Sets the coefficients of these terms to zero.

raster_termslist(int) or np.array(1d)

The terms to indicate in the raster.

kmeanssklearn.cluster.KMeans

The number of clusters in the raster plot. The kmeans should be trained by ordering the results according to ‘metric’ and skipping the first skipn. The object can optionally have an additional skips attribute to indicate a skip for each cluster. The skips should be an array of integers, with element i indicating the number of models to skip for group i.

figNone or tuple(plotly.graph_objects.Figure, (int, int), (int, int))

Either None or a tuple containing the subplots figure, the (row, col) to draw the raster on, and the (row, col) to draw the metric on. Most often, these are horizontally next to each other.

Returns

figplotly.graph_objects.Figure

A Plotly figure object of the raster.