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: docs/homepage.md
+104-3Lines changed: 104 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,39 @@ Mambular is a Python package that brings the power of Mamba architectures to tab
12
12
-**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. |
20
+
|`FTTransformer`| A model leveraging transformer encoders, as introduced by [Gorishniy et al.](https://arxiv.org/abs/2106.11959), for tabular data. |
21
+
|`MLP`| A classical Multi-Layer Perceptron (MLP) model for handling tabular data tasks. |
22
+
|`ResNet`| An adaptation of the ResNet architecture for tabular data applications. |
23
+
|`TabTransformer`| A transformer-based model for tabular data introduced by [Huang et al.](https://arxiv.org/abs/2012.06678), enhancing feature learning capabilities. |
24
+
25
+
All models are available for `regression`, `classification` and distributional regression, denoted by `LSS`.
26
+
Hence, they are available as e.g. `MambularRegressor`, `MambularClassifier` or `MambularLSS`
27
+
28
+
29
+
30
+
## Documentation
31
+
32
+
You can find the Mamba-Tabular API documentation [here](https://mamba-tabular.readthedocs.io/en/latest/index.html).
33
+
34
+
## Installation
35
+
36
+
Install Mambular using pip:
37
+
```sh
38
+
pip install mambular
39
+
```
40
+
15
41
## Preprocessing
16
42
17
43
Mambular simplifies the preprocessing stage of model development with a comprehensive set of techniques to prepare your data for Mamba architectures. Our preprocessing module is designed to be both powerful and easy to use, offering a variety of options to efficiently transform your tabular data.
18
44
19
45
### Data Type Detection and Transformation
20
46
21
47
Mambular automatically identifies the type of each feature in your dataset and applies the most appropriate transformations for numerical and categorical variables. This includes:
22
-
23
48
-**Ordinal Encoding**: Categorical features are seamlessly transformed into numerical values, preserving their inherent order and making them model-ready.
24
49
-**One-Hot Encoding**: For nominal data, Mambular employs one-hot encoding to capture the presence or absence of categories without imposing ordinality.
25
50
-**Binning**: Numerical features can be discretized into bins, a useful technique for handling continuous variables in certain modeling contexts.
@@ -102,7 +127,8 @@ from mambular.models import MambularLSS
102
127
model = MambularLSS(
103
128
dropout=0.2,
104
129
d_model=64,
105
-
n_layers=8,
130
+
n_layers=8,
131
+
106
132
)
107
133
108
134
# Fit the model to your data
@@ -117,10 +143,81 @@ model.fit(
117
143
118
144
```
119
145
146
+
147
+
### Implement your own model:
148
+
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 implement similarly to the implemented configs, or simply use one of the Default Configs provided. A custom model could hence look just like this:
149
+
150
+
151
+
1. First, define your config
152
+
153
+
```python
154
+
from dataclasses import dataclass
155
+
156
+
@dataclass
157
+
classMyConfig:
158
+
lr: float=1e-04
159
+
lr_patience: int=10
160
+
weight_decay: float=1e-06
161
+
lr_factor: float=0.1
162
+
```
163
+
164
+
2. Second, define your model just as you would for a nn.Module. Simply define the architecture and the forward pass
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
+
3. 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:
4. 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.
0 commit comments