io-chess
UCI chess engine
Loading...
Searching...
No Matches
dataset.ChessExpertFactorizedDataset Class Reference
Inheritance diagram for dataset.ChessExpertFactorizedDataset:
Collaboration diagram for dataset.ChessExpertFactorizedDataset:

Public Member Functions

 __init__ (self, data_dir, expert_idx, max_samples=None, in_memory=False, n_globals=21)
 __len__ (self)
 __getitem__ (self, idx)

Public Attributes

 in_memory = in_memory
 data_dir = data_dir
 expert_idx = expert_idx
 n_globals = n_globals
list expert_name = self.EXPERT_NAMES[expert_idx]
 indices_path = os.path.join(data_dir, f"expert{expert_idx}_indices.bin")
 global_features_path = os.path.join(data_dir, "features.bin")
 global_labels_path = os.path.join(data_dir, "labels.bin")
 legacy_features_path = os.path.join(data_dir, f"expert{expert_idx}_features.bin")
 legacy_labels_path = os.path.join(data_dir, f"expert{expert_idx}_labels.bin")
 features_dtype_legacy
 features_dtype_compact
str mode = None
 features = None
 labels = None
 indices = None
 features_dtype
 feature_layout
 global_n_samples = global_label_samples
 n_samples = index_samples

Static Public Attributes

list EXPERT_NAMES = ["Tactical", "Strategic", "Major End", "Minor End", "Survivor", "Killer"]
 PLANES_PER_TYPE = PLANES_PER_GROUP_CONST
int MAX_BRANCH_PLANES = 10
 PACKED_BRANCH_PLANES = sum(PLANES_PER_TYPE)
int NUM_BYPASS_PLANES = 12
 PACKED_OFFSETS = PACKED_OFFSETS_CONST

Protected Member Functions

 _detect_layout (self, feature_path, expected_samples)
 _init_index_mode (self, max_samples)
 _init_legacy_mode (self, max_samples)
 _load_to_memory (self)
 _lazy_load (self)

Detailed Description

Expert-specific factorized dataset for phase 2 specialization.

    Preferred format (index-based, no feature duplication):
        - expert{N}_indices.bin
        - features.bin
        - labels.bin

    Legacy fallback format (duplicated expert feature shards):
        - expert{N}_features.bin
        - expert{N}_labels.bin

Constructor & Destructor Documentation

◆ __init__()

dataset.ChessExpertFactorizedDataset.__init__ ( self,
data_dir,
expert_idx,
max_samples = None,
in_memory = False,
n_globals = 21 )

Member Function Documentation

◆ __getitem__()

dataset.ChessExpertFactorizedDataset.__getitem__ ( self,
idx )
Here is the call graph for this function:

◆ __len__()

dataset.ChessExpertFactorizedDataset.__len__ ( self)

◆ _detect_layout()

dataset.ChessExpertFactorizedDataset._detect_layout ( self,
feature_path,
expected_samples )
protected
Here is the caller graph for this function:

◆ _init_index_mode()

dataset.ChessExpertFactorizedDataset._init_index_mode ( self,
max_samples )
protected

◆ _init_legacy_mode()

dataset.ChessExpertFactorizedDataset._init_legacy_mode ( self,
max_samples )
protected
Here is the call graph for this function:

◆ _lazy_load()

dataset.ChessExpertFactorizedDataset._lazy_load ( self)
protected
Here is the caller graph for this function:

◆ _load_to_memory()

dataset.ChessExpertFactorizedDataset._load_to_memory ( self)
protected

Member Data Documentation

◆ data_dir

dataset.ChessExpertFactorizedDataset.data_dir = data_dir

◆ expert_idx

dataset.ChessExpertFactorizedDataset.expert_idx = expert_idx

◆ expert_name

list dataset.ChessExpertFactorizedDataset.expert_name = self.EXPERT_NAMES[expert_idx]

◆ EXPERT_NAMES

list dataset.ChessExpertFactorizedDataset.EXPERT_NAMES = ["Tactical", "Strategic", "Major End", "Minor End", "Survivor", "Killer"]
static

◆ feature_layout

dataset.ChessExpertFactorizedDataset.feature_layout
Initial value:
= self._detect_layout(
self.global_features_path, global_label_samples
)

◆ features

dataset.ChessExpertFactorizedDataset.features = None

◆ features_dtype

dataset.ChessExpertFactorizedDataset.features_dtype

◆ features_dtype_compact

dataset.ChessExpertFactorizedDataset.features_dtype_compact
Initial value:
= np.dtype(
[
("branches", np.uint64, self.PACKED_BRANCH_PLANES),
("bypass_continuous", np.uint8, (2, 64)),
("bypass_categorical", np.uint64, 10),
("global", np.float32, 32),
],
align=True,
)

◆ features_dtype_legacy

dataset.ChessExpertFactorizedDataset.features_dtype_legacy
Initial value:
= np.dtype(
[
("branches", np.uint8, (12, self.MAX_BRANCH_PLANES, 64)),
("bypass", np.uint8, (self.NUM_BYPASS_PLANES, 64)),
("global", np.float32, 32),
],
align=True,
)

◆ global_features_path

dataset.ChessExpertFactorizedDataset.global_features_path = os.path.join(data_dir, "features.bin")

◆ global_labels_path

dataset.ChessExpertFactorizedDataset.global_labels_path = os.path.join(data_dir, "labels.bin")

◆ global_n_samples

dataset.ChessExpertFactorizedDataset.global_n_samples = global_label_samples

◆ in_memory

dataset.ChessExpertFactorizedDataset.in_memory = in_memory

◆ indices

dataset.ChessExpertFactorizedDataset.indices = None

◆ indices_path

dataset.ChessExpertFactorizedDataset.indices_path = os.path.join(data_dir, f"expert{expert_idx}_indices.bin")

◆ labels

dataset.ChessExpertFactorizedDataset.labels = None

◆ legacy_features_path

dataset.ChessExpertFactorizedDataset.legacy_features_path = os.path.join(data_dir, f"expert{expert_idx}_features.bin")

◆ legacy_labels_path

dataset.ChessExpertFactorizedDataset.legacy_labels_path = os.path.join(data_dir, f"expert{expert_idx}_labels.bin")

◆ MAX_BRANCH_PLANES

int dataset.ChessExpertFactorizedDataset.MAX_BRANCH_PLANES = 10
static

◆ mode

str dataset.ChessExpertFactorizedDataset.mode = None

◆ n_globals

dataset.ChessExpertFactorizedDataset.n_globals = n_globals

◆ n_samples

dataset.ChessExpertFactorizedDataset.n_samples = index_samples

◆ NUM_BYPASS_PLANES

int dataset.ChessExpertFactorizedDataset.NUM_BYPASS_PLANES = 12
static

◆ PACKED_BRANCH_PLANES

dataset.ChessExpertFactorizedDataset.PACKED_BRANCH_PLANES = sum(PLANES_PER_TYPE)
static

◆ PACKED_OFFSETS

dataset.ChessExpertFactorizedDataset.PACKED_OFFSETS = PACKED_OFFSETS_CONST
static

◆ PLANES_PER_TYPE

dataset.ChessExpertFactorizedDataset.PLANES_PER_TYPE = PLANES_PER_GROUP_CONST
static

The documentation for this class was generated from the following file: