Skip to main content

Module heatmap

Module heatmap 

Expand description

Pure geometry for the demo’s maps: sampled value grids, their color ramps and contour lines, and the mapping from parameter space to the unit square.

No window or GPU is involved, so every function is unit tested on the host.

Structs§

Field
A size × size grid of scalar values at pixel centres, row-major from the top (high y) row.
Raster
A size × size grid of RGB pixels, row-major from the top (high y) row.
Sampling
A shaded heatmap sampled one cell at a time, row by row from the top, for a problem whose every evaluation is expensive.
Shaded
A function’s heatmap values: Problem::shade of the function at pixel centres, plus the lowest and highest raw value sampled.

Enums§

Ramp
A color ramp, dark to light.

Constants§

CONTOURS
How many contour levels a map draws, evenly spaced between its lowest and highest shade.
GRID
The function heatmap’s resolution per axis.
LEARNER_GRID
A learner problem’s heatmap resolution per axis. Each cell is a whole fixed-seed training run, so the grid is coarse and is sampled a few cells per frame (Sampling).

Functions§

color
A perceptually ordered dark-to-light color ramp (viridis stops), t in [0, 1] and clamped outside it. Low values are dark.
contour_levels
CONTOURS levels evenly spaced strictly between low and high.
grid
The heatmap resolution per axis for problem.
param_point
Maps a unit-square point back into the box, clamped to it: the inverse of unit_point. Returns None for a problem without two parameters.
raster
Samples a two-parameter problem at pixel centres and colors the values.
shaded
Samples a two-parameter problem at pixel centres and shades the values (see raster); None for a problem without exactly two parameters.
unit_point
Maps a parameter point into the unit square: (0, 0) is the bottom-left corner of the box, (1, 1) the top-right. Returns None for a point with the wrong dimension.