From 9abbe9fe76c245ff9352902e47b408a719c0ac4b Mon Sep 17 00:00:00 2001 From: aditya0by0 Date: Sat, 8 Aug 2026 11:23:01 +0200 Subject: [PATCH 01/18] chebi aug variant with all props except node level --- .../preprocessing/datasets/__init__.py | 4 +++- .../datasets/augmentation_base.py | 7 ++++++ chebai_graph/preprocessing/datasets/chebi.py | 7 ++++++ .../chebi50_all_props_except_node_lvl.yml | 24 +++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 configs/data/augmented/properties/chebi50_all_props_except_node_lvl.yml diff --git a/chebai_graph/preprocessing/datasets/__init__.py b/chebai_graph/preprocessing/datasets/__init__.py index 9ee9856..c1e0a23 100644 --- a/chebai_graph/preprocessing/datasets/__init__.py +++ b/chebai_graph/preprocessing/datasets/__init__.py @@ -1,4 +1,5 @@ from .chebi import ( + ChEBI25GraphProperties, ChEBI50_Atom_WGNOnly_GraphProp, ChEBI50_GN_WithAllNodes_FG_WithAtoms_FGE, ChEBI50_GN_WithAllNodes_FG_WithAtoms_NoFGE, @@ -9,6 +10,7 @@ ChEBI50_StaticGNI, ChEBI50_WFGE_NGN_GraphProp, ChEBI50_WFGE_WGN_AsPerNodeType, + ChEBI50_WFGE_WGN_ForAllPropsExceptNodeLevel, ChEBI50_WFGE_WGN_ForAtomAndFGLevelOnly, ChEBI50_WFGE_WGN_ForAtomLevelAndGraphNodeOnly, ChEBI50_WFGE_WGN_ForAtomLevelOnly, @@ -18,7 +20,6 @@ ChEBI50_WFGE_WGN_ForNodeLevelPropOnlyForAllNodes, ChEBI50_WFGE_WGN_GraphProp, ChEBI50GraphData, - ChEBI25GraphProperties, ChEBI50GraphProperties, ChEBI100GraphProperties, ) @@ -60,6 +61,7 @@ "ChEBI50_WFGE_WGN_ForAtomLevelAndGraphNodeOnly", "ChEBI50_WFGE_WGN_ForFGLevelAndGraphNodeOnly", "ChEBI50_WFGE_WGN_ForNodeLevelPropOnlyForAllNodes", + "ChEBI50_WFGE_WGN_ForAllPropsExceptNodeLevel", "BACE_WFGE_WGN_AsPerNodeType", "BBBP_WFGE_WGN_AsPerNodeType", "ClinTox_WFGE_WGN_AsPerNodeType", diff --git a/chebai_graph/preprocessing/datasets/augmentation_base.py b/chebai_graph/preprocessing/datasets/augmentation_base.py index 9bf6cdc..20ce564 100644 --- a/chebai_graph/preprocessing/datasets/augmentation_base.py +++ b/chebai_graph/preprocessing/datasets/augmentation_base.py @@ -177,3 +177,10 @@ def _fill_node_tensor_with_molecule_type_property( is_graph_node: torch.Tensor, ) -> torch.Tensor: return node_tensor + + +class GraphPropAllPropsExceptNodeLevel(GraphPropAsPerNodeType): + def _fill_node_tensor_with_all_node_type_property( + self, node_tensor: torch.Tensor, property_values: torch.Tensor, offset: int + ) -> torch.Tensor: + return node_tensor diff --git a/chebai_graph/preprocessing/datasets/chebi.py b/chebai_graph/preprocessing/datasets/chebi.py index 1962c31..c4ac4ed 100644 --- a/chebai_graph/preprocessing/datasets/chebi.py +++ b/chebai_graph/preprocessing/datasets/chebi.py @@ -25,6 +25,7 @@ from .augmentation_base import ( AugGraphPropMixIn_NoGraphNode, AugGraphPropMixIn_WithGraphNode, + GraphPropAllPropsExceptNodeLevel, GraphPropForAtomAndFGLevelOnly, GraphPropForAtomLevelAndGraphNodeOnly, GraphPropForAtomLevelOnly, @@ -204,6 +205,12 @@ class ChEBI50_WFGE_WGN_ForNodeLevelPropOnlyForAllNodes( READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_WFGE_WGN_ForAllPropsExceptNodeLevel( + GraphPropAllPropsExceptNodeLevel, ChEBIOver50 +): + READER = AtomFGReader_WithFGEdges_WithGraphNode + + # ---------- Final Augmentation: Different Thresholds ------------------------------ class ChEBI100_WFGE_WGN_AsPerNodeType(GraphPropAsPerNodeType, ChEBIOver100): READER = AtomFGReader_WithFGEdges_WithGraphNode diff --git a/configs/data/augmented/properties/chebi50_all_props_except_node_lvl.yml b/configs/data/augmented/properties/chebi50_all_props_except_node_lvl.yml new file mode 100644 index 0000000..a03da69 --- /dev/null +++ b/configs/data/augmented/properties/chebi50_all_props_except_node_lvl.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_WFGE_WGN_ForAllPropsExceptNodeLevel +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType From 05462dacf410bd216416aff568507cb100576a57 Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Mon, 10 Aug 2026 20:42:36 +0200 Subject: [PATCH 02/18] allow adding new tokens through augmented class for atom specific props --- chebai_graph/preprocessing/properties/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chebai_graph/preprocessing/properties/base.py b/chebai_graph/preprocessing/properties/base.py index f148df8..1f2e0aa 100644 --- a/chebai_graph/preprocessing/properties/base.py +++ b/chebai_graph/preprocessing/properties/base.py @@ -209,8 +209,8 @@ def on_finish(self) -> None: hasattr(self.encoder, "cache") and len(self.encoder.cache) > self.encoder.index_length_start ): - raise ValueError( - f"{self.__class__.__name__} attempted to add new tokens " + print( + f"{self.__class__.__name__} added new tokens " f"to a frozen encoder at {self.encoder.index_path}" ) super().on_finish() From d26b9b9e04179b0ce851c75f74c47ec6e221d7f0 Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Mon, 10 Aug 2026 20:42:52 +0200 Subject: [PATCH 03/18] BACE dataset tokens --- .../bin/bace/AtomCharge/indices_one_hot.txt | 3 ++ .../AtomFunctionalGroup/indices_one_hot.txt | 44 +++++++++++++++++++ .../AtomHybridization/indices_one_hot.txt | 3 ++ .../bace/AtomNodeLevel/indices_one_hot.txt | 3 ++ .../bin/bace/AtomNumHs/indices_one_hot.txt | 4 ++ .../bin/bace/AtomType/indices_one_hot.txt | 8 ++++ .../bin/bace/BondLevel/indices_one_hot.txt | 4 ++ .../bin/bace/BondType/indices_one_hot.txt | 4 ++ .../bin/bace/NumAtomBonds/indices_one_hot.txt | 4 ++ 9 files changed, 77 insertions(+) create mode 100644 chebai_graph/preprocessing/bin/bace/AtomCharge/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bace/AtomFunctionalGroup/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bace/AtomHybridization/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bace/AtomNodeLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bace/AtomNumHs/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bace/AtomType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bace/BondLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bace/BondType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bace/NumAtomBonds/indices_one_hot.txt diff --git a/chebai_graph/preprocessing/bin/bace/AtomCharge/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bace/AtomCharge/indices_one_hot.txt new file mode 100644 index 0000000..d7e52d1 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bace/AtomCharge/indices_one_hot.txt @@ -0,0 +1,3 @@ +0 +1 +-1 diff --git a/chebai_graph/preprocessing/bin/bace/AtomFunctionalGroup/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bace/AtomFunctionalGroup/indices_one_hot.txt new file mode 100644 index 0000000..b621c2a --- /dev/null +++ b/chebai_graph/preprocessing/bin/bace/AtomFunctionalGroup/indices_one_hot.txt @@ -0,0 +1,44 @@ +RING_6 +difluoromethyl +RING_5 +ether +alkyne +alkyl +primary_amine +fluoro +amide +graph_fg +NO_FG +alkene +tertiary_carbon +alkene_carbon +nitrile +trifluoromethyl +ketone +chloro +quaternary_carbon +sulfonyl +hydroxyl +bromo +secondary_amine +ester +aldoxime +sulfide +iodo +tertiary_amine +RING_4 +secondary_ketimine +ketoxime +RING_3 +carboxylate +acetal +sulfinyl +RING_7 +RING_16 +RING_15 +nitro +primary_ketimine +sulfonate_ester +RING_8 +RING_14 +RING_13 diff --git a/chebai_graph/preprocessing/bin/bace/AtomHybridization/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bace/AtomHybridization/indices_one_hot.txt new file mode 100644 index 0000000..7c99da3 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bace/AtomHybridization/indices_one_hot.txt @@ -0,0 +1,3 @@ +SP2 +SP3 +SP diff --git a/chebai_graph/preprocessing/bin/bace/AtomNodeLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bace/AtomNodeLevel/indices_one_hot.txt new file mode 100644 index 0000000..2d65776 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bace/AtomNodeLevel/indices_one_hot.txt @@ -0,0 +1,3 @@ +atom_node_lvl +fg_node_lvl +graph_node_level diff --git a/chebai_graph/preprocessing/bin/bace/AtomNumHs/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bace/AtomNumHs/indices_one_hot.txt new file mode 100644 index 0000000..c4b216a --- /dev/null +++ b/chebai_graph/preprocessing/bin/bace/AtomNumHs/indices_one_hot.txt @@ -0,0 +1,4 @@ +0 +1 +3 +2 diff --git a/chebai_graph/preprocessing/bin/bace/AtomType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bace/AtomType/indices_one_hot.txt new file mode 100644 index 0000000..6da4980 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bace/AtomType/indices_one_hot.txt @@ -0,0 +1,8 @@ +6 +7 +8 +9 +17 +16 +35 +53 diff --git a/chebai_graph/preprocessing/bin/bace/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bace/BondLevel/indices_one_hot.txt new file mode 100644 index 0000000..6b48d66 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bace/BondLevel/indices_one_hot.txt @@ -0,0 +1,4 @@ +within_atoms_lvl +atom_fg_lvl +within_fg_lvl +to_graphNode_lvl diff --git a/chebai_graph/preprocessing/bin/bace/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bace/BondType/indices_one_hot.txt new file mode 100644 index 0000000..f1a2ce5 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bace/BondType/indices_one_hot.txt @@ -0,0 +1,4 @@ +SINGLE +AROMATIC +TRIPLE +DOUBLE diff --git a/chebai_graph/preprocessing/bin/bace/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bace/NumAtomBonds/indices_one_hot.txt new file mode 100644 index 0000000..cf286d6 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bace/NumAtomBonds/indices_one_hot.txt @@ -0,0 +1,4 @@ +3 +2 +4 +1 From 1ce48efaba747c6e84938c5a78ade85800ebae46 Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Tue, 11 Aug 2026 23:59:57 +0200 Subject: [PATCH 04/18] check len of base_df after merge, to avoid memory blow due to duplicated entries leading to cross merge --- chebai_graph/preprocessing/datasets/base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/chebai_graph/preprocessing/datasets/base.py b/chebai_graph/preprocessing/datasets/base.py index 4e8e6c3..84d42be 100644 --- a/chebai_graph/preprocessing/datasets/base.py +++ b/chebai_graph/preprocessing/datasets/base.py @@ -462,6 +462,7 @@ def load_processed_data( base_data = super().load_processed_data(kind, filename) base_df = pd.DataFrame(base_data) base_df["ident"] = base_df["ident"].astype(str) + len_base_df_before_merge = len(base_df) props_categories = { "AllNodeTypeProperties": [], "FGNodeTypeProperties": [], @@ -524,11 +525,21 @@ def load_processed_data( ) property_df = pd.DataFrame(property_data) + assert len(property_df) == len(property_df["ident"].unique()), ( + f"Duplicate entries found in property {property.name} data. " + f"Unique entries {len(property_df['ident'].unique())}. " + f"Total entries {len(property_df)}. " + ) property_df["ident"] = property_df["ident"].astype(str) property_df.rename( columns={property.name: f"{property.name}"}, inplace=True ) + base_df = base_df.merge(property_df, on="ident", how="left") + assert len(base_df) == len_base_df_before_merge, ( + f"Length mismatch after merging property {property.name}. " + f"Expected {len_base_df_before_merge}, got {len(base_df)}" + ) base_df["features"] = base_df.apply( lambda row: self._merge_props_into_base( From f590aebb32fcc2a7549680f41896fcc32588ca2e Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Wed, 12 Aug 2026 13:56:52 +0200 Subject: [PATCH 05/18] BBBP tokens --- .../bin/bbbp/AtomCharge/indices_one_hot.txt | 4 + .../AtomFunctionalGroup/indices_one_hot.txt | 80 +++++++++++++++++++ .../AtomHybridization/indices_one_hot.txt | 4 + .../bbbp/AtomNodeLevel/indices_one_hot.txt | 3 + .../bin/bbbp/AtomNumHs/indices_one_hot.txt | 4 + .../bin/bbbp/AtomType/indices_one_hot.txt | 13 +++ .../bin/bbbp/BondLevel/indices_one_hot.txt | 4 + .../bin/bbbp/BondType/indices_one_hot.txt | 4 + .../bin/bbbp/NumAtomBonds/indices_one_hot.txt | 5 ++ 9 files changed, 121 insertions(+) create mode 100644 chebai_graph/preprocessing/bin/bbbp/AtomCharge/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bbbp/AtomFunctionalGroup/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bbbp/AtomHybridization/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bbbp/AtomNodeLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bbbp/AtomNumHs/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bbbp/AtomType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bbbp/BondLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bbbp/BondType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/bbbp/NumAtomBonds/indices_one_hot.txt diff --git a/chebai_graph/preprocessing/bin/bbbp/AtomCharge/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bbbp/AtomCharge/indices_one_hot.txt new file mode 100644 index 0000000..7b6a00a --- /dev/null +++ b/chebai_graph/preprocessing/bin/bbbp/AtomCharge/indices_one_hot.txt @@ -0,0 +1,4 @@ +0 +1 +-1 +2 diff --git a/chebai_graph/preprocessing/bin/bbbp/AtomFunctionalGroup/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bbbp/AtomFunctionalGroup/indices_one_hot.txt new file mode 100644 index 0000000..d2ee211 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bbbp/AtomFunctionalGroup/indices_one_hot.txt @@ -0,0 +1,80 @@ +alkyl +ester +chloro +RING_6 +tertiary_amine +graph_fg +tertiary_carbon +primary_amine +dichloromethyl +sulfonyl +ketone +secondary_amine +hydroxyl +ether +quaternary_carbon +amide +NO_FG +carboxyl +nitro +alkene +alkene_carbon +secondary_ketimine +secondary_aldimine +carboxylate +iodo +aldoxime +bromo +alkyne +fluoro +carbamate +trifluoromethyl +sulfide +trichloromethyl +hemiacetal +primary_ketimine +azide +4_ammonium_ion +sulfonate_ester +ketoxime +nitroso +sulfhydryl +difluoromethyl +fluorochloromethyl +chlorobromomethyl +phosphono +carbodithio +disulfide +difluorochloromethyl +carbonate_ester +phosphate +RING_5 +thiolester +RING_7 +nitrile +phosphoryl +aldehyde +sulfinyl +thioketone +acetal +RING_4 +sulfonic_acid +imide +RING_14 +RING_24 +amidine +RING_3 +RING_9 +RING_19 +RING_16 +RING_8 +isonitrile +RING_23 +RING_12 +RING_21 +RING_17 +RING_30 +RING_33 +RING_36 +azo +RING_15 diff --git a/chebai_graph/preprocessing/bin/bbbp/AtomHybridization/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bbbp/AtomHybridization/indices_one_hot.txt new file mode 100644 index 0000000..0e4a9aa --- /dev/null +++ b/chebai_graph/preprocessing/bin/bbbp/AtomHybridization/indices_one_hot.txt @@ -0,0 +1,4 @@ +SP3 +SP2 +S +SP diff --git a/chebai_graph/preprocessing/bin/bbbp/AtomNodeLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bbbp/AtomNodeLevel/indices_one_hot.txt new file mode 100644 index 0000000..2d65776 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bbbp/AtomNodeLevel/indices_one_hot.txt @@ -0,0 +1,3 @@ +atom_node_lvl +fg_node_lvl +graph_node_level diff --git a/chebai_graph/preprocessing/bin/bbbp/AtomNumHs/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bbbp/AtomNumHs/indices_one_hot.txt new file mode 100644 index 0000000..35f5032 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bbbp/AtomNumHs/indices_one_hot.txt @@ -0,0 +1,4 @@ +2 +0 +1 +3 diff --git a/chebai_graph/preprocessing/bin/bbbp/AtomType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bbbp/AtomType/indices_one_hot.txt new file mode 100644 index 0000000..9500570 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bbbp/AtomType/indices_one_hot.txt @@ -0,0 +1,13 @@ +6 +17 +8 +7 +16 +11 +53 +35 +9 +1 +15 +5 +20 diff --git a/chebai_graph/preprocessing/bin/bbbp/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bbbp/BondLevel/indices_one_hot.txt new file mode 100644 index 0000000..6b48d66 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bbbp/BondLevel/indices_one_hot.txt @@ -0,0 +1,4 @@ +within_atoms_lvl +atom_fg_lvl +within_fg_lvl +to_graphNode_lvl diff --git a/chebai_graph/preprocessing/bin/bbbp/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bbbp/BondType/indices_one_hot.txt new file mode 100644 index 0000000..a134437 --- /dev/null +++ b/chebai_graph/preprocessing/bin/bbbp/BondType/indices_one_hot.txt @@ -0,0 +1,4 @@ +DOUBLE +SINGLE +AROMATIC +TRIPLE diff --git a/chebai_graph/preprocessing/bin/bbbp/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/bbbp/NumAtomBonds/indices_one_hot.txt new file mode 100644 index 0000000..5d07eee --- /dev/null +++ b/chebai_graph/preprocessing/bin/bbbp/NumAtomBonds/indices_one_hot.txt @@ -0,0 +1,5 @@ +2 +4 +1 +3 +0 From f4cb1ace533ddbbebcb2a40d046c59bb4317ef37 Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Wed, 12 Aug 2026 14:27:20 +0200 Subject: [PATCH 06/18] hiv tokens --- .../bin/hiv/AtomCharge/indices_one_hot.txt | 9 ++ .../AtomFunctionalGroup/indices_one_hot.txt | 122 ++++++++++++++++++ .../hiv/AtomHybridization/indices_one_hot.txt | 7 + .../bin/hiv/AtomNodeLevel/indices_one_hot.txt | 3 + .../bin/hiv/AtomNumHs/indices_one_hot.txt | 5 + .../bin/hiv/AtomType/indices_one_hot.txt | 54 ++++++++ .../bin/hiv/BondLevel/indices_one_hot.txt | 0 .../bin/hiv/BondType/indices_one_hot.txt | 0 .../bin/hiv/NumAtomBonds/indices_one_hot.txt | 0 9 files changed, 200 insertions(+) create mode 100644 chebai_graph/preprocessing/bin/hiv/AtomCharge/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/hiv/AtomFunctionalGroup/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/hiv/AtomHybridization/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/hiv/AtomNodeLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/hiv/AtomNumHs/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/hiv/AtomType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/hiv/BondLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/hiv/BondType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/hiv/NumAtomBonds/indices_one_hot.txt diff --git a/chebai_graph/preprocessing/bin/hiv/AtomCharge/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/AtomCharge/indices_one_hot.txt new file mode 100644 index 0000000..22aacd7 --- /dev/null +++ b/chebai_graph/preprocessing/bin/hiv/AtomCharge/indices_one_hot.txt @@ -0,0 +1,9 @@ +0 +1 +-1 +3 +-4 +-3 +-2 +2 +-5 diff --git a/chebai_graph/preprocessing/bin/hiv/AtomFunctionalGroup/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/AtomFunctionalGroup/indices_one_hot.txt new file mode 100644 index 0000000..e5b33d4 --- /dev/null +++ b/chebai_graph/preprocessing/bin/hiv/AtomFunctionalGroup/indices_one_hot.txt @@ -0,0 +1,122 @@ +alkyl +RING_6 +chloro +NO_FG +secondary_amine +graph_fg +carboxyl +primary_amine +sulfonic_acid +nitro +ketone +hydroxyl +sulfonyl +ester +nitroso +sulfhydryl +tertiary_carbon +tertiary_amine +dichloromethyl +nitrile +primary_ketimine +alkyne +alkene +ether +iodo +sulfide +secondary_aldimine +phosphoryl +thioketone +alkene_carbon +secondary_ketimine +nitrate +4_ammonium_ion +ketoxime +amide +amidine +trichloromethyl +fluoro +quaternary_carbon +hydrazone +disulfide +thiocyanate +carbamate +trifluoromethyl +phosphate +sulfonate_ester +sulfinyl +azo +bromo +imide +carbodithioic_acid +carbodithio +sulfino +silyl_ether +aldehyde +phosphono +azide +aldoxime +phosphino +trimethylsilyl +thionoester +thiolester +isonitrile +acetal +difluorochloromethyl +dibromomethyl +ketal +diiodomethyl +borono +isothiocyanate +difluoromethyl +tribromomethyl +carbonate_ester +hemiacetal +phosphodiester +carboxylate +orthoester +isocyanate +primary_aldimine +hemiketal +borinate +RING_5 +cyanate +RING_4 +RING_24 +RING_3 +thial +RING_7 +RING_12 +RING_9 +RING_16 +hydroperoxy +RING_15 +RING_18 +RING_8 +RING_35 +RING_10 +RING_19 +RING_17 +RING_29 +RING_23 +RING_27 +RING_11 +RING_14 +RING_20 +RING_33 +RING_13 +RING_31 +RING_21 +RING_28 +RING_22 +RING_30 +RING_34 +RING_54 +RING_38 +RING_36 +RING_26 +RING_32 +carboxylic_anhydride +RING_25 +carbothioic_S-acid +RING_40 diff --git a/chebai_graph/preprocessing/bin/hiv/AtomHybridization/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/AtomHybridization/indices_one_hot.txt new file mode 100644 index 0000000..cdc6985 --- /dev/null +++ b/chebai_graph/preprocessing/bin/hiv/AtomHybridization/indices_one_hot.txt @@ -0,0 +1,7 @@ +SP3 +SP2 +SP +S +SP3D2 +SP3D +UNSPECIFIED diff --git a/chebai_graph/preprocessing/bin/hiv/AtomNodeLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/AtomNodeLevel/indices_one_hot.txt new file mode 100644 index 0000000..2d65776 --- /dev/null +++ b/chebai_graph/preprocessing/bin/hiv/AtomNodeLevel/indices_one_hot.txt @@ -0,0 +1,3 @@ +atom_node_lvl +fg_node_lvl +graph_node_level diff --git a/chebai_graph/preprocessing/bin/hiv/AtomNumHs/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/AtomNumHs/indices_one_hot.txt new file mode 100644 index 0000000..df4a3e9 --- /dev/null +++ b/chebai_graph/preprocessing/bin/hiv/AtomNumHs/indices_one_hot.txt @@ -0,0 +1,5 @@ +3 +1 +0 +2 +4 diff --git a/chebai_graph/preprocessing/bin/hiv/AtomType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/AtomType/indices_one_hot.txt new file mode 100644 index 0000000..95c9cba --- /dev/null +++ b/chebai_graph/preprocessing/bin/hiv/AtomType/indices_one_hot.txt @@ -0,0 +1,54 @@ +6 +17 +8 +7 +15 +16 +33 +53 +9 +35 +14 +11 +34 +79 +50 +80 +32 +51 +82 +5 +19 +3 +83 +29 +67 +44 +65 +74 +27 +55 +25 +26 +75 +42 +78 +47 +24 +46 +89 +20 +31 +12 +30 +28 +77 +1 +40 +81 +45 +22 +52 +64 +92 +23 diff --git a/chebai_graph/preprocessing/bin/hiv/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/BondLevel/indices_one_hot.txt new file mode 100644 index 0000000..e69de29 diff --git a/chebai_graph/preprocessing/bin/hiv/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/BondType/indices_one_hot.txt new file mode 100644 index 0000000..e69de29 diff --git a/chebai_graph/preprocessing/bin/hiv/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/NumAtomBonds/indices_one_hot.txt new file mode 100644 index 0000000..e69de29 From d2b439dfd8a3fa0eb38e94d5bcb839b2e4f8566e Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Wed, 12 Aug 2026 15:02:52 +0200 Subject: [PATCH 07/18] clintox tokens --- .../clin_tox/AtomCharge/indices_one_hot.txt | 6 ++ .../AtomFunctionalGroup/indices_one_hot.txt | 84 +++++++++++++++++++ .../AtomHybridization/indices_one_hot.txt | 7 ++ .../AtomNodeLevel/indices_one_hot.txt | 3 + .../clin_tox/AtomNumHs/indices_one_hot.txt | 4 + .../bin/clin_tox/AtomType/indices_one_hot.txt | 30 +++++++ .../clin_tox/BondLevel/indices_one_hot.txt | 4 + .../bin/clin_tox/BondType/indices_one_hot.txt | 5 ++ .../clin_tox/NumAtomBonds/indices_one_hot.txt | 6 ++ 9 files changed, 149 insertions(+) create mode 100644 chebai_graph/preprocessing/bin/clin_tox/AtomCharge/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/clin_tox/AtomFunctionalGroup/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/clin_tox/AtomHybridization/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/clin_tox/AtomNodeLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/clin_tox/AtomNumHs/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/clin_tox/AtomType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/clin_tox/BondLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/clin_tox/BondType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/clin_tox/NumAtomBonds/indices_one_hot.txt diff --git a/chebai_graph/preprocessing/bin/clin_tox/AtomCharge/indices_one_hot.txt b/chebai_graph/preprocessing/bin/clin_tox/AtomCharge/indices_one_hot.txt new file mode 100644 index 0000000..374de68 --- /dev/null +++ b/chebai_graph/preprocessing/bin/clin_tox/AtomCharge/indices_one_hot.txt @@ -0,0 +1,6 @@ +0 +-1 +1 +3 +2 +-2 diff --git a/chebai_graph/preprocessing/bin/clin_tox/AtomFunctionalGroup/indices_one_hot.txt b/chebai_graph/preprocessing/bin/clin_tox/AtomFunctionalGroup/indices_one_hot.txt new file mode 100644 index 0000000..36bc343 --- /dev/null +++ b/chebai_graph/preprocessing/bin/clin_tox/AtomFunctionalGroup/indices_one_hot.txt @@ -0,0 +1,84 @@ +alkyl +chloro +RING_6 +ether +secondary_amine +fluoro +graph_fg +tertiary_carbon +hydroxyl +ketone +sulfonyl +carboxylate +RING_5 +NO_FG +amide +sulfide +RING_4 +quaternary_carbon +alkyne +alkene +primary_amine +carboxyl +trifluoromethyl +ester +alkene_carbon +RING_20 +sulfhydryl +nitrile +RING_3 +RING_29 +RING_7 +4_ammonium_ion +acetal +RING_9 +iodo +RING_38 +sulfinyl +difluoromethyl +imide +RING_16 +tertiary_amine +nitro +RING_8 +secondary_ketimine +nitrate +sulfonic_acid +carbamate +secondary_aldimine +bromo +thioketone +RING_14 +azo +RING_33 +trichloromethyl +RING_15 +ketoxime +phosphodiester +RING_24 +RING_22 +aldehyde +RING_18 +RING_21 +nitroso +dichloromethyl +carbonate_ester +silyl_ether +thiolester +borono +aldoxime +sulfonate_ester +RING_23 +RING_19 +RING_25 +carbodithio +disulfide +RING_36 +RING_31 +fluorochloromethyl +RING_12 +phosphate +azide +chlorobromomethyl +bromodifluoromethyl +phosphino diff --git a/chebai_graph/preprocessing/bin/clin_tox/AtomHybridization/indices_one_hot.txt b/chebai_graph/preprocessing/bin/clin_tox/AtomHybridization/indices_one_hot.txt new file mode 100644 index 0000000..a96b9b3 --- /dev/null +++ b/chebai_graph/preprocessing/bin/clin_tox/AtomHybridization/indices_one_hot.txt @@ -0,0 +1,7 @@ +SP3 +SP2 +SP +S +SP3D2 +UNSPECIFIED +SP3D diff --git a/chebai_graph/preprocessing/bin/clin_tox/AtomNodeLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/clin_tox/AtomNodeLevel/indices_one_hot.txt new file mode 100644 index 0000000..2d65776 --- /dev/null +++ b/chebai_graph/preprocessing/bin/clin_tox/AtomNodeLevel/indices_one_hot.txt @@ -0,0 +1,3 @@ +atom_node_lvl +fg_node_lvl +graph_node_level diff --git a/chebai_graph/preprocessing/bin/clin_tox/AtomNumHs/indices_one_hot.txt b/chebai_graph/preprocessing/bin/clin_tox/AtomNumHs/indices_one_hot.txt new file mode 100644 index 0000000..1127527 --- /dev/null +++ b/chebai_graph/preprocessing/bin/clin_tox/AtomNumHs/indices_one_hot.txt @@ -0,0 +1,4 @@ +3 +0 +2 +1 diff --git a/chebai_graph/preprocessing/bin/clin_tox/AtomType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/clin_tox/AtomType/indices_one_hot.txt new file mode 100644 index 0000000..2c8a324 --- /dev/null +++ b/chebai_graph/preprocessing/bin/clin_tox/AtomType/indices_one_hot.txt @@ -0,0 +1,30 @@ +6 +17 +7 +8 +9 +16 +15 +53 +80 +1 +13 +35 +79 +0 +27 +22 +78 +33 +34 +30 +14 +5 +29 +24 +81 +43 +83 +25 +20 +26 diff --git a/chebai_graph/preprocessing/bin/clin_tox/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/clin_tox/BondLevel/indices_one_hot.txt new file mode 100644 index 0000000..6b48d66 --- /dev/null +++ b/chebai_graph/preprocessing/bin/clin_tox/BondLevel/indices_one_hot.txt @@ -0,0 +1,4 @@ +within_atoms_lvl +atom_fg_lvl +within_fg_lvl +to_graphNode_lvl diff --git a/chebai_graph/preprocessing/bin/clin_tox/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/clin_tox/BondType/indices_one_hot.txt new file mode 100644 index 0000000..bdc90d7 --- /dev/null +++ b/chebai_graph/preprocessing/bin/clin_tox/BondType/indices_one_hot.txt @@ -0,0 +1,5 @@ +SINGLE +AROMATIC +DOUBLE +TRIPLE +DATIVE diff --git a/chebai_graph/preprocessing/bin/clin_tox/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/clin_tox/NumAtomBonds/indices_one_hot.txt new file mode 100644 index 0000000..3c2db51 --- /dev/null +++ b/chebai_graph/preprocessing/bin/clin_tox/NumAtomBonds/indices_one_hot.txt @@ -0,0 +1,6 @@ +1 +3 +2 +4 +0 +6 From 3a8b8ed3370ee628d3ef1ce0717135a9a95f6260 Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Wed, 12 Aug 2026 15:03:55 +0200 Subject: [PATCH 08/18] sider tokens --- .../bin/sider/AtomCharge/indices_one_hot.txt | 6 ++ .../AtomFunctionalGroup/indices_one_hot.txt | 93 +++++++++++++++++++ .../AtomHybridization/indices_one_hot.txt | 6 ++ .../sider/AtomNodeLevel/indices_one_hot.txt | 3 + .../bin/sider/AtomNumHs/indices_one_hot.txt | 5 + .../bin/sider/AtomType/indices_one_hot.txt | 40 ++++++++ .../bin/sider/BondLevel/indices_one_hot.txt | 4 + .../bin/sider/BondType/indices_one_hot.txt | 4 + .../sider/NumAtomBonds/indices_one_hot.txt | 6 ++ 9 files changed, 167 insertions(+) create mode 100644 chebai_graph/preprocessing/bin/sider/AtomCharge/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/sider/AtomFunctionalGroup/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/sider/AtomHybridization/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/sider/AtomNodeLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/sider/AtomNumHs/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/sider/AtomType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/sider/BondLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/sider/BondType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/sider/NumAtomBonds/indices_one_hot.txt diff --git a/chebai_graph/preprocessing/bin/sider/AtomCharge/indices_one_hot.txt b/chebai_graph/preprocessing/bin/sider/AtomCharge/indices_one_hot.txt new file mode 100644 index 0000000..6f89a5d --- /dev/null +++ b/chebai_graph/preprocessing/bin/sider/AtomCharge/indices_one_hot.txt @@ -0,0 +1,6 @@ +0 +1 +-1 +3 +2 +-2 diff --git a/chebai_graph/preprocessing/bin/sider/AtomFunctionalGroup/indices_one_hot.txt b/chebai_graph/preprocessing/bin/sider/AtomFunctionalGroup/indices_one_hot.txt new file mode 100644 index 0000000..6fbc2c2 --- /dev/null +++ b/chebai_graph/preprocessing/bin/sider/AtomFunctionalGroup/indices_one_hot.txt @@ -0,0 +1,93 @@ +alkyl +RING_6 +carboxyl +alkene +fluoro +sulfinyl +RING_5 +graph_fg +tertiary_carbon +secondary_amine +ketone +primary_amine +primary_ketimine +NO_FG +sulfide +hydroxyl +sulfonic_acid +bromo +4_ammonium_ion +chloro +quaternary_carbon +ether +carboxylate +tertiary_amine +amide +RING_3 +trifluoromethyl +ester +nitro +sulfonyl +iodo +secondary_ketimine +RING_7 +aldehyde +phosphono +alkyne +nitrile +carbamate +alkene_carbon +carbonate_ester +RING_4 +RING_18 +RING_24 +RING_14 +imide +sulfonate_ester +RING_81 +RING_20 +RING_8 +nitroso +RING_29 +RING_16 +RING_12 +RING_21 +sulfhydryl +thiolester +difluoromethyl +thioketone +RING_25 +RING_78 +RING_68 +RING_77 +nitrate +azo +RING_36 +phosphate +ketoxime +secondary_aldimine +dichloromethyl +carboxylic_anhydride +RING_33 +borono +RING_15 +diiodomethyl +RING_23 +carbodithio +disulfide +acetal +RING_40 +phosphodiester +fluorochloromethyl +RING_22 +RING_10 +RING_9 +azide +phosphino +RING_31 +RING_28 +RING_53 +RING_56 +RING_41 +RING_43 +RING_35 diff --git a/chebai_graph/preprocessing/bin/sider/AtomHybridization/indices_one_hot.txt b/chebai_graph/preprocessing/bin/sider/AtomHybridization/indices_one_hot.txt new file mode 100644 index 0000000..e9958eb --- /dev/null +++ b/chebai_graph/preprocessing/bin/sider/AtomHybridization/indices_one_hot.txt @@ -0,0 +1,6 @@ +SP3 +SP2 +S +SP3D +SP +SP3D2 diff --git a/chebai_graph/preprocessing/bin/sider/AtomNodeLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/sider/AtomNodeLevel/indices_one_hot.txt new file mode 100644 index 0000000..2d65776 --- /dev/null +++ b/chebai_graph/preprocessing/bin/sider/AtomNodeLevel/indices_one_hot.txt @@ -0,0 +1,3 @@ +atom_node_lvl +fg_node_lvl +graph_node_level diff --git a/chebai_graph/preprocessing/bin/sider/AtomNumHs/indices_one_hot.txt b/chebai_graph/preprocessing/bin/sider/AtomNumHs/indices_one_hot.txt new file mode 100644 index 0000000..df4a3e9 --- /dev/null +++ b/chebai_graph/preprocessing/bin/sider/AtomNumHs/indices_one_hot.txt @@ -0,0 +1,5 @@ +3 +1 +0 +2 +4 diff --git a/chebai_graph/preprocessing/bin/sider/AtomType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/sider/AtomType/indices_one_hot.txt new file mode 100644 index 0000000..384eb37 --- /dev/null +++ b/chebai_graph/preprocessing/bin/sider/AtomType/indices_one_hot.txt @@ -0,0 +1,40 @@ +6 +8 +9 +16 +7 +35 +17 +11 +64 +15 +24 +53 +47 +49 +1 +25 +29 +20 +62 +3 +19 +78 +39 +43 +31 +26 +5 +12 +38 +79 +33 +30 +56 +98 +34 +32 +27 +88 +81 +57 diff --git a/chebai_graph/preprocessing/bin/sider/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/sider/BondLevel/indices_one_hot.txt new file mode 100644 index 0000000..6b48d66 --- /dev/null +++ b/chebai_graph/preprocessing/bin/sider/BondLevel/indices_one_hot.txt @@ -0,0 +1,4 @@ +within_atoms_lvl +atom_fg_lvl +within_fg_lvl +to_graphNode_lvl diff --git a/chebai_graph/preprocessing/bin/sider/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/sider/BondType/indices_one_hot.txt new file mode 100644 index 0000000..f14a241 --- /dev/null +++ b/chebai_graph/preprocessing/bin/sider/BondType/indices_one_hot.txt @@ -0,0 +1,4 @@ +SINGLE +DOUBLE +AROMATIC +TRIPLE diff --git a/chebai_graph/preprocessing/bin/sider/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/sider/NumAtomBonds/indices_one_hot.txt new file mode 100644 index 0000000..dfb5c6d --- /dev/null +++ b/chebai_graph/preprocessing/bin/sider/NumAtomBonds/indices_one_hot.txt @@ -0,0 +1,6 @@ +1 +2 +3 +4 +0 +6 From 13234d125ac7674e72131531ab3c37118e1be4cb Mon Sep 17 00:00:00 2001 From: aditya0by0 Date: Wed, 12 Aug 2026 17:31:41 +0200 Subject: [PATCH 09/18] HIV tokens --- .../bin/hiv/BondLevel/indices_one_hot.txt | 4 ++++ .../bin/hiv/BondType/indices_one_hot.txt | 5 +++++ .../bin/hiv/NumAtomBonds/indices_one_hot.txt | 11 +++++++++++ 3 files changed, 20 insertions(+) diff --git a/chebai_graph/preprocessing/bin/hiv/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/BondLevel/indices_one_hot.txt index e69de29..6b48d66 100644 --- a/chebai_graph/preprocessing/bin/hiv/BondLevel/indices_one_hot.txt +++ b/chebai_graph/preprocessing/bin/hiv/BondLevel/indices_one_hot.txt @@ -0,0 +1,4 @@ +within_atoms_lvl +atom_fg_lvl +within_fg_lvl +to_graphNode_lvl diff --git a/chebai_graph/preprocessing/bin/hiv/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/BondType/indices_one_hot.txt index e69de29..58c0a5c 100644 --- a/chebai_graph/preprocessing/bin/hiv/BondType/indices_one_hot.txt +++ b/chebai_graph/preprocessing/bin/hiv/BondType/indices_one_hot.txt @@ -0,0 +1,5 @@ +SINGLE +DOUBLE +AROMATIC +TRIPLE +DATIVE diff --git a/chebai_graph/preprocessing/bin/hiv/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/hiv/NumAtomBonds/indices_one_hot.txt index e69de29..88ddb48 100644 --- a/chebai_graph/preprocessing/bin/hiv/NumAtomBonds/indices_one_hot.txt +++ b/chebai_graph/preprocessing/bin/hiv/NumAtomBonds/indices_one_hot.txt @@ -0,0 +1,11 @@ +1 +2 +3 +4 +0 +5 +6 +9 +7 +8 +10 From 185b78d7f5afe966257497820e33888b64d3355a Mon Sep 17 00:00:00 2001 From: aditya0by0 Date: Thu, 13 Aug 2026 12:18:36 +0200 Subject: [PATCH 10/18] muv tokens --- .../bin/muv/AtomCharge/indices_one_hot.txt | 3 + .../AtomFunctionalGroup/indices_one_hot.txt | 68 +++++++++++++++++++ .../muv/AtomHybridization/indices_one_hot.txt | 3 + .../bin/muv/AtomNodeLevel/indices_one_hot.txt | 3 + .../bin/muv/AtomNumHs/indices_one_hot.txt | 4 ++ .../bin/muv/AtomType/indices_one_hot.txt | 7 ++ .../bin/muv/BondLevel/indices_one_hot.txt | 4 ++ .../bin/muv/BondType/indices_one_hot.txt | 4 ++ .../bin/muv/NumAtomBonds/indices_one_hot.txt | 4 ++ 9 files changed, 100 insertions(+) create mode 100644 chebai_graph/preprocessing/bin/muv/AtomCharge/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/muv/AtomFunctionalGroup/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/muv/AtomHybridization/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/muv/AtomNodeLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/muv/AtomNumHs/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/muv/AtomType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/muv/BondLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/muv/BondType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/muv/NumAtomBonds/indices_one_hot.txt diff --git a/chebai_graph/preprocessing/bin/muv/AtomCharge/indices_one_hot.txt b/chebai_graph/preprocessing/bin/muv/AtomCharge/indices_one_hot.txt new file mode 100644 index 0000000..d7e52d1 --- /dev/null +++ b/chebai_graph/preprocessing/bin/muv/AtomCharge/indices_one_hot.txt @@ -0,0 +1,3 @@ +0 +1 +-1 diff --git a/chebai_graph/preprocessing/bin/muv/AtomFunctionalGroup/indices_one_hot.txt b/chebai_graph/preprocessing/bin/muv/AtomFunctionalGroup/indices_one_hot.txt new file mode 100644 index 0000000..c55dc92 --- /dev/null +++ b/chebai_graph/preprocessing/bin/muv/AtomFunctionalGroup/indices_one_hot.txt @@ -0,0 +1,68 @@ +primary_amine +RING_6 +ketone +carboxyl +alkyl +tertiary_carbon +secondary_amine +graph_fg +hydroxyl +alkene +thioketone +bromo +fluoro +ester +ether +tertiary_amine +NO_FG +chloro +sulfonyl +difluoromethyl +quaternary_carbon +nitro +amide +alkyne +trifluoromethyl +aldoxime +alkene_carbon +nitrile +sulfide +secondary_aldimine +ketoxime +carbodithio +secondary_ketimine +thionoester +thiolester +sulfinyl +carbamate +thiocyanate +aldehyde +sulfonate_ester +amidine +trichloromethyl +sulfhydryl +sulfonic_acid +RING_5 +nitroso +acetal +carbonate_ester +imide +azo +primary_ketimine +dichloromethyl +RING_7 +RING_3 +RING_8 +hydrazone +RING_4 +RING_15 +RING_12 +azide +RING_13 +RING_18 +difluorochloromethyl +RING_14 +RING_9 +RING_11 +disulfide +4_ammonium_ion diff --git a/chebai_graph/preprocessing/bin/muv/AtomHybridization/indices_one_hot.txt b/chebai_graph/preprocessing/bin/muv/AtomHybridization/indices_one_hot.txt new file mode 100644 index 0000000..7c99da3 --- /dev/null +++ b/chebai_graph/preprocessing/bin/muv/AtomHybridization/indices_one_hot.txt @@ -0,0 +1,3 @@ +SP2 +SP3 +SP diff --git a/chebai_graph/preprocessing/bin/muv/AtomNodeLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/muv/AtomNodeLevel/indices_one_hot.txt new file mode 100644 index 0000000..2d65776 --- /dev/null +++ b/chebai_graph/preprocessing/bin/muv/AtomNodeLevel/indices_one_hot.txt @@ -0,0 +1,3 @@ +atom_node_lvl +fg_node_lvl +graph_node_level diff --git a/chebai_graph/preprocessing/bin/muv/AtomNumHs/indices_one_hot.txt b/chebai_graph/preprocessing/bin/muv/AtomNumHs/indices_one_hot.txt new file mode 100644 index 0000000..52db5ae --- /dev/null +++ b/chebai_graph/preprocessing/bin/muv/AtomNumHs/indices_one_hot.txt @@ -0,0 +1,4 @@ +2 +1 +0 +3 diff --git a/chebai_graph/preprocessing/bin/muv/AtomType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/muv/AtomType/indices_one_hot.txt new file mode 100644 index 0000000..c36ddc7 --- /dev/null +++ b/chebai_graph/preprocessing/bin/muv/AtomType/indices_one_hot.txt @@ -0,0 +1,7 @@ +7 +6 +8 +35 +9 +16 +17 diff --git a/chebai_graph/preprocessing/bin/muv/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/muv/BondLevel/indices_one_hot.txt new file mode 100644 index 0000000..6b48d66 --- /dev/null +++ b/chebai_graph/preprocessing/bin/muv/BondLevel/indices_one_hot.txt @@ -0,0 +1,4 @@ +within_atoms_lvl +atom_fg_lvl +within_fg_lvl +to_graphNode_lvl diff --git a/chebai_graph/preprocessing/bin/muv/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/muv/BondType/indices_one_hot.txt new file mode 100644 index 0000000..f14a241 --- /dev/null +++ b/chebai_graph/preprocessing/bin/muv/BondType/indices_one_hot.txt @@ -0,0 +1,4 @@ +SINGLE +DOUBLE +AROMATIC +TRIPLE diff --git a/chebai_graph/preprocessing/bin/muv/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/muv/NumAtomBonds/indices_one_hot.txt new file mode 100644 index 0000000..94ebaf9 --- /dev/null +++ b/chebai_graph/preprocessing/bin/muv/NumAtomBonds/indices_one_hot.txt @@ -0,0 +1,4 @@ +1 +2 +3 +4 From b6bc71d12d42bb20ab1e84028c02c525bbd53b81 Mon Sep 17 00:00:00 2001 From: aditya0by0 Date: Fri, 14 Aug 2026 23:11:50 +0200 Subject: [PATCH 11/18] pcba tokens --- .../bin/pcba/AtomCharge/indices_one_hot.txt | 8 ++ .../AtomFunctionalGroup/indices_one_hot.txt | 127 ++++++++++++++++++ .../AtomHybridization/indices_one_hot.txt | 7 + .../pcba/AtomNodeLevel/indices_one_hot.txt | 3 + .../bin/pcba/AtomNumHs/indices_one_hot.txt | 6 + .../bin/pcba/AtomType/indices_one_hot.txt | 44 ++++++ .../bin/pcba/BondLevel/indices_one_hot.txt | 4 + .../bin/pcba/BondType/indices_one_hot.txt | 4 + .../bin/pcba/NumAtomBonds/indices_one_hot.txt | 6 + 9 files changed, 209 insertions(+) create mode 100644 chebai_graph/preprocessing/bin/pcba/AtomCharge/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/pcba/AtomFunctionalGroup/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/pcba/AtomHybridization/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/pcba/AtomNodeLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/pcba/AtomNumHs/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/pcba/AtomType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/pcba/BondLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/pcba/BondType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/pcba/NumAtomBonds/indices_one_hot.txt diff --git a/chebai_graph/preprocessing/bin/pcba/AtomCharge/indices_one_hot.txt b/chebai_graph/preprocessing/bin/pcba/AtomCharge/indices_one_hot.txt new file mode 100644 index 0000000..7897486 --- /dev/null +++ b/chebai_graph/preprocessing/bin/pcba/AtomCharge/indices_one_hot.txt @@ -0,0 +1,8 @@ +0 +1 +-1 +3 +2 +4 +5 +6 diff --git a/chebai_graph/preprocessing/bin/pcba/AtomFunctionalGroup/indices_one_hot.txt b/chebai_graph/preprocessing/bin/pcba/AtomFunctionalGroup/indices_one_hot.txt new file mode 100644 index 0000000..89e00f3 --- /dev/null +++ b/chebai_graph/preprocessing/bin/pcba/AtomFunctionalGroup/indices_one_hot.txt @@ -0,0 +1,127 @@ +alkyl +RING_6 +sulfide +RING_5 +ketone +trifluoromethyl +secondary_amine +graph_fg +NO_FG +amide +sulfonyl +ether +quaternary_carbon +tertiary_carbon +imide +carboxyl +nitrile +ester +primary_amine +alkyne +fluoro +tertiary_amine +nitro +RING_7 +chloro +hydroxyl +RING_3 +alkene +secondary_aldimine +bromo +thioketone +sulfinyl +RING_4 +secondary_ketimine +RING_12 +primary_ketimine +alkene_carbon +carbamate +aldehyde +phosphoryl +trimethylsilyl +carboxylate +ketoxime +RING_23 +difluoromethyl +sulfonate_ester +RING_14 +iodo +thiocyanate +RING_8 +disulfide +carbonate_ester +RING_19 +sulfhydryl +nitroso +acetal +aldoxime +borono +RING_16 +phosphono +RING_9 +RING_15 +hydrazone +RING_11 +4_ammonium_ion +thiolester +trichloromethyl +carbodithio +azo +azide +sulfonic_acid +dichloromethyl +phosphodiester +borinate +RING_13 +RING_18 +thial +RING_21 +RING_10 +isocyanate +isonitrile +RING_22 +RING_36 +RING_20 +phosphate +amidine +dibromomethyl +RING_17 +peroxy +RING_40 +silyl_ether +thionoester +nitrate +haloformyl +hemiacetal +RING_25 +isothiocyanate +difluorochloromethyl +RING_24 +nitrosooxy +RING_32 +carbodithioic_acid +hydroperoxy +sulfino +RING_26 +tribromomethyl +RING_30 +RING_29 +diiodomethyl +phosphino +chlorobromomethyl +RING_33 +RING_38 +RING_34 +bromodifluoromethyl +carboxylic_anhydride +bromodichloromethyl +RING_27 +dichlorosilane +RING_42 +ketal +RING_28 +RING_56 +RING_31 +RING_35 +fluorochloromethyl +RING_54 diff --git a/chebai_graph/preprocessing/bin/pcba/AtomHybridization/indices_one_hot.txt b/chebai_graph/preprocessing/bin/pcba/AtomHybridization/indices_one_hot.txt new file mode 100644 index 0000000..fb3232b --- /dev/null +++ b/chebai_graph/preprocessing/bin/pcba/AtomHybridization/indices_one_hot.txt @@ -0,0 +1,7 @@ +SP3 +SP2 +SP +SP3D +S +UNSPECIFIED +SP3D2 diff --git a/chebai_graph/preprocessing/bin/pcba/AtomNodeLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/pcba/AtomNodeLevel/indices_one_hot.txt new file mode 100644 index 0000000..2d65776 --- /dev/null +++ b/chebai_graph/preprocessing/bin/pcba/AtomNodeLevel/indices_one_hot.txt @@ -0,0 +1,3 @@ +atom_node_lvl +fg_node_lvl +graph_node_level diff --git a/chebai_graph/preprocessing/bin/pcba/AtomNumHs/indices_one_hot.txt b/chebai_graph/preprocessing/bin/pcba/AtomNumHs/indices_one_hot.txt new file mode 100644 index 0000000..cad2399 --- /dev/null +++ b/chebai_graph/preprocessing/bin/pcba/AtomNumHs/indices_one_hot.txt @@ -0,0 +1,6 @@ +3 +1 +0 +2 +6 +4 diff --git a/chebai_graph/preprocessing/bin/pcba/AtomType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/pcba/AtomType/indices_one_hot.txt new file mode 100644 index 0000000..166ffe2 --- /dev/null +++ b/chebai_graph/preprocessing/bin/pcba/AtomType/indices_one_hot.txt @@ -0,0 +1,44 @@ +6 +16 +7 +8 +9 +17 +35 +15 +14 +53 +5 +29 +79 +38 +50 +30 +33 +34 +48 +51 +1 +26 +82 +27 +78 +80 +3 +28 +22 +56 +44 +11 +13 +46 +25 +83 +47 +60 +24 +64 +32 +49 +74 +31 diff --git a/chebai_graph/preprocessing/bin/pcba/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/pcba/BondLevel/indices_one_hot.txt new file mode 100644 index 0000000..6b48d66 --- /dev/null +++ b/chebai_graph/preprocessing/bin/pcba/BondLevel/indices_one_hot.txt @@ -0,0 +1,4 @@ +within_atoms_lvl +atom_fg_lvl +within_fg_lvl +to_graphNode_lvl diff --git a/chebai_graph/preprocessing/bin/pcba/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/pcba/BondType/indices_one_hot.txt new file mode 100644 index 0000000..c819d38 --- /dev/null +++ b/chebai_graph/preprocessing/bin/pcba/BondType/indices_one_hot.txt @@ -0,0 +1,4 @@ +SINGLE +AROMATIC +DOUBLE +TRIPLE diff --git a/chebai_graph/preprocessing/bin/pcba/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/pcba/NumAtomBonds/indices_one_hot.txt new file mode 100644 index 0000000..2efbda4 --- /dev/null +++ b/chebai_graph/preprocessing/bin/pcba/NumAtomBonds/indices_one_hot.txt @@ -0,0 +1,6 @@ +1 +2 +3 +4 +0 +5 From 695fe571dcf3620867b451732d115e508742da0b Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Sat, 15 Aug 2026 11:52:27 +0200 Subject: [PATCH 12/18] tox21 tokens --- .../bin/tox21/AtomCharge/indices_one_hot.txt | 6 + .../AtomFunctionalGroup/indices_one_hot.txt | 115 +++++++++++++++++ .../AtomHybridization/indices_one_hot.txt | 7 ++ .../tox21/AtomNodeLevel/indices_one_hot.txt | 3 + .../bin/tox21/AtomNumHs/indices_one_hot.txt | 6 + .../bin/tox21/AtomType/indices_one_hot.txt | 50 ++++++++ .../bin/tox21/BondLevel/indices_one_hot.txt | 4 + .../bin/tox21/BondType/indices_one_hot.txt | 4 + .../tox21/NumAtomBonds/indices_one_hot.txt | 7 ++ .../toxcast/AtomCharge/indices_one_hot.txt | 6 + .../AtomFunctionalGroup/indices_one_hot.txt | 117 ++++++++++++++++++ .../AtomHybridization/indices_one_hot.txt | 7 ++ .../toxcast/AtomNodeLevel/indices_one_hot.txt | 3 + .../bin/toxcast/AtomNumHs/indices_one_hot.txt | 5 + .../bin/toxcast/AtomType/indices_one_hot.txt | 53 ++++++++ .../bin/toxcast/BondLevel/indices_one_hot.txt | 4 + .../bin/toxcast/BondType/indices_one_hot.txt | 4 + .../toxcast/NumAtomBonds/indices_one_hot.txt | 7 ++ 18 files changed, 408 insertions(+) create mode 100644 chebai_graph/preprocessing/bin/tox21/AtomCharge/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/tox21/AtomFunctionalGroup/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/tox21/AtomHybridization/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/tox21/AtomNodeLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/tox21/AtomNumHs/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/tox21/AtomType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/tox21/BondLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/tox21/BondType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/tox21/NumAtomBonds/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/toxcast/AtomCharge/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/toxcast/AtomFunctionalGroup/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/toxcast/AtomHybridization/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/toxcast/AtomNodeLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/toxcast/AtomNumHs/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/toxcast/AtomType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/toxcast/BondLevel/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/toxcast/BondType/indices_one_hot.txt create mode 100644 chebai_graph/preprocessing/bin/toxcast/NumAtomBonds/indices_one_hot.txt diff --git a/chebai_graph/preprocessing/bin/tox21/AtomCharge/indices_one_hot.txt b/chebai_graph/preprocessing/bin/tox21/AtomCharge/indices_one_hot.txt new file mode 100644 index 0000000..a8bd8c3 --- /dev/null +++ b/chebai_graph/preprocessing/bin/tox21/AtomCharge/indices_one_hot.txt @@ -0,0 +1,6 @@ +0 +1 +-1 +2 +3 +-2 diff --git a/chebai_graph/preprocessing/bin/tox21/AtomFunctionalGroup/indices_one_hot.txt b/chebai_graph/preprocessing/bin/tox21/AtomFunctionalGroup/indices_one_hot.txt new file mode 100644 index 0000000..5aa0016 --- /dev/null +++ b/chebai_graph/preprocessing/bin/tox21/AtomFunctionalGroup/indices_one_hot.txt @@ -0,0 +1,115 @@ +alkyl +hemiacetal +ether +graph_fg +RING_18 +NO_FG +RING_6 +ester +tertiary_carbon +secondary_amine +ketone +carboxyl +RING_5 +amide +primary_amine +RING_4 +carboxylate +alkene +nitro +imide +4_ammonium_ion +bromo +chloro +hydroxyl +sulfonyl +fluoro +quaternary_carbon +alkene_carbon +RING_3 +alkyne +secondary_ketimine +nitrile +isocyanate +azo +tertiary_amine +trifluoromethyl +aldehyde +thiolester +sulfide +nitroso +phosphate +phosphoryl +RING_7 +iodo +acetal +carbodithio +carbonate_ester +RING_21 +difluoromethyl +disulfide +RING_25 +nitrate +carbamate +secondary_aldimine +sulfonic_acid +haloformyl +amidine +sulfhydryl +phosphono +dibromomethyl +RING_23 +trichloromethyl +sulfonate_ester +RING_40 +RING_24 +RING_15 +primary_ketimine +RING_29 +thioketone +aldoxime +RING_16 +nitrosooxy +sulfino +RING_36 +peroxy +RING_14 +ketoxime +thiocyanate +RING_8 +RING_17 +sulfinyl +dichloromethyl +primary_aldimine +tribromomethyl +RING_19 +RING_9 +silyl_ether +phosphodiester +RING_33 +azide +RING_27 +RING_26 +RING_20 +phosphino +RING_12 +trimethylsilyl +carboxylic_anhydride +orthoester +RING_10 +thionoester +isothiocyanate +borono +chlorobromomethyl +dichlorosilane +hydroperoxy +RING_35 +RING_30 +RING_28 +fluorochloromethyl +RING_13 +bromodichloromethyl +ketal +difluorochloromethyl +bromodifluoromethyl +RING_11 diff --git a/chebai_graph/preprocessing/bin/tox21/AtomHybridization/indices_one_hot.txt b/chebai_graph/preprocessing/bin/tox21/AtomHybridization/indices_one_hot.txt new file mode 100644 index 0000000..cdc6985 --- /dev/null +++ b/chebai_graph/preprocessing/bin/tox21/AtomHybridization/indices_one_hot.txt @@ -0,0 +1,7 @@ +SP3 +SP2 +SP +S +SP3D2 +SP3D +UNSPECIFIED diff --git a/chebai_graph/preprocessing/bin/tox21/AtomNodeLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/tox21/AtomNodeLevel/indices_one_hot.txt new file mode 100644 index 0000000..2d65776 --- /dev/null +++ b/chebai_graph/preprocessing/bin/tox21/AtomNodeLevel/indices_one_hot.txt @@ -0,0 +1,3 @@ +atom_node_lvl +fg_node_lvl +graph_node_level diff --git a/chebai_graph/preprocessing/bin/tox21/AtomNumHs/indices_one_hot.txt b/chebai_graph/preprocessing/bin/tox21/AtomNumHs/indices_one_hot.txt new file mode 100644 index 0000000..5a694e8 --- /dev/null +++ b/chebai_graph/preprocessing/bin/tox21/AtomNumHs/indices_one_hot.txt @@ -0,0 +1,6 @@ +3 +2 +1 +0 +4 +6 diff --git a/chebai_graph/preprocessing/bin/tox21/AtomType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/tox21/AtomType/indices_one_hot.txt new file mode 100644 index 0000000..64e481b --- /dev/null +++ b/chebai_graph/preprocessing/bin/tox21/AtomType/indices_one_hot.txt @@ -0,0 +1,50 @@ +6 +8 +7 +16 +15 +35 +17 +9 +56 +30 +26 +80 +53 +28 +5 +51 +14 +47 +11 +78 +40 +79 +4 +29 +20 +34 +81 +50 +82 +23 +32 +38 +48 +46 +60 +27 +83 +64 +25 +19 +33 +22 +3 +12 +42 +66 +24 +1 +49 +70 diff --git a/chebai_graph/preprocessing/bin/tox21/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/tox21/BondLevel/indices_one_hot.txt new file mode 100644 index 0000000..6b48d66 --- /dev/null +++ b/chebai_graph/preprocessing/bin/tox21/BondLevel/indices_one_hot.txt @@ -0,0 +1,4 @@ +within_atoms_lvl +atom_fg_lvl +within_fg_lvl +to_graphNode_lvl diff --git a/chebai_graph/preprocessing/bin/tox21/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/tox21/BondType/indices_one_hot.txt new file mode 100644 index 0000000..c819d38 --- /dev/null +++ b/chebai_graph/preprocessing/bin/tox21/BondType/indices_one_hot.txt @@ -0,0 +1,4 @@ +SINGLE +AROMATIC +DOUBLE +TRIPLE diff --git a/chebai_graph/preprocessing/bin/tox21/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/tox21/NumAtomBonds/indices_one_hot.txt new file mode 100644 index 0000000..21b19a8 --- /dev/null +++ b/chebai_graph/preprocessing/bin/tox21/NumAtomBonds/indices_one_hot.txt @@ -0,0 +1,7 @@ +1 +2 +3 +4 +0 +5 +6 diff --git a/chebai_graph/preprocessing/bin/toxcast/AtomCharge/indices_one_hot.txt b/chebai_graph/preprocessing/bin/toxcast/AtomCharge/indices_one_hot.txt new file mode 100644 index 0000000..c857ab5 --- /dev/null +++ b/chebai_graph/preprocessing/bin/toxcast/AtomCharge/indices_one_hot.txt @@ -0,0 +1,6 @@ +0 +-1 +1 +2 +3 +-2 diff --git a/chebai_graph/preprocessing/bin/toxcast/AtomFunctionalGroup/indices_one_hot.txt b/chebai_graph/preprocessing/bin/toxcast/AtomFunctionalGroup/indices_one_hot.txt new file mode 100644 index 0000000..500ebf5 --- /dev/null +++ b/chebai_graph/preprocessing/bin/toxcast/AtomFunctionalGroup/indices_one_hot.txt @@ -0,0 +1,117 @@ +ester +RING_6 +sulfonyl +alkyl +NO_FG +4_ammonium_ion +graph_fg +sulfide +primary_amine +carboxyl +chloro +quaternary_carbon +hydroxyl +secondary_amine +fluoro +ketone +tertiary_carbon +ether +alkene +nitro +tertiary_amine +aldehyde +RING_5 +alkyne +nitrile +RING_7 +alkene_carbon +carbonate_ester +trifluoromethyl +imide +sulfonic_acid +primary_ketimine +disulfide +sulfonate_ester +amide +nitroso +iodo +RING_3 +carboxylate +RING_8 +RING_20 +acetal +bromo +carbamate +RING_12 +ketoxime +RING_18 +silyl_ether +RING_4 +dichloromethyl +sulfinyl +aldoxime +thioketone +secondary_ketimine +isothiocyanate +isocyanate +RING_14 +sulfhydryl +phosphono +carbodithioic_acid +secondary_aldimine +haloformyl +phosphoryl +azo +nitrate +RING_35 +thiocyanate +hemiacetal +thiolester +difluorochloromethyl +dibromomethyl +difluoromethyl +phosphino +RING_29 +chlorobromomethyl +RING_9 +tribromomethyl +trichloromethyl +RING_28 +RING_16 +nitrosooxy +bromodichloromethyl +carbodithio +phosphodiester +RING_23 +phosphate +carboxylic_anhydride +RING_13 +RING_24 +RING_30 +RING_11 +RING_17 +azide +RING_40 +primary_aldimine +RING_15 +peroxy +RING_33 +trimethylsilyl +sulfino +ketal +RING_10 +thionoester +borono +amidine +orthoester +RING_27 +RING_26 +RING_38 +hydroperoxy +RING_21 +RING_19 +dichlorosilane +diiodomethyl +fluorochloromethyl +bromodifluoromethyl +RING_36 diff --git a/chebai_graph/preprocessing/bin/toxcast/AtomHybridization/indices_one_hot.txt b/chebai_graph/preprocessing/bin/toxcast/AtomHybridization/indices_one_hot.txt new file mode 100644 index 0000000..5d039f5 --- /dev/null +++ b/chebai_graph/preprocessing/bin/toxcast/AtomHybridization/indices_one_hot.txt @@ -0,0 +1,7 @@ +SP2 +SP3 +SP +S +UNSPECIFIED +SP3D2 +SP3D diff --git a/chebai_graph/preprocessing/bin/toxcast/AtomNodeLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/toxcast/AtomNodeLevel/indices_one_hot.txt new file mode 100644 index 0000000..2d65776 --- /dev/null +++ b/chebai_graph/preprocessing/bin/toxcast/AtomNodeLevel/indices_one_hot.txt @@ -0,0 +1,3 @@ +atom_node_lvl +fg_node_lvl +graph_node_level diff --git a/chebai_graph/preprocessing/bin/toxcast/AtomNumHs/indices_one_hot.txt b/chebai_graph/preprocessing/bin/toxcast/AtomNumHs/indices_one_hot.txt new file mode 100644 index 0000000..ed1daa5 --- /dev/null +++ b/chebai_graph/preprocessing/bin/toxcast/AtomNumHs/indices_one_hot.txt @@ -0,0 +1,5 @@ +0 +1 +3 +2 +4 diff --git a/chebai_graph/preprocessing/bin/toxcast/AtomType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/toxcast/AtomType/indices_one_hot.txt new file mode 100644 index 0000000..9c59d72 --- /dev/null +++ b/chebai_graph/preprocessing/bin/toxcast/AtomType/indices_one_hot.txt @@ -0,0 +1,53 @@ +8 +6 +7 +16 +17 +9 +50 +19 +22 +14 +11 +53 +35 +33 +49 +78 +15 +51 +12 +3 +83 +28 +26 +13 +20 +47 +29 +5 +1 +30 +38 +80 +27 +34 +79 +56 +81 +24 +23 +21 +64 +70 +60 +46 +32 +4 +82 +66 +25 +48 +63 +40 +42 diff --git a/chebai_graph/preprocessing/bin/toxcast/BondLevel/indices_one_hot.txt b/chebai_graph/preprocessing/bin/toxcast/BondLevel/indices_one_hot.txt new file mode 100644 index 0000000..6b48d66 --- /dev/null +++ b/chebai_graph/preprocessing/bin/toxcast/BondLevel/indices_one_hot.txt @@ -0,0 +1,4 @@ +within_atoms_lvl +atom_fg_lvl +within_fg_lvl +to_graphNode_lvl diff --git a/chebai_graph/preprocessing/bin/toxcast/BondType/indices_one_hot.txt b/chebai_graph/preprocessing/bin/toxcast/BondType/indices_one_hot.txt new file mode 100644 index 0000000..f14a241 --- /dev/null +++ b/chebai_graph/preprocessing/bin/toxcast/BondType/indices_one_hot.txt @@ -0,0 +1,4 @@ +SINGLE +DOUBLE +AROMATIC +TRIPLE diff --git a/chebai_graph/preprocessing/bin/toxcast/NumAtomBonds/indices_one_hot.txt b/chebai_graph/preprocessing/bin/toxcast/NumAtomBonds/indices_one_hot.txt new file mode 100644 index 0000000..a61fff5 --- /dev/null +++ b/chebai_graph/preprocessing/bin/toxcast/NumAtomBonds/indices_one_hot.txt @@ -0,0 +1,7 @@ +2 +1 +3 +4 +0 +6 +5 From 8f51ea7fdbc09033f2631699c752918b41a91cbf Mon Sep 17 00:00:00 2001 From: aditya0by0 Date: Sat, 15 Aug 2026 15:39:38 +0200 Subject: [PATCH 13/18] batch script for augmentation ablation --- .../aug-ablation/aug-ablation-script.sh | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 configs/data/augmented/aug-ablation/aug-ablation-script.sh diff --git a/configs/data/augmented/aug-ablation/aug-ablation-script.sh b/configs/data/augmented/aug-ablation/aug-ablation-script.sh new file mode 100644 index 0000000..41f8506 --- /dev/null +++ b/configs/data/augmented/aug-ablation/aug-ablation-script.sh @@ -0,0 +1,208 @@ +#!/bin/bash + +#SBATCH --time=48:00:00 +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=32 +#SBATCH --threads-per-core=1 +#SBATCH --mem=256000 + +#SBATCH --partition=gpu +#SBATCH --gres=gpu:1 +#SBATCH --constraint="A100|H100.80gb" + +# ============================================================ +# Job array +# +# 9 data configurations × 3 seeds = 27 experiments +# Maximum 3 experiments running simultaneously +# ============================================================ + +#SBATCH --array=0-26%9 + +#SBATCH --job-name=aug-ablation + +# Separate output/error file for every array task +#SBATCH --output=aug-ablation_%A_%a.out +#SBATCH --error=aug-ablation_%A_%a.err + + +# ============================================================ +# Shell settings +# ============================================================ + +set -x +set -euo pipefail + +# ============================================================ +# Seeds +# ============================================================ + +SEEDS=(0 42 12345) + + +# ============================================================ +# Data configurations +# +# Add/remove configs here. +# +# IMPORTANT: +# The number of array tasks must be: +# +# number of data configs × number of seeds +# +# ============================================================ + +DATA_CONFIGS=( + "../python-chebai-graph/configs/data/augmented/aug-ablation/FGN.yml" + "../python-chebai-graph/configs/data/augmented/aug-ablation/FGN+E.yml" + "../python-chebai-graph/configs/data/augmented/aug-ablation/FGN+E+WGN.yml" + "../python-chebai-graph/configs/data/augmented/aug-ablation/FGN+WGN.yml" + "../python-chebai-graph/configs/data/augmented/aug-ablation/gn_wall_fgwa_nfge.yml" + "../python-chebai-graph/configs/data/augmented/aug-ablation/gn_wall_fgwa_wfge.yml" + "../python-chebai-graph/configs/data/augmented/aug-ablation/gnwa_fgwa_nfge.yml" + "../python-chebai-graph/configs/data/augmented/aug-ablation/gnwa_fgwa_wfge.yml" + "../python-chebai-graph/configs/data/augmented/aug-ablation/WGN.yml" +) + + +# ============================================================ +# Determine data config and seed from array task ID +# ============================================================ + +# Array task ordering: +# All data configurations are run for seed 0 first, +# followed by all data configurations for seed 42, +# and finally all data configurations for seed 12345. +# This is intentionally because the data is generated in first run for each data configuration. +# Then the following runs for the same data configuration can re-use the same generated data. + +NUM_SEEDS=${#SEEDS[@]} +NUM_DATA_CONFIGS=${#DATA_CONFIGS[@]} + +SEED_INDEX=$((SLURM_ARRAY_TASK_ID / NUM_DATA_CONFIGS)) +DATA_INDEX=$((SLURM_ARRAY_TASK_ID % NUM_DATA_CONFIGS)) + +DATA_CONFIG=${DATA_CONFIGS[$DATA_INDEX]} +SEED=${SEEDS[$SEED_INDEX]} + + +# ============================================================ +# Create experiment name +# ============================================================ + +DATA_NAME=$(basename "$DATA_CONFIG" .yml) + +RUN_NAME="${DATA_NAME}_s${SEED}" + + +# ============================================================ +# Print job information +# ============================================================ + +echo "============================================================" +echo "Job ID: $SLURM_JOB_ID" +echo "Array Job ID: $SLURM_ARRAY_JOB_ID" +echo "Array Task ID: $SLURM_ARRAY_TASK_ID" +echo "Data index: $DATA_INDEX" +echo "Seed index: $SEED_INDEX" +echo "Data config: $DATA_CONFIG" +echo "Data name: $DATA_NAME" +echo "Seed: $SEED" +echo "Run name: $RUN_NAME" +echo "Node: $(hostname)" +echo "Date: $(date)" +echo "============================================================" + +echo "GPU information:" +nvidia-smi + +echo "============================================================" + + +# ============================================================ +# Temporary directory +# ============================================================ + +export TMPDIR=/home/staff/a/akhedekar/atmp_dir/ + +export SSL_CERT_FILE=$(python -m certifi) + + +# ============================================================ +# Activate Python environment +# ============================================================ + +source /home/staff/a/akhedekar/python-chebai-graph/.venv/bin/activate + + +# ============================================================ +# Set working directory +# ============================================================ + +CHEBAI_DIR="/home/staff/a/akhedekar/python-chebai" + +cd "$CHEBAI_DIR" + + +# ============================================================ +# Check selected configuration +# ============================================================ + +if [[ ! -f "$DATA_CONFIG" ]]; then + echo "ERROR: Data configuration does not exist:" + echo "$DATA_CONFIG" + exit 1 +fi + + +# ============================================================ +# Set seed +# ============================================================ + +echo "Using seed: $SEED" + +export SEED="$SEED" + + +# ============================================================ +# Run training +# ============================================================ + +python -m chebai fit \ + --trainer=configs/training/default_trainer.yml \ + --trainer.logger=configs/training/wandb_logger.yml \ + --model=../python-chebai-graph/configs/model/baselines/gat.yml \ + --model.train_metrics=configs/metrics/micro-macro-f1.yml \ + --model.test_metrics=configs/metrics/micro-macro-f1.yml \ + --model.val_metrics=configs/metrics/micro-macro-f1.yml \ + --data="$DATA_CONFIG" \ + --data.init_args.batch_size=64 \ + --trainer.accumulate_grad_batches=1 \ + --data.init_args.num_workers=10 \ + --model.pass_loss_kwargs=false \ + --data.init_args.chebi_version=252 \ + --trainer.min_epochs=200 \ + --trainer.max_epochs=200 \ + --model.criterion=configs/loss/bce_unweighted.yml \ + --trainer.logger.init_args.name="$RUN_NAME" \ + --model.init_args.optimizer_kwargs.lr=0.002 \ + --data.init_args.splits_file_path=data/chebi_v252/ChEBI50/processed/splits.csv \ + --trainer.logger.init_args.tags='["augmented_paper","aug-ablation"]' \ + --seed_everything="$SEED" + + +# ============================================================ +# Finished +# ============================================================ + +echo "============================================================" +echo "Training finished successfully" +echo "============================================================" +echo "Job ID: $SLURM_JOB_ID" +echo "Array Task ID: $SLURM_ARRAY_TASK_ID" +echo "Data config: $DATA_CONFIG" +echo "Seed: $SEED" +echo "Run name: $RUN_NAME" +echo "Node: $(hostname)" +echo "Date: $(date)" +echo "============================================================" From a94c7fd748b02addda2980eab6e8abb3a146f7ca Mon Sep 17 00:00:00 2001 From: aditya0by0 Date: Sat, 15 Aug 2026 17:40:59 +0200 Subject: [PATCH 14/18] fix ssl error --- .../aug-ablation/aug-ablation-script.sh | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/configs/data/augmented/aug-ablation/aug-ablation-script.sh b/configs/data/augmented/aug-ablation/aug-ablation-script.sh index 41f8506..c21b85b 100644 --- a/configs/data/augmented/aug-ablation/aug-ablation-script.sh +++ b/configs/data/augmented/aug-ablation/aug-ablation-script.sh @@ -39,7 +39,6 @@ set -euo pipefail SEEDS=(0 42 12345) - # ============================================================ # Data configurations # @@ -64,7 +63,6 @@ DATA_CONFIGS=( "../python-chebai-graph/configs/data/augmented/aug-ablation/WGN.yml" ) - # ============================================================ # Determine data config and seed from array task ID # ============================================================ @@ -85,16 +83,13 @@ DATA_INDEX=$((SLURM_ARRAY_TASK_ID % NUM_DATA_CONFIGS)) DATA_CONFIG=${DATA_CONFIGS[$DATA_INDEX]} SEED=${SEEDS[$SEED_INDEX]} - # ============================================================ # Create experiment name # ============================================================ DATA_NAME=$(basename "$DATA_CONFIG" .yml) - RUN_NAME="${DATA_NAME}_s${SEED}" - # ============================================================ # Print job information # ============================================================ @@ -118,31 +113,25 @@ nvidia-smi echo "============================================================" - # ============================================================ # Temporary directory # ============================================================ export TMPDIR=/home/staff/a/akhedekar/atmp_dir/ -export SSL_CERT_FILE=$(python -m certifi) - - # ============================================================ # Activate Python environment # ============================================================ source /home/staff/a/akhedekar/python-chebai-graph/.venv/bin/activate - # ============================================================ # Set working directory # ============================================================ CHEBAI_DIR="/home/staff/a/akhedekar/python-chebai" - cd "$CHEBAI_DIR" - +export SSL_CERT_FILE=$(python -m certifi) # ============================================================ # Check selected configuration @@ -154,16 +143,6 @@ if [[ ! -f "$DATA_CONFIG" ]]; then exit 1 fi - -# ============================================================ -# Set seed -# ============================================================ - -echo "Using seed: $SEED" - -export SEED="$SEED" - - # ============================================================ # Run training # ============================================================ From 1a3e3c5e5b766336004834ca38d5b4748bacdf72 Mon Sep 17 00:00:00 2001 From: aditya0by0 Date: Tue, 18 Aug 2026 15:19:51 +0200 Subject: [PATCH 15/18] add baseline to aug-ablation script too --- configs/data/augmented/aug-ablation/aug-ablation-script.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configs/data/augmented/aug-ablation/aug-ablation-script.sh b/configs/data/augmented/aug-ablation/aug-ablation-script.sh index c21b85b..d19dd95 100644 --- a/configs/data/augmented/aug-ablation/aug-ablation-script.sh +++ b/configs/data/augmented/aug-ablation/aug-ablation-script.sh @@ -13,11 +13,11 @@ # ============================================================ # Job array # -# 9 data configurations × 3 seeds = 27 experiments -# Maximum 3 experiments running simultaneously +# 10 data configurations × 3 seeds = 30 experiments +# Maximum 10 experiments running simultaneously # ============================================================ -#SBATCH --array=0-26%9 +#SBATCH --array=0-29%10 #SBATCH --job-name=aug-ablation @@ -61,6 +61,7 @@ DATA_CONFIGS=( "../python-chebai-graph/configs/data/augmented/aug-ablation/gnwa_fgwa_nfge.yml" "../python-chebai-graph/configs/data/augmented/aug-ablation/gnwa_fgwa_wfge.yml" "../python-chebai-graph/configs/data/augmented/aug-ablation/WGN.yml" + "../python-chebai-graph/configs/data/chebi50_baseline.yml" ) # ============================================================ From a5a2c2e57ef1390b4802b1fb533f7ff544a54e44 Mon Sep 17 00:00:00 2001 From: aditya0by0 Date: Wed, 19 Aug 2026 22:33:31 +0200 Subject: [PATCH 16/18] aug props for gnwa_wfga_wfge --- .../preprocessing/datasets/__init__.py | 18 ++++++++ chebai_graph/preprocessing/datasets/chebi.py | 46 +++++++++++++++++++ .../chebi50_all_props_except_node_lvl.yml | 0 .../chebi50_atom_fg_prop_only.yml | 0 .../chebi50_atom_graph_node_prop_only.yml | 0 .../chebi50_atom_prop_only.yml | 0 .../chebi50_fg_graph_node_prop_only.yml | 0 .../{ => FGN+E+WGN}/chebi50_fg_prop_only.yml | 0 .../chebi50_graph_node_prop_only.yml | 0 .../chebi50_node_level_prop_only.yml | 0 .../gnwa_fgwa_wfge/chebi50_all_props.yml | 24 ++++++++++ .../chebi50_all_props_except_node_lvl.yml | 24 ++++++++++ .../chebi50_atom_fg_prop_only.yml | 24 ++++++++++ .../chebi50_atom_graph_node_prop_only.yml | 24 ++++++++++ .../gnwa_fgwa_wfge/chebi50_atom_prop_only.yml | 24 ++++++++++ .../chebi50_fg_graph_node_prop_only.yml | 24 ++++++++++ .../gnwa_fgwa_wfge/chebi50_fg_prop_only.yml | 24 ++++++++++ .../chebi50_graph_node_prop_only.yml | 24 ++++++++++ .../chebi50_node_level_prop_only.yml | 24 ++++++++++ 19 files changed, 280 insertions(+) rename configs/data/augmented/properties/{ => FGN+E+WGN}/chebi50_all_props_except_node_lvl.yml (100%) rename configs/data/augmented/properties/{ => FGN+E+WGN}/chebi50_atom_fg_prop_only.yml (100%) rename configs/data/augmented/properties/{ => FGN+E+WGN}/chebi50_atom_graph_node_prop_only.yml (100%) rename configs/data/augmented/properties/{ => FGN+E+WGN}/chebi50_atom_prop_only.yml (100%) rename configs/data/augmented/properties/{ => FGN+E+WGN}/chebi50_fg_graph_node_prop_only.yml (100%) rename configs/data/augmented/properties/{ => FGN+E+WGN}/chebi50_fg_prop_only.yml (100%) rename configs/data/augmented/properties/{ => FGN+E+WGN}/chebi50_graph_node_prop_only.yml (100%) rename configs/data/augmented/properties/{ => FGN+E+WGN}/chebi50_node_level_prop_only.yml (100%) create mode 100644 configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_all_props.yml create mode 100644 configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_all_props_except_node_lvl.yml create mode 100644 configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_fg_prop_only.yml create mode 100644 configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_graph_node_prop_only.yml create mode 100644 configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_prop_only.yml create mode 100644 configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_fg_graph_node_prop_only.yml create mode 100644 configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_fg_prop_only.yml create mode 100644 configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_graph_node_prop_only.yml create mode 100644 configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_node_level_prop_only.yml diff --git a/chebai_graph/preprocessing/datasets/__init__.py b/chebai_graph/preprocessing/datasets/__init__.py index c1e0a23..b0b1df5 100644 --- a/chebai_graph/preprocessing/datasets/__init__.py +++ b/chebai_graph/preprocessing/datasets/__init__.py @@ -5,6 +5,15 @@ ChEBI50_GN_WithAllNodes_FG_WithAtoms_NoFGE, ChEBI50_GN_WithAtoms_FG_WithAtoms_FGE, ChEBI50_GN_WithAtoms_FG_WithAtoms_NoFGE, + ChEBI50_GNWA_FGWA_WFGE_AsPerNodeType, + ChEBI50_GNWA_FGWA_WFGE_ForAllPropsExceptNodeLevel, + ChEBI50_GNWA_FGWA_WFGE_ForAtomAndFGLevelOnly, + ChEBI50_GNWA_FGWA_WFGE_ForAtomLevelAndGraphNodeOnly, + ChEBI50_GNWA_FGWA_WFGE_ForAtomLevelOnly, + ChEBI50_GNWA_FGWA_WFGE_ForFGLevelAndGraphNodeOnly, + ChEBI50_GNWA_FGWA_WFGE_ForFGLevelOnly, + ChEBI50_GNWA_FGWA_WFGE_ForGraphNodeOnly, + ChEBI50_GNWA_FGWA_WFGE_ForNodeLevelPropOnlyForAllNodes, ChEBI50_NFGE_NGN_GraphProp, ChEBI50_NFGE_WGN_GraphProp, ChEBI50_StaticGNI, @@ -71,4 +80,13 @@ "Tox21_WFGE_WGN_AsPerNodeType", "ToxCast_WFGE_WGN_AsPerNodeType", "PCBA_WFGE_WGN_AsPerNodeType", + "ChEBI50_GNWA_FGWA_WFGE_AsPerNodeType", + "ChEBI50_GNWA_FGWA_WFGE_ForAllPropsExceptNodeLevel", + "ChEBI50_GNWA_FGWA_WFGE_ForAtomAndFGLevelOnly", + "ChEBI50_GNWA_FGWA_WFGE_ForAtomLevelAndGraphNodeOnly", + "ChEBI50_GNWA_FGWA_WFGE_ForAtomLevelOnly", + "ChEBI50_GNWA_FGWA_WFGE_ForFGLevelAndGraphNodeOnly", + "ChEBI50_GNWA_FGWA_WFGE_ForFGLevelOnly", + "ChEBI50_GNWA_FGWA_WFGE_ForGraphNodeOnly", + "ChEBI50_GNWA_FGWA_WFGE_ForNodeLevelPropOnlyForAllNodes", ] diff --git a/chebai_graph/preprocessing/datasets/chebi.py b/chebai_graph/preprocessing/datasets/chebi.py index c4ac4ed..7a68dc6 100644 --- a/chebai_graph/preprocessing/datasets/chebi.py +++ b/chebai_graph/preprocessing/datasets/chebi.py @@ -169,48 +169,94 @@ class ChEBI50_WFGE_WGN_AsPerNodeType(GraphPropAsPerNodeType, ChEBIOver50): READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_GNWA_FGWA_WFGE_AsPerNodeType(GraphPropAsPerNodeType, ChEBIOver50): + READER = GN_WithAtoms_FG_WithAtoms_FGE + + class ChEBI50_WFGE_WGN_ForAtomLevelOnly(GraphPropForAtomLevelOnly, ChEBIOver50): READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_GNWA_FGWA_WFGE_ForAtomLevelOnly(GraphPropForAtomLevelOnly, ChEBIOver50): + READER = GN_WithAtoms_FG_WithAtoms_FGE + + class ChEBI50_WFGE_WGN_ForFGLevelOnly(GraphPropForFGLevelOnly, ChEBIOver50): READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_GNWA_FGWA_WFGE_ForFGLevelOnly(GraphPropForFGLevelOnly, ChEBIOver50): + READER = GN_WithAtoms_FG_WithAtoms_FGE + + class ChEBI50_WFGE_WGN_ForGraphNodeOnly(GraphPropForGraphNodeOnly, ChEBIOver50): READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_GNWA_FGWA_WFGE_ForGraphNodeOnly(GraphPropForGraphNodeOnly, ChEBIOver50): + READER = GN_WithAtoms_FG_WithAtoms_FGE + + class ChEBI50_WFGE_WGN_ForAtomAndFGLevelOnly( GraphPropForAtomAndFGLevelOnly, ChEBIOver50 ): READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_GNWA_FGWA_WFGE_ForAtomAndFGLevelOnly( + GraphPropForAtomAndFGLevelOnly, ChEBIOver50 +): + READER = GN_WithAtoms_FG_WithAtoms_FGE + + class ChEBI50_WFGE_WGN_ForAtomLevelAndGraphNodeOnly( GraphPropForAtomLevelAndGraphNodeOnly, ChEBIOver50 ): READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_GNWA_FGWA_WFGE_ForAtomLevelAndGraphNodeOnly( + GraphPropForAtomLevelAndGraphNodeOnly, ChEBIOver50 +): + READER = GN_WithAtoms_FG_WithAtoms_FGE + + class ChEBI50_WFGE_WGN_ForFGLevelAndGraphNodeOnly( GraphPropForFGLevelAndGraphNodeOnly, ChEBIOver50 ): READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_GNWA_FGWA_WFGE_ForFGLevelAndGraphNodeOnly( + GraphPropForFGLevelAndGraphNodeOnly, ChEBIOver50 +): + READER = GN_WithAtoms_FG_WithAtoms_FGE + + class ChEBI50_WFGE_WGN_ForNodeLevelPropOnlyForAllNodes( GraphPropNodeLevelPropOnlyForAllNodes, ChEBIOver50 ): READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_GNWA_FGWA_WFGE_ForNodeLevelPropOnlyForAllNodes( + GraphPropNodeLevelPropOnlyForAllNodes, ChEBIOver50 +): + READER = GN_WithAtoms_FG_WithAtoms_FGE + + class ChEBI50_WFGE_WGN_ForAllPropsExceptNodeLevel( GraphPropAllPropsExceptNodeLevel, ChEBIOver50 ): READER = AtomFGReader_WithFGEdges_WithGraphNode +class ChEBI50_GNWA_FGWA_WFGE_ForAllPropsExceptNodeLevel( + GraphPropAllPropsExceptNodeLevel, ChEBIOver50 +): + READER = GN_WithAtoms_FG_WithAtoms_FGE + + # ---------- Final Augmentation: Different Thresholds ------------------------------ class ChEBI100_WFGE_WGN_AsPerNodeType(GraphPropAsPerNodeType, ChEBIOver100): READER = AtomFGReader_WithFGEdges_WithGraphNode diff --git a/configs/data/augmented/properties/chebi50_all_props_except_node_lvl.yml b/configs/data/augmented/properties/FGN+E+WGN/chebi50_all_props_except_node_lvl.yml similarity index 100% rename from configs/data/augmented/properties/chebi50_all_props_except_node_lvl.yml rename to configs/data/augmented/properties/FGN+E+WGN/chebi50_all_props_except_node_lvl.yml diff --git a/configs/data/augmented/properties/chebi50_atom_fg_prop_only.yml b/configs/data/augmented/properties/FGN+E+WGN/chebi50_atom_fg_prop_only.yml similarity index 100% rename from configs/data/augmented/properties/chebi50_atom_fg_prop_only.yml rename to configs/data/augmented/properties/FGN+E+WGN/chebi50_atom_fg_prop_only.yml diff --git a/configs/data/augmented/properties/chebi50_atom_graph_node_prop_only.yml b/configs/data/augmented/properties/FGN+E+WGN/chebi50_atom_graph_node_prop_only.yml similarity index 100% rename from configs/data/augmented/properties/chebi50_atom_graph_node_prop_only.yml rename to configs/data/augmented/properties/FGN+E+WGN/chebi50_atom_graph_node_prop_only.yml diff --git a/configs/data/augmented/properties/chebi50_atom_prop_only.yml b/configs/data/augmented/properties/FGN+E+WGN/chebi50_atom_prop_only.yml similarity index 100% rename from configs/data/augmented/properties/chebi50_atom_prop_only.yml rename to configs/data/augmented/properties/FGN+E+WGN/chebi50_atom_prop_only.yml diff --git a/configs/data/augmented/properties/chebi50_fg_graph_node_prop_only.yml b/configs/data/augmented/properties/FGN+E+WGN/chebi50_fg_graph_node_prop_only.yml similarity index 100% rename from configs/data/augmented/properties/chebi50_fg_graph_node_prop_only.yml rename to configs/data/augmented/properties/FGN+E+WGN/chebi50_fg_graph_node_prop_only.yml diff --git a/configs/data/augmented/properties/chebi50_fg_prop_only.yml b/configs/data/augmented/properties/FGN+E+WGN/chebi50_fg_prop_only.yml similarity index 100% rename from configs/data/augmented/properties/chebi50_fg_prop_only.yml rename to configs/data/augmented/properties/FGN+E+WGN/chebi50_fg_prop_only.yml diff --git a/configs/data/augmented/properties/chebi50_graph_node_prop_only.yml b/configs/data/augmented/properties/FGN+E+WGN/chebi50_graph_node_prop_only.yml similarity index 100% rename from configs/data/augmented/properties/chebi50_graph_node_prop_only.yml rename to configs/data/augmented/properties/FGN+E+WGN/chebi50_graph_node_prop_only.yml diff --git a/configs/data/augmented/properties/chebi50_node_level_prop_only.yml b/configs/data/augmented/properties/FGN+E+WGN/chebi50_node_level_prop_only.yml similarity index 100% rename from configs/data/augmented/properties/chebi50_node_level_prop_only.yml rename to configs/data/augmented/properties/FGN+E+WGN/chebi50_node_level_prop_only.yml diff --git a/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_all_props.yml b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_all_props.yml new file mode 100644 index 0000000..3ff3232 --- /dev/null +++ b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_all_props.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_GNWA_FGWA_WFGE_AsPerNodeType +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType diff --git a/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_all_props_except_node_lvl.yml b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_all_props_except_node_lvl.yml new file mode 100644 index 0000000..fd33150 --- /dev/null +++ b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_all_props_except_node_lvl.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_GNWA_FGWA_WFGE_ForAllPropsExceptNodeLevel +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType diff --git a/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_fg_prop_only.yml b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_fg_prop_only.yml new file mode 100644 index 0000000..d9053ae --- /dev/null +++ b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_fg_prop_only.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_GNWA_FGWA_WFGE_ForAtomAndFGLevelOnly +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType diff --git a/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_graph_node_prop_only.yml b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_graph_node_prop_only.yml new file mode 100644 index 0000000..7ab3ecb --- /dev/null +++ b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_graph_node_prop_only.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_GNWA_FGWA_WFGE_ForAtomLevelAndGraphNodeOnly +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType diff --git a/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_prop_only.yml b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_prop_only.yml new file mode 100644 index 0000000..50d18ba --- /dev/null +++ b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_atom_prop_only.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_GNWA_FGWA_WFGE_ForAtomLevelOnly +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType diff --git a/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_fg_graph_node_prop_only.yml b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_fg_graph_node_prop_only.yml new file mode 100644 index 0000000..c56edff --- /dev/null +++ b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_fg_graph_node_prop_only.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_GNWA_FGWA_WFGE_ForFGLevelAndGraphNodeOnly +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType diff --git a/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_fg_prop_only.yml b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_fg_prop_only.yml new file mode 100644 index 0000000..9b42371 --- /dev/null +++ b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_fg_prop_only.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_GNWA_FGWA_WFGE_ForFGLevelOnly +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType diff --git a/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_graph_node_prop_only.yml b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_graph_node_prop_only.yml new file mode 100644 index 0000000..f1921ff --- /dev/null +++ b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_graph_node_prop_only.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_GNWA_FGWA_WFGE_ForGraphNodeOnly +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType diff --git a/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_node_level_prop_only.yml b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_node_level_prop_only.yml new file mode 100644 index 0000000..db61465 --- /dev/null +++ b/configs/data/augmented/properties/gnwa_fgwa_wfge/chebi50_node_level_prop_only.yml @@ -0,0 +1,24 @@ +class_path: chebai_graph.preprocessing.datasets.ChEBI50_GNWA_FGWA_WFGE_ForNodeLevelPropOnlyForAllNodes +init_args: + properties: + # All Node type properties + - chebai_graph.preprocessing.properties.AtomNodeLevel + # Atom Node type properties + - chebai_graph.preprocessing.properties.AugAtomAromaticity + - chebai_graph.preprocessing.properties.AugAtomCharge + - chebai_graph.preprocessing.properties.AugAtomHybridization + - chebai_graph.preprocessing.properties.AugAtomNumHs + - chebai_graph.preprocessing.properties.AugAtomType + - chebai_graph.preprocessing.properties.AugNumAtomBonds + # FG Node type properties + - chebai_graph.preprocessing.properties.AtomFunctionalGroup + - chebai_graph.preprocessing.properties.IsHydrogenBondDonorFG + - chebai_graph.preprocessing.properties.IsHydrogenBondAcceptorFG + - chebai_graph.preprocessing.properties.IsFGAlkyl + # Graph Node type properties + - chebai_graph.preprocessing.properties.AugRDKit2DNormalized + # Bond properties + - chebai_graph.preprocessing.properties.BondLevel + - chebai_graph.preprocessing.properties.AugBondAromaticity + - chebai_graph.preprocessing.properties.AugBondInRing + - chebai_graph.preprocessing.properties.AugBondType From 6edc8b98acd8c05b5197fd81ce9aa0ec65c754f6 Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Thu, 20 Aug 2026 15:31:47 +0200 Subject: [PATCH 17/18] valid mask label for graph collate --- chebai_graph/models/architectures/base.py | 10 ++++- chebai_graph/preprocessing/collate.py | 17 ++++++-- tests/unit/test_collate.py | 48 +++++++++++++++++++++++ 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 tests/unit/test_collate.py diff --git a/chebai_graph/models/architectures/base.py b/chebai_graph/models/architectures/base.py index 514e287..11ac3af 100644 --- a/chebai_graph/models/architectures/base.py +++ b/chebai_graph/models/architectures/base.py @@ -26,7 +26,15 @@ def _get_prediction_and_labels( Returns: tuple[torch.Tensor, torch.Tensor]: Tuple of (predictions, labels). """ - return torch.sigmoid(output), labels.int() + valid_label_mask = data["loss_kwargs"]["valid_label_mask"] + predictions = torch.sigmoid(output) + labels = labels.int() + + if valid_label_mask is not None: + predictions = predictions[valid_label_mask] + labels = labels[valid_label_mask] + + return predictions, labels def _process_labels_in_batch(self, batch: XYData) -> torch.Tensor | None: """ diff --git a/chebai_graph/preprocessing/collate.py b/chebai_graph/preprocessing/collate.py index 53bdde5..b2bc4a0 100644 --- a/chebai_graph/preprocessing/collate.py +++ b/chebai_graph/preprocessing/collate.py @@ -15,11 +15,16 @@ def __call__(self, data): # Unpack labels and optional identifiers y, idents = zip(*((d["labels"], d.get("ident")) for d in data)) - # Replace labels with `y` inside graph features and collect them + valid_label_mask = self._get_valid_label_mask(y) + + # Keep labels in XYGraphData.y instead of graph attributes. Mixed labelled + # and unlabelled batches otherwise make PyG collate a partial `y` key. merged_data = [] for row in data: - row["features"].y = row["labels"] - merged_data.append(row["features"]) + features = row["features"] + if "y" in features: + del features.y + merged_data.append(features) # Add empty edge_attr for graphs with no edges to prevent PyG errors for mdata in merged_data: @@ -31,6 +36,11 @@ def __call__(self, data): for attr in merged_data[0].keys(): for data in merged_data: for store in data.stores: + if attr not in store: + continue + if store[attr] is None: + del store[attr] + continue # Im not sure why the following conversion is needed, but it solves this error: # packages/torch_geometric/data/collate.py", line 177, in _collate # value = torch.cat(values, dim=cat_dim or 0, out=out) @@ -69,6 +79,7 @@ def __call__(self, data): x[0].x = x[0].x.to(dtype=torch.int64) # x is a Tuple[BaseData, Mapping, Mapping] + loss_kwargs["valid_label_mask"] = valid_label_mask return XYGraphData( x, y, diff --git a/tests/unit/test_collate.py b/tests/unit/test_collate.py new file mode 100644 index 0000000..d55ad9a --- /dev/null +++ b/tests/unit/test_collate.py @@ -0,0 +1,48 @@ +import unittest + +import torch +from torch_geometric.data import Data as GeomData + +from chebai_graph.preprocessing.collate import GraphCollator + + +class TestGraphCollator(unittest.TestCase): + @staticmethod + def _graph(): + return GeomData( + x=torch.tensor([[6]]), + edge_index=torch.empty((2, 0), dtype=torch.long), + ) + + def test_mixed_missing_labels_do_not_enter_graph_collate(self): + batch = GraphCollator()( + [ + { + "features": self._graph(), + "labels": [1, None, 0, 0, 1], + "ident": "a", + }, + {"features": self._graph(), "labels": None, "ident": "b"}, + { + "features": self._graph(), + "labels": [0, 1, None, 0, 1], + "ident": "c", + }, + ] + ) + + expected_labels = torch.tensor( + [ + [True, False, False, False, True], + [False, True, False, False, True], + ] + ) + self.assertTrue(torch.equal(batch.y, expected_labels)) + self.assertEqual( + batch.additional_fields["loss_kwargs"]["non_null_labels"], [0, 2] + ) + self.assertNotIn("y", batch.x[0]) + + +if __name__ == "__main__": + unittest.main() From 905ed524ae187ffe0df46b398b53631a65f95acc Mon Sep 17 00:00:00 2001 From: aditya0b0 Date: Fri, 21 Aug 2026 00:11:02 +0200 Subject: [PATCH 18/18] set invalid label to -1 to so that ignore_index=-1 works --- chebai_graph/models/architectures/base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chebai_graph/models/architectures/base.py b/chebai_graph/models/architectures/base.py index 11ac3af..c86baa8 100644 --- a/chebai_graph/models/architectures/base.py +++ b/chebai_graph/models/architectures/base.py @@ -31,8 +31,13 @@ def _get_prediction_and_labels( labels = labels.int() if valid_label_mask is not None: - predictions = predictions[valid_label_mask] - labels = labels[valid_label_mask] + labels[~valid_label_mask] = -1 # Mark invalid labels as -1 + # https://lightning.ai/docs/torchmetrics/stable/classification/auroc#multilabelauroc + # -1 as we torchmetrics ignores -1 labels in multilabel metrics + # metric = MultilabelAUROC( + # num_labels=labels.shape[1], + # ignore_index=-1, + # ) return predictions, labels