(tmp_path: Path)
| 12 | |
| 13 | |
| 14 | def _make_seed_index(tmp_path: Path): |
| 15 | dim = 384 |
| 16 | rng = np.random.RandomState(42) |
| 17 | # Create cluster of similar vectors for tier 0 so KNN has enough |
| 18 | # same-label neighbors to exceed MIN_CONFIDENCE_TO_VOTE (0.30). |
| 19 | base = rng.randn(dim).astype(np.float32) |
| 20 | vecs = [base + rng.randn(dim).astype(np.float32) * 0.2 for _ in range(5)] |
| 21 | # Add a distant vector for tier 3 |
| 22 | far = rng.randn(dim).astype(np.float32) |
| 23 | vecs.append(far) |
| 24 | embeddings = np.array(vecs, dtype=np.float32) |
| 25 | norms = np.linalg.norm(embeddings, axis=1, keepdims=True) |
| 26 | embeddings = embeddings / norms |
| 27 | labels = [0, 0, 0, 0, 0, 3] |
| 28 | np.save(tmp_path / "seed_embeddings.npy", embeddings) |
| 29 | with open(tmp_path / "seed_labels.json", "w") as f: |
| 30 | json.dump(labels, f) |
| 31 | return embeddings, labels |
| 32 | |
| 33 | |
| 34 | def test_embedding_signal_with_seed_index(tmp_path): |
no test coverage detected