fusilli.fusionmodels.tabularfusion.channelwise_attο
Channel-wise multiplication fusion model for tabular data.
Classes
Channel-wise multiplication fusion model for tabular data. |
- class TabularChannelWiseMultiAttention(prediction_task, data_dims, multiclass_dimensions)[source]ο
Bases:
ParentFusionModel
,Module
Channel-wise multiplication fusion model for tabular data.
This class implements a model that fuses the two types of tabular data using a channel-wise multiplication approach.
If the two types of tabular data have different feature dimensions at each layer, the model will use a linear layer to make the dimensions the same. This is done to ensure that the channel-wise multiplication can be performed.
Inspired by the work of Duanmu et al. (2020) [1]: here we use two types of tabular data as the multi-modal data instead of image and non-image like in the paper.
References
Duanmu, H., Huang, P. B., Brahmavar, S., Lin, S., Ren, T., Kong, J., Wang, F., & Duong, T. Q. (2020). Prediction of Pathological Complete Response to Neoadjuvant Chemotherapy in Breast Cancer Using Deep Learning with Integrative Imaging, Molecular and Demographic Data. In A. L. Martel, P. Abolmaesumi, D. Stoyanov, D. Mateus, M. A. Zuluaga, S. K. Zhou, D. Racoceanu, & L. Joskowicz (Eds.), Medical Image Computing and Computer Assisted Intervention β MICCAI 2020 (pp. 242β252). Springer International Publishing. https://doi.org/10.1007/978-3-030-59713-9_24
Accompanying code: (our model is inspired by the work of Duanmu et al. (2020) [1]) https://github.com/HongyiDuanmu26/Prediction-of-pCR-with-Integrative-Deep-Learning/blob/main/CustomNet.py
- mod1_layersο
Dictionary containing the layers of the 1st type of tabular data.
- Type:
nn.ModuleDict
- mod2_layersο
Dictionary containing the layers of the 2nd type of tabular data.
- Type:
nn.ModuleDict
- match_dim_layersο
Module dictionary containing the linear layers to make the dimensions of the two types of tabular data the same. This is done to ensure that the channel-wise multiplication can be performed. This doesnβt change the mod1_layers or mod2_layers, it just makes the outputs multipliable.
- Type:
nn.ModuleDict
- fused_dimο
Number of features of the fused layers. This is the output size of the 2nd type of tabular dataβs layers.
- Type:
int
- fused_layersο
Sequential layer containing the fused layers.
- Type:
nn.Sequential
- final_predictionο
Sequential layer containing the final prediction layers.
- Type:
nn.Sequential
- __init__(prediction_task, data_dims, multiclass_dimensions)[source]ο
- Parameters:
prediction_task (str) β Type of prediction to be performed.
data_dims (list) β List containing the dimensions of the data.
multiclass_dimensions (int) β Number of classes in the dataset.
- calc_fused_layers()[source]ο
Calculates the fusion layers.
- Return type:
None
- Raises:
ValueError β If the number of layers in the two modalities is different.
ValueError β If dtype of the layers is not nn.ModuleDict.
- forward(x)[source]ο
Forward pass of the model.
- Parameters:
x (tuple) β Tuple containing the input data.
- Returns:
List containing the output of the model.
- Return type:
list
- fusion_type = 'attention'ο
Type of fusion.
- Type:
str
- method_name = 'Channel-wise multiplication net (tabular)'ο
Name of the method.
- Type:
str
- modality_type = 'tabular_tabular'ο
Type of modality.
- Type:
str