BernProp(K, is_source_domain=True, bias=True, **kwargs)
Bases: MessagePassing
K-order Bernstein polynomial approximation.
| Parameters: |
|
|---|
Notes
This class implements a graph neural network layer that performs spectral domain adaptation. It uses a polynomial filter approach with learnable temperature parameters to adapt the spectral characteristics of the graph.
The layer computes a polynomial filter of order K and applies it to the graph signal through message passing operations. The filter coefficients are determined by learnable temperature parameters that differ between source and target domains.
| Attributes: |
|
|---|
__repr__()
String representation of the layer.
| Returns: |
|
|---|
forward(x, edge_index, edge_weight=None)
Forward pass of the DGSD layer.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
This method implements the spectral domain adaptation by:
-
Computing the symmetric normalized Laplacian
-
Adding self-loops with appropriate weights
-
Propagating messages through the graph using polynomial filters
-
Combining the results using binomial coefficients and temperature parameters
get_filter()
Compute the spectral filter using cached terms and coefficients.
| Returns: |
|
|---|
Notes
This method requires cached_terms and cached_coefs to be set before calling. The filter is computed as a weighted sum of polynomial terms.
message(x_j, norm)
Message function for message passing.
| Parameters: |
|
|---|
| Returns: |
|
|---|
reset_parameters()
Reset the learnable parameters of the layer.
Notes
-
For source domain layers, temperature parameters are initialized to 1.
-
For target domain layers, temperature parameters are set to a linear interpolation from 1 to 0 over K+1 values.
DGSDABase(features, hidden, classes, dprate=0.0, K=15)
Bases: Module
Base class for DGSDA.
| Parameters: |
|
|---|
Notes
This class implements a domain generalization model using spectral domain adaptation. It uses separate propagation layers for source and target domains to adapt the spectral characteristics of the graph data.
The model consists of:
-
Linear transformation layers
-
Bernoulli propagation layers with polynomial filters
-
Domain-specific propagation paths
forward(data, is_source_domain=True)
Forward pass of the DGSDA model.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
The forward pass consists of:
-
Domain-specific feature propagation
-
Dropout regularization
-
Final linear classification
-
Final propagation step
get_props(x, edge_index, is_source_domain=True)
Apply domain-specific feature propagation.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
This method implements the domain-specific feature processing:
-
Initial dropout and ReLU activation
-
Domain-specific propagation using Bernoulli polynomial filters
-
Separate propagation paths for source and target domains
reset_parameters()
Reset the learnable parameters of the model.
Notes
Currently only resets the first propagation layer (prop1).