geno_lewm.data.membership¶
membership
¶
Explicit, checksum-bound variant membership for v0.3 datasets.
MEMBERSHIP_SCHEMA_VERSION
module-attribute
¶
Schema version for canonical membership artifacts and policies.
REQUIRED_MEMBERSHIP_ROLES
module-attribute
¶
Roles that every membership contract must represent non-vacuously.
V03_CHROMOSOME_ROLES
module-attribute
¶
V03_CHROMOSOME_ROLES = ChromosomeRoles(train=(*(map(str, range(1, 20))), '22'), validation=('20',), evaluation=('21',))
Canonical chromosome split for the corrected v0.3 dataset.
ChromosomeRoles
dataclass
¶
Disjoint chromosome assignments for train, validation, and evaluation.
role_for
¶
Return the explicit role for chrom or fail if it is unassigned.
Source code in geno_lewm/data/membership.py
to_dict
¶
from_dict
classmethod
¶
Parse an explicit chromosome-role payload.
Source code in geno_lewm/data/membership.py
MembershipRow
dataclass
¶
MembershipRow(variant: CanonicalVariant, role: str, reason_mask: int, source: str, source_row_id: str)
One canonical variant assignment with source-level provenance.
to_dict
¶
Return the strict artifact-row payload.
Source code in geno_lewm/data/membership.py
from_dict
classmethod
¶
Parse one strict row and verify its key/digest binding.
Source code in geno_lewm/data/membership.py
MembershipArtifact
dataclass
¶
MembershipArtifact(artifact_id: str, assembly: str, chromosome_roles: ChromosomeRoles, rows: tuple[MembershipRow, ...], schema_version: str = MEMBERSHIP_SCHEMA_VERSION)
Canonical membership rows plus the chromosome policy that assigned them.
content_sha256
property
¶
Return the SHA-256 digest of the canonical artifact payload.
to_dict
¶
Return the deterministic, checksum-addressed artifact payload.
Source code in geno_lewm/data/membership.py
from_dict
classmethod
¶
Parse and validate a strict membership artifact payload.
Source code in geno_lewm/data/membership.py
MembershipArtifactBinding
dataclass
¶
MembershipArtifactBinding(artifact_id: str, sha256: str, row_count: int, variant_count: int, train_rows: int, validation_rows: int, evaluation_rows: int)
Hash and count commitments for one membership artifact.
from_artifact
classmethod
¶
Build an immutable commitment from validated artifact content.
Source code in geno_lewm/data/membership.py
to_dict
¶
Return the canonical JSON-native binding payload.
Source code in geno_lewm/data/membership.py
from_dict
classmethod
¶
from_dict(payload: Mapping[str, object], *, artifact: MembershipArtifact) -> MembershipArtifactBinding
Parse a strict binding and verify it against its source artifact.
Source code in geno_lewm/data/membership.py
MembershipHoldoutPolicy
dataclass
¶
MembershipHoldoutPolicy(assembly: str, chromosome_roles: ChromosomeRoles, artifact_bindings: tuple[MembershipArtifactBinding, ...], excluded_chromosomes: tuple[str, ...], excluded_variant_keys: tuple[str, ...], schema_version: str = MEMBERSHIP_SCHEMA_VERSION)
Validation/evaluation exclusions bound to membership hashes and counts.
excludes_variant
¶
Return whether a canonical variant is withheld from training.
Source code in geno_lewm/data/membership.py
to_dict
¶
Return the checksum- and count-bound policy plus its identity.
from_dict
classmethod
¶
from_dict(payload: Mapping[str, object], *, artifacts: Sequence[MembershipArtifact]) -> MembershipHoldoutPolicy
Parse a strict policy, verify its identity, and re-derive its bindings.
Source code in geno_lewm/data/membership.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 | |
derive_holdout_policy
¶
derive_holdout_policy(artifacts: Sequence[MembershipArtifact], *, expected_sha256: Mapping[str, str] | None = None) -> MembershipHoldoutPolicy
Derive validation/evaluation exclusions from validated membership artifacts.
When expected_sha256 is provided, its keys must exactly match the
artifact identifiers and every declared checksum must match the artifact's
canonical payload. Either way, the returned policy records the computed
checksums and role/row counts.
Source code in geno_lewm/data/membership.py
743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | |