🔥 RTX 3060 GPU Optimizasyonu ile PyTorch tabanlı zaman serisi tahmini projesi
- 4 Gelişmiş Model: LSTM (özelleştirilmiş), GRU, CNN-LSTM Hibrit, Transformer
- RTX 3060 Optimizasyonu: GPU memory ve işlem gücü tam optimizasyonu
- Hyperparameter Tuning: Otomatik en iyi parametre arama
- İnteraktif Dashboard: Real-time eğitim takibi ve sonuç görselleştirme
- Data Augmentation: Eğitim verisi genişletme teknikleri
- Early Stopping: Overfitting önleme
- Advanced Loss: MSE + MAE hibrit loss fonksiyonu
| Model | Accuracy | MSE | Parametreler | Özellik |
|---|---|---|---|---|
| LSTM (Enhanced) | ~94%+ | 0.006 | ~1.2M | BiLSTM + Attention + Residual |
| GRU | ~93%+ | 0.007 | ~800K | Hızlı, 1D-Conv features |
| CNN-LSTM | ~92%+ | 0.007 | ~900K | Pattern extraction + Temporal |
| Transformer | ~51% | 0.086 | ~926K | Self-attention (baseline) |
# Python 3.8+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install numpy pandas scikit-learn flask matplotlib# CUDA 11.8+ gerekli
# https://developer.nvidia.com/cuda-downloads.
├── models.py # Gelişmiş model mimarileri
├── train.py # GPU optimizasyonlu eğitim
├── tune_hyperparams.py # Hyperparameter tuning
├── dashboard_server.py # Web arayüzü
├── run_project.bat # Kolay başlatma scriptleri
├── utils.py # Yardımcı fonksiyonlar
├── prepare_data.py # Veri hazırlama
├── data/ # Eğitim verileri (.npy)
├── checkpoints/ # Model ağırlıkları ve sonuçlar
├── tuning_results/ # Hyperparameter sonuçları
└── dashboard.html # Dashboard arayüzü
# Linux/Mac
chmod +x run_project.sh
./run_project.sh
# Windows
run_project.batpython train_enhanced.py \
--data data/series.npy \
--model lstm \
--hidden_dim 384 \
--n_layers 3 \
--batch 128 \
--epochs 50 \
--lr 5e-4 \
--dropout 0.3 \
--patience 12 \
--augmentpython train_enhanced.py \
--data data/series.npy \
--model gru \
--hidden_dim 256 \
--n_layers 3 \
--batch 160 \
--epochs 25 \
--lr 1e-3 \
--dropout 0.2python train_enhanced.py \
--data data/series.npy \
--model cnn_lstm \
--hidden_dim 256 \
--n_layers 2 \
--batch 96 \
--epochs 30 \
--lr 3e-4 \
--dropout 0.3 \
--augmentpython tune_hyperparams.py
# ⚠️ 2-4 saat sürer, 100+ deney çalıştırırpython dashboard_server_enhanced.py
# http://localhost:5000- BiLSTM (Bidirectional)
- Multi-head Attention (8 heads)
- Residual connections
- Multiple pooling strategies (last, max, mean)
- LayerNorm + Dropout
- Input feature extraction
- 384 hidden dim, 3 layers optimal- Bidirectional GRU
- 1D Convolution feature extraction
- BatchNorm regularization
- Faster than LSTM (~25% speed boost)
- 256 hidden dim, 3-4 layers optimal- 1D CNN pattern extraction (local features)
- BiLSTM temporal modeling (global)
- Dual-branch architecture
- Good balance: speed vs accuracy
- 256 hidden dim, 2-3 layers optimal- Batch Sizes: 96-160 (model'e göre)
- Gradient Accumulation: Memory efficient training
- Mixed Precision: Planlı (şu an FP32)
- DataLoader: 4 workers, pin_memory=True
torch.backends.cudnn.benchmark = True # Auto-tuning
torch.backends.cudnn.deterministic = False # Speed over reproducibility# LSTM: Batch 128, Hidden 384
# GRU: Batch 160, Hidden 256
# CNN: Batch 96, Hidden 256hidden_dim: [256, 384, 512]
n_layers: [3, 4]
dropout: [0.2, 0.3, 0.4]
lr: [3e-4, 5e-4, 1e-3]
batch_size: [96, 128, 160]hidden_dim: [256, 384]
n_layers: [3, 4]
dropout: [0.2, 0.3]
lr: [5e-4, 1e-3]
batch_size: [128, 160]checkpoints/
├── lstm_best_results.json # En iyi LSTM sonuçları
├── gru_best_results.json # En iyi GRU sonuçları
├── cnn_lstm_best_results.json # En iyi CNN-LSTM sonuçları
└── results.json # Son çalıştırılan model
tuning_results/
├── final_results.json # Hyperparameter final
└── interim_results.json # Ara sonuçlar- Accuracy: ±12% eşikli doğruluk oranı
- MSE: Mean Squared Error (düşük = iyi)
- RMSE: Root MSE (yorumlanması kolay)
- MAE: Mean Absolute Error
- R²: Belirleyicilik katsayısı (yüksek = iyi)
- F1: Balanced accuracy metric
--augment # Gaussian noise ekleme (%10 ek veri)--patience 12 # 12 epoch boyunca gelişme yoksa durReduceLROnPlateau # Validation loss platosunda LR azaltmax_norm=1.0 # Gradient explosion önleme# Batch size'ı küçült
--batch 64
# Veya model boyutunu küçült
--hidden_dim 128# Learning rate'i küçült
--lr 1e-4
# Dropout'u artır
--dropout 0.4# Early stopping patience'ı küçült
--patience 8
# Dropout artır
--dropout 0.4
# Data augmentation aktif et
--augment- RTX 3060 Driver: En son NVIDIA driver kurulu olsun
- CUDA 11.8+: PyTorch ile uyumlu CUDA versiyonu
- Hyperparameter Tuning: Sabırla en iyi parametreleri bul
- Data Quality: Temiz, normalize edilmiş veri kullan
- Monitoring: Dashboard ile eğitimi takip et
- Fork edin
- Feature branch oluşturun (
git checkout -b feature/yeni-ozellik) - Commit edin (
git commit -m 'Yeni özellik eklendi') - Push edin (
git push origin feature/yeni-ozellik) - Pull Request açın
Bu proje MIT lisansı altında lisanslanmıştır.
⚡ RTX 3060 ile optimize edilmiş, production-ready enerji tahmini sistemi!