@@ -15,13 +15,13 @@ The research hypothesis is that tabular MLPs generalize better when hidden units
1515- specialize on a sparse subset of input features, and
1616- avoid learning highly overlapping feature attributions.
1717
18- | Property | DeepTab Tangos |
19- | -------- | -------------- |
20- | Base architecture | MLP |
21- | Additional mechanism | Jacobian-based specialization and orthogonalization penalty |
22- | Training hook | ` penalty_forward ` |
23- | Main cost driver | ` torch.func.jacrev ` / Jacobian computation |
24- | Best baseline comparisons | MLP, ResNet, TabM |
18+ | Property | DeepTab Tangos |
19+ | ------------------------- | --------------------------------------------- -------------- |
20+ | Base architecture | MLP |
21+ | Additional mechanism | Jacobian-based specialization and orthogonalization penalty |
22+ | Training hook | ` penalty_forward ` |
23+ | Main cost driver | ` torch.func.jacrev ` / Jacobian computation |
24+ | Best baseline comparisons | MLP, ResNet, TabM |
2525
2626## Architectural Details
2727
@@ -42,7 +42,7 @@ Linear output head
4242During training, Tangos computes a representation Jacobian:
4343
4444\[
45- J _ {h,x} = \frac{\partial h(x)}{\partial x}
45+ J \_ {h,x} = \frac{\partial h(x)}{\partial x}
4646\]
4747
4848where \( h(x)\) is the representation before the final output head. The model builds latent-unit attribution vectors from this Jacobian and adds:
@@ -53,38 +53,38 @@ where \(h(x)\) is the representation before the final output head. The model bui
5353The training loss is:
5454
5555\[
56- \mathcal{L}_ {total} = \mathcal{L}_ {task} + \lambda_1 \mathcal{L}_ {spec} + \lambda_2 \mathcal{L}_ {orth}
56+ \mathcal{L}_ {total} = \mathcal{L}_ {task} + \lambda * 1 \mathcal{L}* {spec} + \lambda * 2 \mathcal{L}* {orth}
5757\]
5858
5959## Main Building Blocks
6060
6161The implementation lives in ` deeptab/architectures/experimental/tangos.py ` .
6262
63- | Component | Implementation | Role |
64- | --------- | -------------- | ---- |
65- | Dense body | ` nn.ModuleList ` of linear, normalization, activation, dropout layers | Learns tabular representation |
66- | Optional GLU | ` nn.GLU() ` when ` use_glu=True ` | Gated dense transformations |
67- | Optional skip connections | Shape-matched residual additions | Stabilizes deeper MLPs |
68- | Representation function | ` repr_forward ` | Hidden representation used for Jacobian attribution |
69- | Jacobian computation | ` torch.func.vmap(torch.func.jacrev(...)) ` | Computes per-sample hidden-unit attributions |
70- | Specialization loss | L1 norm of attribution tensor | Encourages sparse feature usage |
71- | Orthogonality loss | Cosine similarity between neuron attributions | Encourages diverse hidden units |
72- | Output head | ` nn.Linear(last_hidden, num_classes) ` | Task prediction |
63+ | Component | Implementation | Role |
64+ | ------------------------- | -------------------------------------------------------------------- | ----------------------------------------------- ---- |
65+ | Dense body | ` nn.ModuleList ` of linear, normalization, activation, dropout layers | Learns tabular representation |
66+ | Optional GLU | ` nn.GLU() ` when ` use_glu=True ` | Gated dense transformations |
67+ | Optional skip connections | Shape-matched residual additions | Stabilizes deeper MLPs |
68+ | Representation function | ` repr_forward ` | Hidden representation used for Jacobian attribution |
69+ | Jacobian computation | ` torch.func.vmap(torch.func.jacrev(...)) ` | Computes per-sample hidden-unit attributions |
70+ | Specialization loss | L1 norm of attribution tensor | Encourages sparse feature usage |
71+ | Orthogonality loss | Cosine similarity between neuron attributions | Encourages diverse hidden units |
72+ | Output head | ` nn.Linear(last_hidden, num_classes) ` | Task prediction |
7373
7474## Configuration
7575
76- | Parameter | Default | Practical Effect |
77- | --------- | ------- | ---------------- |
78- | ` layer_sizes ` | ` [256, 128, 32] ` | Width/depth of the MLP body |
79- | ` dropout ` | ` 0.2 ` | Standard dropout regularization |
80- | ` activation ` | ` nn.ReLU() ` | Hidden activation |
81- | ` use_glu ` | ` False ` | Enables gated linear units |
82- | ` skip_connections ` | ` False ` | Adds residual connections when shapes match |
83- | ` batch_norm ` | inherited default ` False ` | Optional batch normalization |
84- | ` layer_norm ` | inherited default ` False ` | Optional layer normalization |
85- | ` lamda1 ` | ` 0.5 ` | Weight for specialization penalty |
86- | ` lamda2 ` | ` 0.1 ` | Weight for orthogonality penalty |
87- | ` subsample ` | ` 0.5 ` | Fraction used for regularization pair sampling |
76+ | Parameter | Default | Practical Effect |
77+ | ------------------ | ------------------------- | ------------------------------ ---------------- |
78+ | ` layer_sizes ` | ` [256, 128, 32] ` | Width/depth of the MLP body |
79+ | ` dropout ` | ` 0.2 ` | Standard dropout regularization |
80+ | ` activation ` | ` nn.ReLU() ` | Hidden activation |
81+ | ` use_glu ` | ` False ` | Enables gated linear units |
82+ | ` skip_connections ` | ` False ` | Adds residual connections when shapes match |
83+ | ` batch_norm ` | inherited default ` False ` | Optional batch normalization |
84+ | ` layer_norm ` | inherited default ` False ` | Optional layer normalization |
85+ | ` lamda1 ` | ` 0.5 ` | Weight for specialization penalty |
86+ | ` lamda2 ` | ` 0.1 ` | Weight for orthogonality penalty |
87+ | ` subsample ` | ` 0.5 ` | Fraction used for regularization pair sampling |
8888
8989``` python
9090from deeptab.configs import PreprocessingConfig, TangosConfig, TrainerConfig
@@ -98,27 +98,27 @@ model = TangosRegressor(
9898 lamda2 = 0.1 ,
9999 subsample = 0.5 ,
100100 ),
101- preprocessing_config = PreprocessingConfig(numerical_preprocessing = " standard " ),
101+ preprocessing_config = PreprocessingConfig(numerical_preprocessing = " standardization " ),
102102 trainer_config = TrainerConfig(lr = 1e-3 , batch_size = 128 , max_epochs = 100 ),
103103 random_state = 101 ,
104104)
105105```
106106
107107## Practical Guide
108108
109- | Dataset Condition | Recommendation |
110- | ----------------- | -------------- |
111- | Small or noisy data | Try Tangos against MLP/ResNet; the regularizer may help |
112- | Very high feature count | Watch Jacobian memory and runtime |
113- | Large batch sizes | Reduce batch size if Jacobian computation is slow or memory-heavy |
114- | Need fast training | Prefer MLP, ResNet, or TabM |
115- | Want attribution diversity analysis | Tangos is a useful research model |
109+ | Dataset Condition | Recommendation |
110+ | ----------------------------------- | --------------------------------------------------- -------------- |
111+ | Small or noisy data | Try Tangos against MLP/ResNet; the regularizer may help |
112+ | Very high feature count | Watch Jacobian memory and runtime |
113+ | Large batch sizes | Reduce batch size if Jacobian computation is slow or memory-heavy |
114+ | Need fast training | Prefer MLP, ResNet, or TabM |
115+ | Want attribution diversity analysis | Tangos is a useful research model |
116116
117117Suggested search space:
118118
119119``` python
120120param_grid = {
121- " preprocessing_config__numerical_preprocessing" : [" standard " , " quantile" ],
121+ " preprocessing_config__numerical_preprocessing" : [" standardization " , " quantile" ],
122122 " model_config__layer_sizes" : [[128 , 64 ], [256 , 128 , 32 ], [512 , 256 , 128 ]],
123123 " model_config__dropout" : [0.0 , 0.1 , 0.2 , 0.3 ],
124124 " model_config__lamda1" : [0.1 , 0.5 , 1.0 ],
0 commit comments