geolatent.rendering.surfaces#

Decision-surface rendering for geolatent.

DecisionSurfaceRenderer converts a PredictionMesh into a set of Plotly traces that collectively visualise the geometry of a model’s decision function in 3-D projected space.

Three rendering strategies are implemented:

render_probability_isosurfaces

For classifiers that expose predict_proba. Renders one Plotly Isosurface per class at the probability threshold of 0.50, producing clean translucent shells that exactly trace the decision boundary for each class in a one-vs-rest sense. Additional shells at higher thresholds (0.70, 0.85) encode confidence depth.

render_class_volumes

For classifiers without predict_proba (e.g., LinearSVC). Renders a single Volume trace coloured by predicted class index, giving a volumetric view of the class partition.

render_regression_field

For regression models. Renders a Volume trace with a diverging colorscale representing the scalar prediction field.

Strategy selection is automatic: the renderer inspects the PredictionMesh and chooses the most informative approach.

Classes#

DecisionSurfaceRenderer

Renders decision surfaces from a PredictionMesh.

Module Contents#

class geolatent.rendering.surfaces.DecisionSurfaceRenderer(config: geolatent.config.themes.VisualizationConfig)[source]#

Renders decision surfaces from a PredictionMesh.

Parameters:

config (VisualizationConfig) – Master configuration; colour palette and surface opacity are read here.

Examples

>>> renderer = DecisionSurfaceRenderer(DARK_SCIENTIFIC)
>>> traces = renderer.render(mesh)
>>> for t in traces:
...     scene.add_trace(t)
config#
render(mesh: geolatent.core.mesh_builder.PredictionMesh, *, class_names: Dict | None = None, show_confidence: bool = True) List[plotly.graph_objects.BaseTraceType][source]#

Auto-select and execute the most appropriate rendering strategy.

Parameters:
  • mesh (PredictionMesh) – Pre-computed prediction mesh from MeshBuilder.

  • class_names (dict, optional) – Mapping from class label to display string.

  • show_confidence (bool) – When True and mesh.probabilities is available, render nested confidence isosurfaces in addition to the boundary shell.

Returns:

traces

Return type:

list of Plotly traces

render_probability_isosurfaces(mesh: geolatent.core.mesh_builder.PredictionMesh, *, class_names: Dict | None = None, show_confidence: bool = True, boundary_threshold: float = 0.5, confidence_thresholds: List[float] | None = None) List[plotly.graph_objects.Isosurface][source]#

Render probability isosurfaces for each class.

For each class c, the decision boundary surface (P(class=c) = 0.5) is rendered as a translucent shell. When show_confidence is True, additional shells at higher probability thresholds convey confidence depth.

Parameters:
  • mesh (PredictionMesh) – Must have probabilities populated.

  • class_names (dict, optional)

  • show_confidence (bool)

  • boundary_threshold (float) – Primary isosurface probability value (default 0.50).

  • confidence_thresholds (list of float, optional) – Additional isosurface levels drawn inside the boundary shell. Defaults to [0.70, 0.85] when show_confidence is True.

Returns:

traces

Return type:

list of go.Isosurface

render_class_volumes(mesh: geolatent.core.mesh_builder.PredictionMesh, *, class_names: Dict | None = None) List[plotly.graph_objects.BaseTraceType][source]#

Render a per-class volume for models without predict_proba.

Maps predicted class indices onto a discrete colour scale and renders the full volumetric class partition as a transparent go.Volume. To give class boundaries a clear visual edge, one go.Isosurface per class boundary is additionally rendered.

Parameters:
Returns:

traces

Return type:

list of Plotly traces

render_regression_field(mesh: geolatent.core.mesh_builder.PredictionMesh) List[plotly.graph_objects.Volume][source]#

Render a continuous regression prediction field as a volumetric trace.

Parameters:

mesh (PredictionMesh) – A mesh whose is_regression flag is True.

Returns:

traces

Return type:

list of go.Volume