concept
Learning paradigms
Supervised: known target labels. Unsupervised: structure without task labels. Self-supervised: targets derived from inputs. Semi-supervised: labeled plus unlabeled data for a target task. Reinforcement: actions and reward-based feedback, often sequential. Categories can overlap across training stages. The example is a one-dimensional largest-gap heuristic, not a standard clustering API.
Formal Syntax & Structure
artificial-intelligence syntaxartificial-intelligence
features → fit using a learning signal → model or policyWorking Example
Example Snippetartificial-intelligence
def gap_groups(values): # Teaching algorithm: split sorted numbers at the first largest gap. ordered = sorted(values) if len(ordered) < 2 or ordered[0] == ordered[-1]: return [ordered] if ordered else [] boundary = max(range(1, len(ordered)), key=lambda i: ordered[i] - ordered[i - 1]) return [ordered[:boundary], ordered[boundary:]]
print(gap_groups([10, 2, 11, 3, 4]))print(gap_groups([5, 5, 5]))