MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / build_target_multilabel

Function build_target_multilabel

scripts/train_predictor.py:273–282  ·  view source on GitHub ↗

Convert expert indices to multi-label binary targets.

(expert_indices, num_experts)

Source from the content-addressed store, hash-verified

271
272
273def build_target_multilabel(expert_indices, num_experts):
274 """Convert expert indices to multi-label binary targets."""
275 N = len(expert_indices)
276 targets = np.zeros((N, num_experts), dtype=np.float32)
277 for i in range(N):
278 for j in range(expert_indices.shape[1]):
279 e = expert_indices[i, j]
280 if e >= 0: # skip -1 padding (0 is a valid expert index)
281 targets[i, e] = 1.0
282 return targets
283
284
285def build_cross_layer_pairs(layers, hiddens, experts, num_layers):

Callers 1

train_and_evaluateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected