Downloads · 30 days
0
Arko007/credit-card-fraud-massive-resnet
credit-card-fraud-massive-resnet is a machine learning model from Arko007. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as apache-2.0.
"The Beast" - A 4096-width Deep Residual Network trained on 2x Tesla T4 GPUs with a batch size of 24,576.
Downloads · 30 days
0
Access
Public
Updated Dec 25, 2025
Repo size
826 MB
Likes
0
Public
Click a slice to open those files.
.pt826 MB · 100%
From the Hugging Face model README
"The Beast" - A 4096-width Deep Residual Network trained on 2x Tesla T4 GPUs with a batch size of 24,576.
This repository contains a high-performance Pytorch model designed to detect fraudulent credit card transactions. Unlike standard lightweight models, this architecture utilizes massive capacity (ResNet-style blocks with 4096 neurons) and aggressive data augmentation to achieve state-of-the-art Precision-Recall performance.
This model was evaluated on the highly imbalanced Credit Card Fraud Detection dataset (284,807 transactions, only 492 frauds).
| Metric | Score | Notes |
|---|---|---|
| PR-AUC | 0.8163 | Area Under Precision-Recall Curve (Critical for imbalance) |
| ROC-AUC | 0.9746 | Area Under Receiver Operating Characteristic |
| Precision | High | Minimizes false positives (blocking valid cards) |
| Recall | High | Catches the majority of fraud cases |
Note: Achieving >0.80 PR-AUC on this dataset is considered elite performance.
The solution uses a hybrid approach (though the .pt file provided here is the primary Supervised Classifier).
Classifier.pt)Mish (Self Regularized Non-Monotonic).Autoencoder.pt)lr=1e-3 with OneCycleLR Warmup).QuantileTransformer (Output distribution: Normal/Gaussian).BorderlineSMOTE (Ratio 1:1) used during training to force learning of hard decision boundaries.Since this is a custom Pytorch architecture, you need to define the class structure before loading the weights.
import torch
import torch.nn as nn
import torch.nn.functional as F
# 1. Define the Architecture
class GaussianNoise(nn.Module):
def __init__(self, sigma=0.05):
super().__init__()
self.sigma = sigma
def forward(self, x):
if self.training: return x + torch.randn_like(x) * self.sigma
return x
class Mish(nn.Module):
def forward(self, x): return x * torch.tanh(F.softplus(x))
class ResBlock(nn.Module):
def __init__(self, dim, dropout=0.2):
super().__init__()
self.norm1 = nn.BatchNorm1d(dim)
self.act1 = Mish()
self.fc1 = nn.Linear(dim, dim)
self.drop1 = nn.Dropout(dropout)
self.norm2 = nn.BatchNorm1d(dim)
self.act2 = Mish()
self.fc2 = nn.Linear(dim, dim)
self.drop2 = nn.Dropout(dropout)
def forward(self, x):
res = x
x = self.norm1(x)
x = self.act1(x)
x = self.fc1(x)
x = self.drop1(x)
x = self.norm2(x)
x = self.act2(x)
x = self.fc2(x)
x = self.drop2(x)
return x + res
class ResNetClassifier(nn.Module):
def __init__(self, input_dim=62): # Default input dim from engineering
super().__init__()
self.noise = GaussianNoise(0.05)
self.proj = nn.Linear(input_dim, 4096)
self.blocks = nn.Sequential(
ResBlock(4096, 0.4), ResBlock(4096, 0.4),
ResBlock(4096, 0.3), ResBlock(4096, 0.3),
ResBlock(4096, 0.2), ResBlock(4096, 0.2)
)
self.bottleneck = nn.Sequential(
nn.BatchNorm1d(4096), Mish(),
nn.Linear(4096, 512), Mish()
)
self.head = nn.Linear(512, 1)
def forward(self, x):
x = self.noise(x)
x = self.proj(x)
x = self.blocks(x)
x = self.bottleneck(x)
return self.head(x).squeeze()
# 2. Load the Model
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = ResNetClassifier(input_dim=62)
# Download 'Classifier.pt' from this repo
model.load_state_dict(torch.load("Classifier.pt", map_location=device))
model.to(device)
model.eval()
print("✅ Model loaded successfully!")
Apache 2.0