You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+66Lines changed: 66 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,22 @@ Mambular is a Python package that brings the power of Mamba architectures to tab
28
28
-**Sklearn-like API**: The familiar scikit-learn `fit`, `predict`, and `predict_proba` methods mean minimal learning curve for those already accustomed to scikit-learn.
29
29
-**PyTorch Lightning Under the Hood**: Built on top of PyTorch Lightning, Mambular models benefit from streamlined training processes, easy customization, and advanced features like distributed training and 16-bit precision.
|`Mambular`| An advanced model using Mamba blocks specifically designed for various tabular data tasks. |
37
+
|`FTTransformer`| A model leveraging transformer encoders, as introduced by [Gorishniy et al.](https://arxiv.org/abs/2106.11959), for tabular data. |
38
+
|`MLP`| A classical Multi-Layer Perceptron (MLP) model for handling tabular data tasks. |
39
+
|`ResNet`| An adaptation of the ResNet architecture for tabular data applications. |
40
+
|`TabTransformer`| A transformer-based model for tabular data introduced by [Huang et al.](https://arxiv.org/abs/2012.06678), enhancing feature learning capabilities. |
41
+
42
+
All models are available for `regression`, `classification` and distributional regression, denoted by `LSS`.
43
+
Hence, they are available as e.g. `MambularRegressor`, `MambularClassifier` or `MambularLSS`
44
+
45
+
46
+
31
47
## Documentation
32
48
33
49
You can find the Mamba-Tabular API documentation [here](https://mamba-tabular.readthedocs.io/en/latest/index.html).
@@ -144,6 +160,56 @@ model.fit(
144
160
145
161
```
146
162
163
+
164
+
### Implement your own model:
165
+
mambular allows users to easily integrate their custom models into the existing logic. Simply create a pytorch model and define its forward pass. Instead of inheriting from nn.Module, inherit from mambulars BaseModel. Each mambular model takse three arguments. The number of classes, e.g. = 1 for regression or = 2 for binary classification. For distributional regression, while this argument must be provided, it is determined automatically depending on the chosen distribution. Additionally, it takes two arguments directly passed from preprocessor. The cat_feature_info and num_feature_info for categorical and numerical feature information of e.g. the provided shape. Additionally, you can provide a config argument, which you can either use simialr to the implemented models, or leave empty as shown below. A custom model could hence look just like this:
for feature_name, input_shape in num_feature_info.items():
185
+
input_dim += input_shape
186
+
for feature_name, input_shape in cat_feature_info.items():
187
+
input_dim +=1
188
+
189
+
self.linear = nn.Linear(input_dim, num_classes)
190
+
191
+
defforward(self, num_features, cat_features):
192
+
x = num_features + cat_features
193
+
x = torch.cat(x, dim=1)
194
+
195
+
# Pass through linear layer
196
+
output =self.linear(x)
197
+
return output
198
+
```
199
+
200
+
To leverage the mambular API, you can build a regression, classification or distributional regression model that can leverage all of mambulars built-in methods, by using the following:
Subsequently, you can fit, evaluate and predict with your model just like with any other mambualr model.
211
+
To achieve the same for classification or disrtibutional regression, instead of inheriting from the SklearnbaseRegressor, simply inherit from the SklearnBaseClassifier and SklearnBaseLSS.
212
+
147
213
## Citation
148
214
149
215
If you find this project useful in your research, please consider cite:
0 commit comments