Classification¶
Classification assigns class labels to segment objects. The classifier uses segment-level features rather than raw pixels.
Raster-derived features and point-cloud-derived features can be used together. The classifier only requires one segment table with numeric feature columns.
Prepare Training Labels¶
Start with:
- a segment GeoDataFrame from
segment(...).segments - a labelled point GeoDataFrame with a
classcolumn
If point-cloud features are needed, add them before labelling so the labelled training segments and prediction segments have the same feature columns.
1 2 3 4 5 6 7 8 9 10 11 | |
training_segments contains a feature_class column. mixed_segments contains segment IDs that intersected more than one class.
Review mixed segments before training. They often indicate label noise, poor segmentation, or sample points near class boundaries.
Train and Predict¶
1 2 3 4 5 6 7 8 9 10 11 | |
The classified GeoDataFrame includes:
predicted_classprediction_margin- original segment geometry
- original feature columns
Random Forest¶
Random forest is the default starting point:
1 2 3 4 5 6 7 8 | |
Use it before trying neural-network classification. It is usually easier to diagnose on small tabular feature sets.
MLP¶
Use method="mlp" for scikit-learn's multi-layer perceptron classifier:
1 2 3 4 5 6 7 8 | |
MLP classification is more sensitive to feature scaling, class balance, and training size.
Reports and Explanations¶
Set compute_reports=True to calculate a confusion matrix and classification report on the train/test split:
1 2 3 4 5 6 7 8 9 10 | |
SHAP explanations require the optional explain dependency group:
1 | |
Then run:
1 2 3 4 5 6 7 | |
Save Output¶
1 | |
The output remains a vector object map. If a raster classification map is required, rasterize the classified polygons onto the source raster grid as a separate post-processing step.