Spaces:
Sleeping
Sleeping
Download src/models/model.py from Nickanas/PaySim-Fraud: direct link, hf CLI and curl.
- Browser
- Download file 803 Bytes
-
https://huggingface.co/spaces/Nickanas/PaySim-Fraud/resolve/main/src/models/model.py
- Command line
-
hf download hf://spaces/Nickanas/PaySim-Fraud/src/models/model.py
-
curl -L -o model.py https://huggingface.co/spaces/Nickanas/PaySim-Fraud/resolve/main/src/models/model.py
803 Bytes
| import torch.nn as nn | |
| class FraudMLP(nn.Module): | |
| """Small MLP baseline for flat-row fraud classification. | |
| Outputs a single logit per row — pair with BCEWithLogitsLoss | |
| (no sigmoid here; the loss applies it internally). | |
| """ | |
| def __init__(self, input_dim: int, hidden: int = 64, p_drop: float = 0.3): | |
| super().__init__() | |
| self.net = nn.Sequential( | |
| nn.Linear(input_dim, hidden), | |
| nn.BatchNorm1d(hidden), | |
| nn.ReLU(), | |
| nn.Dropout(p_drop), | |
| nn.Linear(hidden, hidden // 2), | |
| nn.BatchNorm1d(hidden // 2), | |
| nn.ReLU(), | |
| nn.Dropout(p_drop), | |
| nn.Linear(hidden // 2, 1), # single logit | |
| ) | |
| def forward(self, x): | |
| return self.net(x) |