Visualization

This section covers visualization tools for analysis and interpretation.

Overview

NIRS4ALL provides comprehensive visualization tools for analyzing predictions, understanding model behavior, and interpreting results.

� In-Pipeline Charts

Visualize spectra, folds, targets, augmentation, and exclusions during pipeline execution.

In-Pipeline Charts
📊 Prediction Charts

Visualize predictions, residuals, and model performance.

Analyzer Charts Reference
🔀 Pipeline Diagram

Visualize pipeline structure as interactive diagrams.

Pipeline Diagram
🔍 SHAP Analysis

Explain model predictions with SHAP values.

SHAP Analysis for NIRS Models

Quick Example

import nirs4all
from nirs4all.visualization import PredictionAnalyzer

# Run pipeline and get results
result = nirs4all.run(pipeline, dataset="data/")

# Create analyzer from the Predictions object
analyzer = PredictionAnalyzer(result.predictions)

# Generate charts
analyzer.plot_top_k(k=5)            # Top-K model comparison
analyzer.plot_histogram()           # Score distribution
analyzer.plot_candlestick(variable='model_name')  # Score ranges

Available Charts

Chart Type

Method

Use Case

Top-K Comparison

plot_top_k

Compare best models

Confusion Matrix

plot_confusion_matrix

Classification accuracy

Score Histogram

plot_histogram

Score distribution

Candlestick

plot_candlestick

Score ranges per group

Heatmap

plot_heatmap

Performance across factors

See Also