nirs4all.core.task_detection module

Task Type Detection - Standalone utility to avoid circular imports

This module provides task type detection functionality that can be used by both data and controller modules without creating circular import issues.

nirs4all.core.task_detection.detect_task_type(y: ndarray, threshold: float = 0.05) TaskType[source]

Detect task type based on target values.

Parameters:
  • y – Target values array

  • threshold – Threshold for determining if values are continuous (regression) vs discrete (classification). For integer values, if n_unique <= max_classes or n_unique <= len(y) * threshold, it’s considered classification.

Returns:

Detected task type

Return type:

TaskType