﻿# Poker Hand: permute card pairs without changing the hand

Preserve card-pair identity in the Poker Hand dataset, distinguish ordered rows from hand-category invariance, and audit split overlap introduced by canonicalization or augmentation.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-poker-hand-card-pair-permutation-identity/
Language: en

## The row contains paired card attributes

A developer studying permutation-invariant networks may shuffle every Poker Hand feature independently and retain the original class label. The [UCI schema](https://archive.ics.uci.edu/dataset/158/poker) describes alternating suit and rank fields for each card. The meaningful object is the card pair, not an isolated column token.

Keep each suit attached to its rank during every transformation. Independently shuffling the suit fields can change flush membership, while independently shuffling all fields can violate even the allowed attribute domains.

## Ordered records and hand categories are different identities

The source explicitly counts different card orders as distinct representations. That representation choice does not mean that the category of a physical hand changes when its complete cards are rearranged.

Distinguish the original ordered record identifier from a canonical hand identifier derived by a declared rule. Canonicalization creates a new representation and may reveal equivalent hands across partitions. Keep both identifiers so that the resulting evaluation question remains inspectable rather than silently collapsing records.

## Encoding must preserve the intended symmetries

Suit codes should not acquire a physical distance merely because they are stored as integers. The [OneHotEncoder interface](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html) provides an explicit categorical representation, although the full architecture must still determine whether card positions are shared or treated separately.

Rank relationships also require the actual game's interpretation, including special sequences; raw numeric distance is not a complete hand evaluator. State what information the model receives before interpreting its errors as failure to learn a logical rule.

## Generate permutations at the card level

The [Python permutation documentation](https://docs.python.org/3/library/itertools.html#itertools.permutations) describes permutations of iterable elements. For this audit, an element should be a complete card pair. Check that the transformed hand preserves the same distinct cards and compare its predicted category with the original.

If permutations are used as training augmentation, generate them after assigning source-hand partition membership. Otherwise rearrangements of an equivalent hand can cross the intended learning boundary. The [data identity guide](/journal/data-guide-coco-instance-caption-identities/) explains how such derived records retain their parent identity.

## Measure invariance separately from ordinary accuracy

Report both category correctness and consistency under permitted rearrangements. A model can predict the same wrong class for every permutation, or predict the correct class only for one familiar ordering. Those behaviors require different explanations.

The [benchmark methodology guide](/journal/inference-benchmark-method/) helps define the measured input population. This dataset studies hand-category recognition. It does not include the strategic state, opponent behavior, or action outcomes needed to demonstrate profitable poker play or a complete decision-making agent.
