|
Download README.md from Devdit/Datathon_TabTransformer: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/Devdit/Datathon_TabTransformer/resolve/main/README.md
- Command line
-
hf download hf://Devdit/Datathon_TabTransformer/README.md
-
curl -L -o README.md https://huggingface.co/Devdit/Datathon_TabTransformer/resolve/main/README.md
1.57 kB
| # 🧠 TabTransformer Multitask Model for Churn, Tenure, and LTV Prediction | |
| This model is a multitask `TabTransformer` implemented in PyTorch, designed to perform: | |
| - **Binary classification** for customer **churn** | |
| - **Regression** for customer **tenure** | |
| - **Regression** for customer **LTV (Lifetime Value)** | |
| It is saved as a pickle file: `model.pkl` and includes all custom layers (e.g., positional encoding). | |
| --- | |
| ## 🧩 Model Architecture | |
| - Tabular input with: | |
| - `x_num`: Numerical features (projected into latent space) | |
| - `x_cat`: Categorical features (embedded + transformer) | |
| - Transformer-based attention over categorical embeddings | |
| - Multi-head output for multitask predictions: | |
| - `Churn`: Sigmoid activation for binary classification | |
| - `Tenure` and `LTV`: Linear regression heads | |
| --- | |
| ## 🧪 How to Use | |
| ### 1. Install Dependencies | |
| ```bash | |
| pip install torch pandas | |
| import torch | |
| # Load the model from pickle | |
| with open("model.pkl", "rb") as f: | |
| model = torch.load(f) | |
| model.eval() | |
| # Example dummy input | |
| x_num = torch.rand((1, 10)) # Replace 10 with your actual num_features | |
| x_cat = torch.randint(0, 5, (1, 3)) # Replace with your actual number of categories | |
| # Predict | |
| churn_prob, predicted_tenure, predicted_ltv = model(x_num, x_cat) | |
| print("Churn probability:", churn_prob.item()) | |
| print("Predicted tenure:", predicted_tenure.item()) | |
| print("Predicted LTV:", predicted_ltv.item()) | |
| ( | |
| churn_prob: FloatTensor of shape (B, 1), | |
| predicted_tenure: FloatTensor of shape (B, 1), | |
| predicted_ltv: FloatTensor of shape (B, 1) | |
| ) | |