sebastiansarasti's picture
Update README.md
14d918c verified
---
tags:
- model_hub_mixin
- pytorch_model_hub_mixin
license: mit
---
# CustomerSegmentationModel: Autoencoder for Customer Segmentation
## Model Details
- **Model Architecture:** Autoencoder
- **Framework:** PyTorch
- **Input Dimension:** User-defined (`input_dim`)
- **Output:** Reconstructed customer features
- **Dataset:** [Predicting Credit Card Customer Attrition](https://www.kaggle.com/datasets/thedevastator/predicting-credit-card-customer-attrition-with-m)
## Model Description
The **CustomerSegmentationModel** is an **autoencoder** designed to extract low-dimensional representations of customer data. It consists of:
- An **encoder** that compresses the input into a **2D latent space**.
- A **decoder** that reconstructs the original input from the compressed representation.
This approach enables **customer segmentation** based on the learned latent space.
## Training Details
- **Loss Function:** Smooth L1 Loss
- **Optimizer:** Adam
- **Batch Size:** 256
- **Number of Epochs:** 100
- **Regularization:** Dropout (50%) and Layer Normalization
### Model Architecture
```python
class CustomerSegmentationModel(nn.Module, PyTorchModelHubMixin):
def __init__(self, input_dim):
super(CustomerSegmentationModel, self).__init__()
self.encoder = nn.Sequential(
nn.Linear(input_dim, 256),
nn.ReLU(),
nn.Dropout(0.5),
nn.Linear(256, 128),
nn.ReLU(),
nn.Dropout(0.5),
nn.LayerNorm(128),
nn.Linear(128, 64),
nn.ReLU(),
nn.Dropout(0.5),
nn.LayerNorm(64),
nn.Linear(64, 2),
)
self.decoder = nn.Sequential(
nn.Linear(2, 64),
nn.ReLU(),
nn.Dropout(0.5),
nn.Linear(64, 128),
nn.ReLU(),
nn.Dropout(0.5),
nn.Linear(128, 256),
nn.ReLU(),
nn.Dropout(0.5),
nn.Linear(256, input_dim),
nn.Sigmoid(),
)
def forward(self, x):
x = self.encoder(x)
x = self.decoder(x)
return x
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
- Library: [More Information Needed]
- Docs: [More Information Needed]