---
title: "Graph Sampling-based Meta-Learning for Molecular Property Prediction"
authors:
  - "Xiang Zhuang"
  - "Qiang Zhang"
  - "Bin Wu"
  - "Keyan Ding"
  - "Yin Fang"
  - "Huajun Chen"
doi: "10.24963/ijcai.2023/526"
url: "https://ijcai.org/proceedings/2023/526"
pdf: "https://ijcai.org/proceedings/2023/0526.pdf"
venue: "Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence"
year: 2023
pages: "4729-4737"
track: "Main Track"
keywords:
  - "Multidisciplinary Topics and Applications: MDA: Bioinformatics"
  - "Machine Learning: ML: Meta-learning"
  - "Machine Learning: ML: Few-shot learning"
---

# Graph Sampling-based Meta-Learning for Molecular Property Prediction

Xiang Zhuang, Qiang Zhang, Bin Wu, Keyan Ding, Yin Fang, Huajun Chen

*Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence*, pages 4729-4737. DOI: [10.24963/ijcai.2023/526](https://doi.org/10.24963/ijcai.2023/526)

## Abstract

Molecular property is usually observed with a limited number of samples, and researchers have considered property prediction as a few-shot problem. One important fact that has been ignored by prior works is that each molecule can be recorded with several different properties simultaneously. To effectively utilize many-to-many correlations of molecules and properties, we propose a Graph Sampling-based Meta-learning (GS-Meta) framework for few-shot molecular property prediction. First, we construct a Molecule-Property relation Graph (MPG): molecule and properties are nodes, while property labels decide edges. Then, to utilize the topological information of MPG,  we reformulate an episode in meta-learning as a subgraph of the MPG, containing a target property node, molecule nodes, and auxiliary property nodes. Third, as episodes in the form of subgraphs are no longer independent of each other, we propose to schedule the subgraph sampling process with a contrastive loss function, which considers the consistency and discrimination of subgraphs. Extensive experiments on 5 commonly-used benchmarks show GS-Meta consistently outperforms state-of-the-art methods by  5.71%-6.93% in ROC-AUC and verify the effectiveness of each proposed module. Our code is available at https://github.com/HICAI-ZJU/GS-Meta.

## Full text

## 1 Introduction

Drug discovery is of great significance to public health and the development of new drugs is a long and costly process. In the early lead optimization phase, researchers need to select a large number of molecules as candidates and conduct virtual screening to avoid wasting resources on molecules that are unlikely to possess the desired properties [Riniker and Landrum, 2013; Sliwoski et al., 2014]. Recently, deep learning plays an important role in this process, and several deep models have been investigated to predict molecular property [Song et al., 2020; Fang et al., 2022; Fang et al., 2023].

∗Corresponding author.

Figure 1: (a) An example of the Molecule-Property relation Graph (MPG) built based on the Tox21 dataset [Wu et al., 2018]. To predict the SR-ATAD5 property of the TOX4931 molecule, we can utilize some auxiliary properties to form an MPG where molecules and properties are nodes and edges represent property labels (0 or 1). (b) An example of subgraph sampling. Given the MPG, we can sample a pair of subgraphs with the same target property (e.g., (i) and (ii)) as positive samples and another pair with different target properties (e.g., (ii) and (iii)) as negative samples.

![Image](https://ijcai.org/proceedings/2023/fulltext/526/image_000000_b193cd7daed0839f6cde0f0afe77a9ed9f88fc75509fc49125868a2c3d04a62a.png)

In the practical settings, only a few molecules can be made and tested in the wet-lab experiments [Altae-Tran et al., 2017; Guo et al., 2021]. The limited amount of annotated data often hinders the generalization ability of deep learning models in practical applications [Bertinetto et al., 2016].

Deficient annotated data is often termed a few-shot learning (FSL) problem [Wang et al., 2020]. Typically, metalearning [Hospedales et al., 2021], which aims to learn how to learn, is used to solve the few-shot problem and several prior works have incorporated meta-learning into molecular property prediction. For example, Meta-GNN [Guo et al., 2021] employed a classic meta-learning method, MAML [Finn et al., 2017], with self-supervised tasks including bond reconstruction and atom type prediction. Wang et al. constructed a relation graph of molecules and designed a meta-learning strategy to selectively update model parameters.

However, these works have neglected an important fact that, unlike common FSL settings including image classification, a molecule can be observed with multiple properties simultaneously, such as a number of possible side effects. There is also a correlation between different properties, for example, endocrine disorders and cardiac diseases caused by drug side effects may occur together because they share disease pathway [Fuchs and Whelton, 2020]. In predicting the property of a molecule, we can leverage other available labeled properties of the same molecule. When we know some properties of one molecule and are faced with new properties that have fewer labels, we postulate that utilizing these known property labels can alleviate the label insufficiency problem.

To effectively utilize such correlations, we propose a Graph Sampling-based Meta-learning framework, GS-Meta. First, to accurately describe the many-to-many relations among molecules and properties, we build a Molecule-Property relation Graph (MPG), where nodes are molecules and properties, and edges between molecules and properties indicate the label of the molecules in the properties (Figure 1(a)). Second, to employ the inherent graph topology of MPG, we propose to reformulate an episode as a subgraph of MPG, which is composed of a target property node, molecule nodes as well as auxiliary property nodes (Figure 1(b)). Third, in conventional meta-learning [Vinyals et al., 2016], episodes are considered to be independently distributed and sampled from a uniform distribution. However, subgraphs are connected in our MPG due to intersecting molecules and edges, they are no longer independent of each other. We propose a learnable sampling scheduler and specify the subgraph dependency in two aspects: (1) subgraphs centered on the same target property node can be seen as different views describing the same task and thus they should be consistent with each other; and (2) subgraphs centered on different target property nodes are episodes of different tasks, and their semantic discrepancy should be enlarged. Hence, we solve this dependency via a contrastive loss function. In short, our contributions are summarized as follows:

- We propose to use auxiliary properties when facing new target property in the few-shot regime and construct a Molecule-Property relation Graph to model the relations among molecules and properties so that the information of the relevant properties can be used through the topology of the constructed graph.
- We propose a Graph Sampling-based Meta-learning framework, which reformulates episodes in metalearning as sampled subgraphs from the constructed MPG, and schedules the subgraph sampling process with a contrastive loss function.
- Experiments on five benchmarks show that our method consistently outperforms state-of-the-art FSL molecular property prediction methods by 5.71%-6.93% in terms of ROC-AUC.

## 2 RelatedWork

Few-shot Learning for Molecules The few-shot learning (FSL) problem [Vinyals et al., 2016; Chen et al., 2019] occurs when there are limited labeled training data per object of interest. Often, meta-learning is used to solve the few-shot learning problem. For example, MAML [Finn et al., 2017] learns a good parameter initialization and updates through gradient descents. However, the existing methods are usually investigated for image classification but not tailored to the different settings of molecular property prediction [Wang et al., 2021]. Recent efforts have been paid to fill this gap. Guo et al. propose to use molecule-specific tasks including masked atoms and bonds prediction to guide the model focus on the intrinsic characteristics of molecules. Wang et al. connect molecules in a homogeneous graph to propagate limited information between similar instances. However, all the prior works have ignored the relationships between molecular properties, i.e., some auxiliary available properties can be used in predicting new molecular properties, and they fail to investigate the relationship.

Episode Scheduler in Meta-learning Most meta-learning approaches leverage a uniform episode sampling strategy in the training process. To exploit relations between episodes, prior methods have investigated how to schedule episodes to enhance the generalization of meta-knowledge. Liu et al. design a greedy class-pair based strategy rather than uniform sampling. Fei et al. consider the relationship of episodes to overcome the poor sampling problem. Yao et al. propose a neural scheduler to decide which tasks to select from a candidate set. In this work, we schedule episodes with the lens of subgraph sampling and encourage the consistency between subgraphs of the same target property and discrimination between different target properties via a contrastive loss function.

## 3 Graph Sampling-basedMeta-Learning

This section presents the proposed Graph Sampling-based Meta-learning framework, as shown in Figure 2. We first define the few-shot molecular property prediction problem (Section 3.1). To establish and exploit the many-to-many relation between molecules and properties, we construct a Molecule-Property relation Graph (MPG) and then reformulate an episode in meta-learning as a subgraph from the MPG (Section 3.2). With this reformulation, we investigate to consider consistency and discrimination between subgraphs and schedule the subgraph sampling to facilitate meta-learning (Section 3.3). Finally, the training and testing strategies are described (Section 3.4).

## 3.1 ProblemDefinition

Following [Altae-Tran et al., 2017; Guo et al., 2021], the fewshot molecular property prediction is conducted on a set of tasks {T }, where each task T is to predict a property p of molecules. The training set Dtrain consists of several tasks {Ttrain}, denoted as Dtrain = {(xi, yi,t)|t ∈ Ttrain}, where xi is a molecule and yi,t is the label of xi on the t-th task. And the testing set Dtest = {(xj, yj,t)|t ∈ Ttest} is composed of a set of tasks {Ttest}. {ptrain} and {ptest} are denoted as properties corresponding to tasks {Ttrain} and {Ttest}, and training properties and testing properties are disjoint, i.e., {ptrain} ∩ {ptest} = ∅. The objective is to learn a predictor on Dtrain and to predict novel properties with a few labeled molecules in Dtest.

To deal with the few-shot problem, the episodic training paradigm has shown great promise in meta-learning [Finn et al., 2017]. Without loading all training tasks {Ttrain} into memory, batches of episodes {Et}Bt=1 are sampled iteratively in practical training process. To construct an episode Et, a target task Tt is firstly sampled from {Ttrain}, then a labeled support set St and a query set Qt are sampled. Usually, there are two classes (i.e., active (y=1) or inactive (y=0)) in each molecular property prediction task, and a 2-way K-shot episode means that the support set St consists of 2 classes with K molecules per class, i.e., St = {(xsi , ys i,t )}2K i=1 , and query set Qt = {(xqi , yq i,t )}Mi=1 contains M molecules. In this case, we can define the episode as Et = (St, Qt).

Figure 2: A 2-way 1-shot overview of GS-Meta. Firstly a Molecule-Property relation Graph (MPG) is constructed. Then, an episode candidate pool is randomly sampled, and the subgraph sampling scheduler z(ϕ) is used to compute the selection probability η and select a mini-batch containing B episode pairs from the candidate pool. Finally, the relation learning module f(θ) encodes each subgraph and outputs a classification loss Lcls within an episode and a contrastive loss Lctr across episodes.

![Image](https://ijcai.org/proceedings/2023/fulltext/526/image_000001_a3de340bbceba2d24270cf26b16e3cb433641ce2bcbf5e59f9eaef76c930ff71.png)

## 3.2 Molecule-Property Relation Graph

Graph Construction and Initialization To leverage the rich information behind the relations among properties and molecules, we construct a Molecule-Property relation Graph (MPG) that explicitly describes such relations. The graph is denoted as G = (V, E), where V denotes the node set and E denotes the set of edges e ∈ E. And there are two types of nodes in the graph, i.e., V = VM ∪VT , where VM = {xm} is the molecule node set and VT = {pt} is the property node set. Edges E ⊆ VM × VT are connected between these two types of nodes and the edge type of ei,j is initialized according to the label yi,j, i.e., active (for y=1) or inactive (for y=0).

For a molecule xi, a graph-based encoder [Xu et al., 2019] is used following [Guo et al., 2021] to obtain its embedding:

<!-- formula-not-decoded -->

where xi ∈ Rd . For a property node pt, its embedding is randomly initialized for simplicity with the same length as molecules, i.e., pt ∈ Rd . Hence the node features h0i are initialized with molecule and property embeddings respectively:

<!-- formula-not-decoded -->

Moreover, due to the deficiency of data, some molecules may not have labels on some auxiliary properties, leading to a missing edge connection between these molecules and properties. To make the graph topology compact, a special edge type unk is used to complement the missing label.

Reformulating Episode as Subgraph The constructed MPG can be very large, e.g. in the PCBA dataset [Wang et al., 2012], there are more than 430,000 molecules and 128 properties, and the corresponding MPG can contain more than 10 million edges. It is therefore computationally infeasible to directly work on the whole graph to predict molecular properties. Instead, we resort to subgraphs sampled from the MPG and connect them to episodes in meta-learning.

The episodic meta-learning, which is trained iteratively by sampling batches of episodes, has proven to be an effective training strategy [Finn et al., 2017]. Therefore, to adopt episodic meta-learning on MPG, we propose to reformulate the episode as a subgraph. Specifically, an episode of task Tt is equivalent to a subgraph containing a property node pt in VT , and molecules connected to pt. Hence, the support set St can be reformulated as a subgraph of MPG:

<!-- formula-not-decoded -->

where pt is a property node, and N(pt) is the neighbors of pt. A query molecule is sampled as the query set, denoted as:

<!-- formula-not-decoded -->

By merging two subgraphs, the episode Et is reformulated as:

<!-- formula-not-decoded -->

The node and edge set of Gt are denoted as V t and E t respectively.

Since molecules have multiple properties, other available properties can be used when predicting a novel property of the same molecule. To leverage these auxiliary properties, we add some other property nodes connected to molecule nodes into the subgraph:

<!-- formula-not-decoded -->

where Na is the number of auxiliary property, pa is the auxiliary property node, xi ∈ V tM is a molecule node in Gt, and GA t is an auxiliary subgraph. With GA t , we extend Gt as:

<!-- formula-not-decoded -->

and there are totally 2K + Na + 2 nodes, 2K support molecules, one query molecule, one target property, and Na auxiliary properties. From here on out, an episode of metalearning and a subgraph of the MPG are semantically equivalent in this paper.

Subgraph Encoding and Prediction We adopt a massage passing schema [Hamilton et al., 2017] to iteratively update each sampled subgraph Gt. In contrast to the previous work which only takes labels as edges [Cao et al., 2021], we also consider relations between molecules, and design an edge predictor to estimate connections between molecules at each

<!-- formula-not-decoded -->

where σ is Sigmoid function, hl-1 i and hl-1 j are embeddings of molecules xi and xj at (l-1)-th iteration respectively, and αli,j is the estimated connection weight between xi and xj . To avoid connecting dissimilar molecules, only top-k (k is hyperparameter) edges with the largest estimated weights are kept and the edge type is mol2mol. Overall, there are four types of edges in Gt, which are active, inactive and unk between a molecule and a property, and mol2mol between molecules.

After constructing the complete subgraph, node embeddings are updated as follows:

<!-- formula-not-decoded -->

where hli is the embedding of node i at the l-th iteration, hli,j is edge embedding initialized according to edge type, N(i) is neighbors of node i, and wli,j is the edge weight defined as:

<!-- formula-not-decoded -->

where EM,M is the set of edges between molecules. After L iterations, the final embedding of molecule hLi and the property hLt are we concatenated to predict the label:

<!-- formula-not-decoded -->

where ˆ yi,t ∈ R1 is the prediction, and ⊕ is a concatenation operation. For simplicity, we denote f(θ) as the relation learning module with parameter θ, which includes molecular encoder fmol, property initial embeddings, GNN layers, edge predictors, and classifier fcls. More details are illustrated in Appendix A.3.

In each subgraph Gt, the task classification loss on the support set St is calculated:

<!-- formula-not-decoded -->

where y and ˆ y are short for yi,t and ˆ yi,t for clarity. Similarly, we can calculate the classification loss on the query set Lcls t,Q.

## 3.3 Subgraph Sampling Scheduler

Previous few-shot molecular property prediction methods [Guo et al., 2021; Wang et al., 2021] randomly sample episodes with a uniform probability, under the assumption that they are independent and of equal importance. However, subgraphs centered on different target properties are potentially connected to each other in the built MPG, due to the existence of intersecting nodes or edges. Hence, considering the subgraph dependency, we are motivated to develop a subgraph sampling scheduler that determines which episodes to use in the current batch during meta-training.

Consistency andDiscrimination between Subgraphs We specify the subgraph dependency in two aspects. (1) Each subgraph only has a small number of molecules (K per class), and cannot contain all the information about the target property. For the same target property, subgraphs with different molecules (subgraph (i) and (ii) in Figure 1(b)) can be seen as different views describing the same task and they should be consistent with each other. (2) Meanwhile, subgraphs centered on different target property nodes (subgraph (ii) and (iii) in Figure 1(b)) are episodes of different tasks, and their semantic discrepancy should be enlarged.

Towards this end, the subgraph sampling scheduler, denoted as z(ϕ) with parameters ϕ, adopts a pairwise sampling strategy. That is, two subgraphs G (1) t and G (2) t of the same target property pt are sampled simultaneously. Specifically, at the beginning of each mini-batch, we randomly sample a pool of subgraph candidates, P = {(G (1) t , G (2) t )}Npool t=1 , which are pairs of subgraphs for the same target property. For a subgraph Gt, the scheduler z(ϕ) outputs its selection probability ηt via two steps. The first step calculates the subgraph embedding gt:

<!-- formula-not-decoded -->

which is the pooling of the final embedding of each node, and hLt is final embedding of target property pt. Then, we take gt as input to the scheduler z(ϕ) to get the selection probability ηt:

<!-- formula-not-decoded -->

where z1 and z2 are MLP and together constitute z(ϕ). Then, ηt is normalized by softmax to get a reasonable probability value. Thus, for each episode pair (G (1) t , G (2) t ) in the candidate pool, the selection probability can be computed as (η(1) t +η(2) t )/2, andwe sampleB fromNpool in the candidate pool to form a mini-batch according to selection probability.

To encourage consistency between subgraphs of the same target property and discrimination between different target properties, we adopt the NT-Xent loss [Hjelm et al., 2019] which is widely used in contrastive learning. Subgraphs of the same target property are positive pairs and those of different target properties are negatives, and the contrastive loss in a mini-batch is as follows:

<!-- formula-not-decoded -->

where B is mini-batch size, sim(·, ·) is cosine similarity and τ is the temperature parameter.

Algorithm 1 Training and optimization algorithm.

Input: Molecule-Property relation Graph (MPG) Output: Relation learning module f(θ), subgraph sampling scheduler z(ϕ).

- 1: while not done do
- 2: Sample Npool episode pairs {(G (1) t , G (2) t )}Npool t=1 as candidates
- 3: Calculate selection probability ηt by Eqn. (14) for each candidate episode
- 4: Select B episode pairs {(G (1) t , G (2) t )}Bt=1 from candidates according to ηt to form a mini-batch
- 5: for t = 1, . . . , B do
- 6: Calculate classification loss on support set Lcls t,S by Eqn. (12) on both G (1) t and G (2) t
- 7: Do inner-loop update θ′ ← θ-βinner∇θLcls t,S (f(θ) ) on both G (1) t and G (2) t
- 8: Calculate classification loss on query set Lcls t,Q by Eqn. (12) on both G (1) t and G (2) t
- 9: end for
- 10: Calculate contrastive loss Lctr by Eqn. (15)
- 11: Do outer-loop optimization by Eqn. (17)
- 12: Update scheduler z by Eqn. (19)
- 13: end while

## 3.4 Training and Testing

In this subsection, we introduce the optimization strategy of relation learning module f(θ) and subgraph sampling scheduler z(ϕ) in training and testing.

Optimization of Relation Learning Module Following [Finn et al., 2017], a gradient descent strategy is adopted to obtain a good initialization. Firstly, at the beginning of a mini-batch, subgraph sampling scheduler z is used to sample B episode pairs {(G (1) t , G (2) t )}Bt=1 from candidates.

For each episode, in the inner-loop optimization, the loss on the support set defined in Eqn.(12) is computed to update the parameters θ by gradient descent:

<!-- formula-not-decoded -->

where βinner is the learning rate. After updating the parameter, the loss of query set is computed, denoted as Lcls t,Q. Finally, we do an outer loop to optimize both the classification and contrastive loss with learning rate βouter across the minibatch:

<!-- formula-not-decoded -->

where the meta-training loss L (f(θ′ ) ) is computed across the mini-batch:

<!-- formula-not-decoded -->

where λ is hyperparameter and Lctr is defined by Eqn.(15), and Lcls t,Q(1) , Lcls t,Q(2) are query loss of G (1) t and G (2) t respectively. The complete procedure is described in Algorithm 1.

In testing, for a new property pt in {ptest}, auxiliary properties are selected from {ptrain} and f(θ) is finetuned by Eqn.(16).

Optimization of Subgraph Sampling Scheduler Since sampling cannot be directly differentiated, similar to [Yao et al., 2021], we use policy gradient [Williams, 1992] to optimize the scheduler z(ϕ). To encourage mining negative samples that are indistinguishable from positives, it is intuitive to take the value of contrastive loss Lctr as reward R:

<!-- formula-not-decoded -->

where η = {ηt}Bt=1 is selection probability of sampled episode in a mini-batch, γ is learning rate and b is moving average of reward.

## 4 Experiments

The following research questions guide the remainder of the paper. (RQ1) Can our proposed GS-Meta outperform SOTA baselines? (RQ2) How do auxiliary properties affect the performance? (RQ3) Can the episode reformulation and sampling scheduler improve performance? (RQ4) How to interpret the scheduler that models the episode relationship?

## 4.1 Experimental Setup

We use five common few-shot molecular property prediction datasets from the MoleculeNet [Wu et al., 2018]. Details are in Appendix B.

For a comprehensive comparison, we adopt two types of baselines: (1) methods with molecular encoder learned from scratch, including Siamese [Koch et al., 2015], ProtoNet [Snell et al., 2017], MAML [Finn et al., 2017], TPN [Liu et al., 2019], EGNN [Kim et al., 2019], IterRefLSTM [Altae-Tran et al., 2017], and PAR [Wang et al., 2021]; and (2) methods which leverage pre-trained molecular encoder, including Pre-GNN [Hu et al., 2020], MetaMGNN [Guo et al., 2021], Pre-PAR [Wang et al., 2021] and we denote Pre-GS-Meta as our method equipped with Pre-GNN. More details about these baselines are in Appendix C.1. We run experiments 10 times with different random seeds and report the mean and standard deviations.

## 4.2 Main Results (RQ1)

The overall performance is shown in Table 1. The experimental results show that our GS-Meta and Pre-GS-Meta outperform all baselines consistently with 6.93% and 5.71% average relative improvement respectively. Moreover, those relationgraph-based methods (i.e., TPN, EGNN, PAR and GS-Meta) mostly perform better than traditional methods. This indicates that it is effective to exploit relations between molecules in a graph and it is more effective to exploit both molecules and properties together as our method performs best. Further, the improvement varies across different datasets. For example, GS-Meta gains 13.68% improvement on SIDER but 0.93% improvement on MUV. We argue this is due to the fact that there are more auxiliary properties available on SIDER, and also that there are no missing labels in SIDER compared to 84.2% missing labels on MUV. Fewer auxiliary properties and the presence of missing labels prevent utilizing information from auxiliary properties. This phenomenon is further investigated in Section 4.3.

Table 1: ROC-AUC scores on benchmark datasets, compared with methods learned from scratch (first group) and methods that leverage pre-trained molecular encoder (second group). The best is marked with boldface and the second best is with underline.

| Method                                                                                       | Tox21 - 10-shot                                                                                                                                 | Tox21 - 1-shot                                                                                                                                  | SIDER - 10-shot                                                                                                                                 | SIDER - 1-shot                                                                                                                                  | MUV - 10-shot                                                                                                                                   | ToxCast - 1-shot 10-shot                                                                                                                                                                                                                      | ToxCast - 1-shot                                                                              | PCBA - 10-shot                                                                                | PCBA - 1-shot                                                                                 |
|----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| Siamese ProtoNet MAML TPN EGNN IterRefLSTM PAR GS-Meta Pre-GNN Meta-MGNN Pre-PAR Pre-GS-Meta | 80.40(0.35) 74.98(0.32) 80.21(0.24) 76.05(0.24) 81.21(0.16) 81.10(0.17) 82.06(0.12) 85.85(0.26) 82.14(0.08) 82.97(0.10) 84.93(0.11) 86.91(0.41) | 65.00(1.58) 65.58(1.72) 75.74(0.48) 60.16(1.18) 79.44(0.22) 80.97(0.10) 80.46(0.13) 84.32(0.89) 81.68(0.09) 82.13(0.13) 83.01(0.09) 86.46(0.55) | 71.10(4.32) 64.54(0.89) 70.43(0.76) 67.84(0.95) 72.87(0.73) 69.63(0.31) 74.68(0.31) 83.72(0.54) 73.96(0.08) 75.43(0.21) 78.08(0.16) 85.08(0.54) | 51.43(3.31) 57.50(2.34) 67.81(1.12) 62.90(1.38) 70.79(0.95) 71.73(0.14) 71.87(0.48) 82.84(0.67) 73.24(0.12) 73.36(0.32) 74.46(0.29) 84.45(0.26) | 59.96(5.13) 65.88(4.11) 63.90(2.28) 65.22(5.82) 65.20(2.08) 49.56(5.12) 66.48(2.12) 67.11(1.95) 67.14(1.58) 68.99(1.84) 69.96(1.37) 70.18(1.25) | 50.00(0.17) - 58.31(3.18) 68.87(0.43) 60.51(3.12) 68.30(0.59) 50.00(0.51) - 62.18(1.76) 74.02(1.11) 48.54(3.12) - 64.12(1.18) 74.78(1.53) 64.70(2.88) 81.55(0.19) 64.51(1.45) - 65.54(2.13) - 66.94(1.12) 79.41(0.08) 67.15(2.04) 83.81(0.16) | - 58.55(0.52) 61.12(0.94) - 64.17(0.89) - 69.45(1.24) 80.03(0.26) - - 76.58(0.15) 81.57(0.18) | - 64.93(1.94) 66.22(1.31) - 69.92(1.85) - 70.05(0.94) 72.16(0.71) - - 73.71(0.61) 79.40(0.43) | - 55.79(1.45) 62.04(1.73) - 62.14(1.58) - 67.77(1.04) 70.03(1.56) - - 72.49(0.61) 78.16(0.47) |

Figure 3: Performance of different numbers of selected auxiliary properties in training (top) and testing (bottom).

![Image](https://ijcai.org/proceedings/2023/fulltext/526/image_000002_63e5768e113398232642148842b760aa735b736f6cb6cca09141757ce456d221.png)

## 4.3 Analysis of Auxiliary Property (RQ2)

Effect of the Number of Auxiliary Properties We explore the effect of auxiliary properties by varying the number of sampled auxiliary properties. Since auxiliary property sampling occurs during both training and testing, here we consider two scenarios: 1) effect of the number of sampled auxiliary properties during training: keep the number of sampled auxiliary properties during testing constant and change the number during training; 2) effect of the number of sampled auxiliary properties during testing: keep the number of sampled auxiliary properties during training constant and change the number during testing.

As shown in Figure 3, the performance improves as the number of auxiliary properties increases in both training and testing, confirming our motivation that known properties of molecules help predict new properties. This is because more auxiliary properties contain more information at each training and inference step. In addition, reducing the number of auxiliary properties in training has less impact on performance than in testing, which suggests that when faced with a large number of auxiliary properties, sampling some of them during training can be an effective way to train the model and does not lead to significant performance degradation.

Figure 4: Performance with different missing label ratios in SIDER, Tox21 and ToxCast-CEETOX under the 10-shot scenario.

![Image](https://ijcai.org/proceedings/2023/fulltext/526/image_000003_10c9d76674487469db1af0100f130065497c790834826289f618f39c7cadd182.png)

Effect of the Ratio of Missing Labels We further investigate the effect of missing labels on auxiliary properties by randomly masking labels in the training set, which means the model has less training data and fewer auxiliary properties possible for testing. Two different approaches are compared: 1) w/ unk: completing missing label with a special edge unk; 2) w/o unk: no process of the missing label.

Figure 4 shows the results under the 10-shot scenario. Since the proportion of missing labels in the training set on Tox21 itself is higher than 10%, we start masking from 20%. The performance gradually decreases as the percentage of missing labels increases. In addition, unk edges have no noticeable effect on SIDER, but improve performance on Tox21 and ToxCast-CEETOX by 0.81% and 0.96% respectively. This can be due to imbalanced labeling: SIDER is more balanced than Tox21 and ToxCast-CEETOX. Moreover, the results show that when masking 70%, 40% and 40% training labels on SIDER, Tox21 and ToxCast-CEETOX respectively, our method still achieves a comparable performance against SOTA. It proves that our method has robust and promising performance despite the missing training data. Results under the 1-shot scenario is in Figure 6 in Appendix.

## 4.4 Analysis of Episode Reformulation and Sampling Scheduler (RQ3)

Ablation Study We conduct ablations to study the effectiveness of episode reformulation and sampling scheduler. For episode reformulation, the following variants are analyzed: 1)w/om2m: removemol2mol edges inMPG; 2)w/oE:

Table 2: Ablation study on Tox21

| Method        | 1-shot        | 10-shot      |
|---------------|---------------|--------------|
| GS-Meta       | 84.32         | 85.85        |
| w/o m2m       | 83.91(↓0.41)  | 84.80(↓1.05) |
| w/o E         | 72.54(↓11.78) | 75.93(↓9.92) |
| w/o S         | 83.14(↓1.18)  | 84.51(↓1.34) |
| w/o CL        | 83.30(↓1.02)  | 84.66(↓1.19) |
| w/o S, w/o CL | 82.64(↓1.68)  | 84.32(↓1.53) |

Table 3: Performance and time cost on ToxCast-BSK

| Method           | 1-shot       | 10-shot      |
|------------------|--------------|--------------|
| PAR              | 70.41(0.83s) | 74.65(1.13s) |
| PAR (w/ ATS)     | 69.94(2.42s) | 75.10(2.90s) |
| GS-Meta          | 85.94(3.11s) | 87.67(3.59s) |
| GS-Meta (w/ ATS) | 84.73(6.80s) | 86.88(7.11s) |
| GS-Meta (w/o S)  | 84.72(2.20s) | 86.81(2.60s) |

remove edge type in MPG, i.e., do message passing in Eqn.(9) without hi,j. For the sampling scheduler, the following variants are analyzed: 1)w/o S: randomly select episode without a sampling scheduler; 2)w/o CL: optimize model parameters in Eqn. (17) without contrastive loss Lctr ; 3)w/o S, w/o CL: do not use scheduler and contrastive loss.

As in Table 2, GS-Meta outperforms all the variants, indicating that our proposed subgraph reformulation and scheduling strategy are effective. Results on SIDER are in Table 10 in Appendix. Removing the type of edges causes a significant performance drop, which validates that the information of labels can be fused into the graph by using them as edge types. And removing both contrastive loss and the scheduler degrades the model performance, indicating that our design of contrastive loss and the scheduler is reasonably effective.

Comparing with Other Scheduler To further explore the effects of the designed sampling scheduler, we compare PAR and our GS-Meta with other scheduler. Here we adopt ATS [Yao et al., 2021], which is a SOTA task scheduler for meta-learning proposed recently. ATS takes gradient and loss as input to characterize the difficulty of candidate tasks. For a comprehensive evaluation, we compare both the performance and time cost of a mini-batch during training.

The results on ToxCast-BSK are in Table 3, where (w/ ATS) indicates using ATS as the sampling scheduler and (w/o S) indicates randomly selecting without the scheduler. Note that the original PAR itself does not have a scheduler. We reach two conclusions. First, ATS does not improve performance significantly (PAR(w/ ATS) vs PAR, GS-Meta(w/ ATS) vs GS-Meta(w/o S)). This suggests that ATS is not applicable in our scenario of few-shot molecular property prediction and the SOTA methods. And our scheduler is able to improve the model performance (GS-Meta vs GS-Meta(w/o S)). Secondly, ATS is more time-consuming. ATS is around three times slower compared with random sampling (PAR(w/ ATS) vs PAR, GS-Meta(w/ ATS) vs GS-Meta(w/o S)), but our scheduler is faster (GS-Meta vs GS-Meta(w/o S)). This is because ATS needs to compute the loss and gradient backpropagation for each candidate and sample a validation set to get the reward for optimization. While our approach is to reformulate an episode as a subgraph and get the representation of episode by directly encoding it. And we use a contrastive loss to uniformly model the relationship between episodes and as an optimization reward for the scheduler. Results on ToxCast-APR are in Table 11 in Appendix.

Figure 5: Heatmap of property similarity and statistics of target property sampling times on Tox21.

![Image](https://ijcai.org/proceedings/2023/fulltext/526/image_000004_9d4c6cb677a2025e656b6bca1e39428c0dbe75ccb5aa70cd44910ea3d74052e5.png)

## 4.5 Interpretation of the Scheduler (RQ4)

To understand the sampling scheduler, we visualize the sampling result of 9 properties in the training set on Tox21 in Figure 5. The cosine similarity of property embeddings on Tox21 is also visualized. In the sampling result heatmap, the value in row i column j indicates the number of times that property i and property j are sampled in the same mini-batch at the same time. And we run the scheduler 200 times to statistically count the results.

We observe that more similar properties are sampled into the same mini-batch more frequently, e.g., property SRATAD5 with property NR-AR and property NR-ER with property NR-PPAR-gamma. And dissimilar properties are sampled less frequently in one mini-batch, e.g., property NR-ER-LBD with property NR-AR-LBD and property SRATAD5 with property NR-ER-LBD. This indicates that our scheduler prefers to put similar properties in one mini-batch, analogous to mining hard negative samples. Nevertheless, the sampling result is not exactly consistent with the property embedding similarity, because the scheduler's input is the final pooled embedding of the subgraph, not only the embedding of the target property.

## 5 Conclusion

We propose a Graph Sampling-based Meta-learning framework to effectively leverage other available properties to predict new properties with a few labeled samples in molecular property prediction. Specifically, we construct a MoleculeProperty relation Graph and reformulate an episode in metalearning as a subgraph of MPG. Further, we consider subgraph consistency and discrimination and schedule the subgraph sampling via a contrastive loss. Empirical results show GS-Meta outperforms previous methods consistently.

This work only considers 2-way classification tasks and does not involve regression tasks. This is because the commonly-used benchmarks for few-shot molecular property prediction are 2-way tasks and few are eligible regression datasets. Our method can generalize to multi-class and regression cases, by assigning different edge attribute values. We put this in future works.

## Acknowledgments

This work was supported by the National Natural Science Foundation of China (NSFCU19B2027, NSFC91846204), joint project DH-2022ZY0012 from Donghai Lab, and CAAI-Huawei MindSpore Open Fund (CAAIXSJLJJ-2022052A). We want to express gratitude to the anonymous reviewers for their hard work and kind comments and Hangzhou AI Computing Center for their technical support.

## Contribution Statement

The first two authors X.Z. and Q.Z. contributed equally and shared co-first authorship.

## References

1. [Altae-Tran et al., 2017] Han Altae-Tran, Bharath Ramsun- dar, Aneesh S Pappu, and Vijay Pande. Low data drug dis- covery with one-shot learning. ACS central science, pages 283-293, 2017.
2. [Bertinetto et al., 2016] Luca Bertinetto, João F. Henriques, Jack Valmadre, Philip H. S. Torr, and Andrea Vedaldi. Learning feed-forward one-shot learners. In NIPS, pages 523-531, 2016.
3. [Cao et al., 2021] Kaidi Cao, Jiaxuan You, and Jure Leskovec. Relational multi-task learning: Modeling re- lations between data and tasks. In ICLR, 2021.
4. [Chen et al., 2019] Wei-Yu Chen, Yen-Cheng Liu, Zsolt Kira, Yu-Chiang Frank Wang, and Jia-Bin Huang. A closer look at few-shot classification. In ICLR, 2019.
5. [Fang et al., 2022] Yin Fang, Qiang Zhang, Haihong Yang, Xiang Zhuang, Shumin Deng, Wen Zhang, Ming Qin, Zhuo Chen, Xiaohui Fan, and Huajun Chen. Molecu- lar contrastive learning with chemical element knowledge graph. In AAAI, pages 3968-3976, 2022.
6. [Fang et al., 2023] Yin Fang, Qiang Zhang, Ningyu Zhang, Zhuo Chen, Xiang Zhuang, Xin Shao, Xiaohui Fan, and Huajun Chen. Knowledge graph-enhanced molecular con- trastive learning with functional prompt. Nature Machine Intelligence, pages 1-12, 2023.
7. [Fei et al., 2021] Nanyi Fei, Zhiwu Lu, Tao Xiang, and Songfang Huang. MELR: meta-learning via modeling episode-level relationships for few-shot learning. In ICLR, 2021.
8. [Finn et al., 2017] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, pages 1126-1135, 2017.
9. [Fuchs and Whelton, 2020] Flávio D Fuchs and Paul K Whelton. High blood pressure and cardiovascular disease. Hypertension, pages 285-292, 2020.
10. [Guo et al., 2021] Zhichun Guo, Chuxu Zhang, Wenhao Yu, John Herr, Olaf Wiest, Meng Jiang, and Nitesh V. Chawla. Few-shot graph learning for molecular property predic- tion. In WWW, pages 2559-2567, 2021.
11. [Hamilton et al., 2017] William L. Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In NIPS, pages 1024-1034, 2017.
12. [Hjelm et al., 2019] R. Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Philip Bachman, Adam Trischler, and Yoshua Bengio. Learning deep rep- resentations by mutual information estimation and maxi- mization. In ICLR, 2019.
13. [Hospedales et al., 2021] Timothy M Hospedales, Antreas Antoniou, Paul Micaelli, and Amos J Storkey. Meta- learning in neural networks: A survey. IEEE transactions on pattern analysis and machine intelligence, 2021.
14. [Hu et al., 2020] Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay S. Pande, and Jure Leskovec. Strategies for pre-training graph neural net- works. In ICLR, 2020.
15. [Kim et al., 2019] Jongmin Kim, Taesup Kim, Sungwoong Kim, and Chang D. Yoo. Edge-labeling graph neural net- work for few-shot learning. In CVPR, pages 11-20, 2019.
16. [Koch et al., 2015] Gregory Koch, Richard Zemel, Ruslan Salakhutdinov, et al. Siamese neural networks for one- shot image recognition. In ICML deep learning workshop, page 0, 2015.
17. [Liu et al., 2019] Yanbin Liu, Juho Lee, Minseop Park, Sae- hoon Kim, Eunho Yang, Sung Ju Hwang, and Yi Yang. Learning to propagate labels: Transductive propagation network for few-shot learning. In ICLR, 2019.
18. [Liu et al., 2020] Chenghao Liu, Zhihao Wang, Doyen Sa- hoo, Yuan Fang, Kun Zhang, and Steven C. H. Hoi. Adap- tive task sampling for meta-learning. In ECCV, pages 752- 769, 2020.
19. [Riniker and Landrum, 2013] Sereina Riniker and Gre- gory A Landrum. Similarity maps-a visualization strategy for molecular fingerprints and machine-learning methods. Journal of cheminformatics, pages 1-7, 2013.
20. [Sliwoski et al., 2014] Gregory Sliwoski, Sandeepkumar Kothiwale, Jens Meiler, and Edward W Lowe. Compu- tational methods in drug discovery. Pharmacological reviews, pages 334-395, 2014.
21. [Snell et al., 2017] Jake Snell, Kevin Swersky, and Richard S. Zemel. Prototypical networks for few-shot learning. In NIPS, pages 4077-4087, 2017.
22. [Song et al., 2020] Ying Song, Shuangjia Zheng, Zhang- ming Niu, Zhang-Hua Fu, Yutong Lu, and Yuedong Yang. Communicative representation learning on at- tributed molecular graphs. In IJCAI, pages 2831-2838, 2020.
23. [Vinyals et al., 2016] Oriol Vinyals, Charles Blundell, Tim Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Match- ing networks for one shot learning. In NIPS, pages 3630- 3638, 2016.
24. [Wang et al., 2012] Yanli Wang, Jewen Xiao, Tugba O Suzek, Jian Zhang, Jiyao Wang, Zhigang Zhou, Lianyi Han, Karen Karapetyan, Svetlana Dracheva, Benjamin A Shoemaker, et al. Pubchem's bioassay database. Nucleic acids research, pages D400-D412, 2012.
25. [Wang et al., 2020] Yaqing Wang, Quanming Yao, James T. Kwok, and Lionel M. Ni. Generalizing from a few exam- ples: A survey on few-shot learning. ACM Comput. Surv., pages 63:1-63:34, 2020.
26. [Wang et al., 2021] Yaqing Wang, Abulikemu Abuduweili, Quanming Yao, and Dejing Dou. Property-aware relation networks for few-shot molecular property prediction. In NeurIPS, pages 17441-17454, 2021.
27. [Williams, 1992] Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforce- ment learning. Machine learning, pages 229-256, 1992.
28. [Wu et al., 2018] Zhenqin Wu, Bharath Ramsundar, Evan N Feinberg, Joseph Gomes, Caleb Geniesse, Aneesh S Pappu, Karl Leswing, and Vijay Pande. Moleculenet: a benchmark for molecular machine learning. Chemical sci- ence, pages 513-530, 2018.
29. [Xu et al., 2019] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural net- works? In ICLR, 2019.
30. [Yao et al., 2021] Huaxiu Yao, Yu Wang, Ying Wei, Peilin Zhao, Mehrdad Mahdavi, Defu Lian, and Chelsea Finn. Meta-learning with an adaptive task scheduler. In NeurIPS, pages 7497-7509, 2021.
