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 × sizegrid of scalar values at pixel centres, row-major from the top (highy) row. - Raster
- A
size × sizegrid of RGB pixels, row-major from the top (highy) row. - Sampling
- A
shadedheatmap 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::shadeof 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),
tin[0, 1]and clamped outside it. Low values are dark. - contour_
levels CONTOURSlevels evenly spaced strictly betweenlowandhigh.- 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. ReturnsNonefor 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);Nonefor 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. ReturnsNonefor a point with the wrong dimension.