
Deep Learning
- 20 installs
- 4 repo stars
- Updated January 5, 2026
- pluginagentmarketplace/custom-plugin-ai-data-scientist
Helps with ai & agent building tasks.
About
deep-learning is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- deep-learning
- AI & Agent Building
- AI-coding skill
Deep Learning by the numbers
- 20 all-time installs (skills.sh)
- Ranked #10,459 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-ai-data-scientist --skill deep-learningAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 20 |
|---|---|
| repo stars | ★ 4 |
| Last updated | January 5, 2026 |
| Repository | pluginagentmarketplace/custom-plugin-ai-data-scientist ↗ |
What it does
Helps with ai & agent building tasks.
Files
Deep Learning
Build neural networks for computer vision, NLP, and complex data patterns.
Quick Start with PyTorch
import torch
import torch.nn as nn
import torch.optim as optim
# Define model
class NeuralNet(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNet, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.relu = nn.ReLU()
self.fc2 = nn.Linear(hidden_size, num_classes)
def forward(self, x):
out = self.fc1(x)
out = self.relu(out)
out = self.fc2(out)
return out
# Initialize
model = NeuralNet(input_size=784, hidden_size=128, num_classes=10)
criterion = nn.CrossEntropyLoss()
optimizer = optim.Adam(model.parameters(), lr=0.001)
# Training loop
for epoch in range(10):
for images, labels in train_loader:
# Forward pass
outputs = model(images)
loss = criterion(outputs, labels)
# Backward and optimize
optimizer.zero_grad()
loss.backward()
optimizer.step()CNN for Image Classification
class CNN(nn.Module):
def __init__(self, num_classes=10):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(3, 32, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(32, 64, kernel_size=3, padding=1)
self.pool = nn.MaxPool2d(2, 2)
self.fc1 = nn.Linear(64 * 8 * 8, 512)
self.fc2 = nn.Linear(512, num_classes)
self.dropout = nn.Dropout(0.5)
def forward(self, x):
x = self.pool(F.relu(self.conv1(x)))
x = self.pool(F.relu(self.conv2(x)))
x = x.view(-1, 64 * 8 * 8)
x = F.relu(self.fc1(x))
x = self.dropout(x)
x = self.fc2(x)
return xTransfer Learning
import torchvision.models as models
# Load pre-trained ResNet
model = models.resnet50(pretrained=True)
# Freeze layers
for param in model.parameters():
param.requires_grad = False
# Replace final layer
num_features = model.fc.in_features
model.fc = nn.Linear(num_features, num_classes)
# Only train final layer
optimizer = optim.Adam(model.fc.parameters(), lr=0.001)LSTM for Sequences
class LSTMModel(nn.Module):
def __init__(self, input_size, hidden_size, num_layers, output_size):
super(LSTMModel, self).__init__()
self.hidden_size = hidden_size
self.num_layers = num_layers
self.lstm = nn.LSTM(input_size, hidden_size, num_layers,
batch_first=True, dropout=0.2)
self.fc = nn.Linear(hidden_size, output_size)
def forward(self, x):
h0 = torch.zeros(self.num_layers, x.size(0), self.hidden_size)
c0 = torch.zeros(self.num_layers, x.size(0), self.hidden_size)
out, _ = self.lstm(x, (h0, c0))
out = self.fc(out[:, -1, :])
return outTransformers with Hugging Face
from transformers import AutoModelForSequenceClassification, Trainer, TrainingArguments
model = AutoModelForSequenceClassification.from_pretrained(
'bert-base-uncased',
num_labels=2
)
training_args = TrainingArguments(
output_dir='./results',
num_train_epochs=3,
per_device_train_batch_size=16,
warmup_steps=500,
weight_decay=0.01,
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=train_dataset,
eval_dataset=eval_dataset
)
trainer.train()Tips & Tricks
Regularization:
- Dropout:
nn.Dropout(0.5) - Batch Normalization:
nn.BatchNorm2d(channels) - Weight Decay:
optimizer = optim.Adam(params, weight_decay=0.01) - Early Stopping: Monitor validation loss
Optimization:
- Learning Rate Scheduling:
scheduler = optim.lr_scheduler.StepLR(optimizer, step_size=30, gamma=0.1)- Gradient Clipping:
torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)Data Augmentation:
from torchvision import transforms
transform = transforms.Compose([
transforms.RandomHorizontalFlip(),
transforms.RandomRotation(10),
transforms.ColorJitter(brightness=0.2, contrast=0.2),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])Common Issues
Overfitting:
- Add dropout
- Data augmentation
- Early stopping
- Reduce model complexity
Underfitting:
- Increase model capacity
- Train longer
- Reduce regularization
- Better features
Vanishing Gradients:
- Use ReLU activation
- Batch normalization
- Residual connections
- Proper initialization
# Deep Learning Neural Network Configuration Template
# Use this template to configure neural network architectures
# Model Architecture Configuration
model:
name: "custom_neural_network"
type: "sequential" # sequential, functional, or subclass
# Input Configuration
input:
shape: [224, 224, 3] # For image classification
dtype: "float32"
preprocessing:
normalize: true
augment: true
# Layer Definitions
layers:
# Convolutional Block 1
- type: "Conv2D"
filters: 32
kernel_size: [3, 3]
activation: "relu"
padding: "same"
- type: "BatchNormalization"
- type: "MaxPooling2D"
pool_size: [2, 2]
- type: "Dropout"
rate: 0.25
# Convolutional Block 2
- type: "Conv2D"
filters: 64
kernel_size: [3, 3]
activation: "relu"
padding: "same"
- type: "BatchNormalization"
- type: "MaxPooling2D"
pool_size: [2, 2]
- type: "Dropout"
rate: 0.25
# Convolutional Block 3
- type: "Conv2D"
filters: 128
kernel_size: [3, 3]
activation: "relu"
padding: "same"
- type: "BatchNormalization"
- type: "MaxPooling2D"
pool_size: [2, 2]
- type: "Dropout"
rate: 0.25
# Dense Layers
- type: "Flatten"
- type: "Dense"
units: 512
activation: "relu"
- type: "BatchNormalization"
- type: "Dropout"
rate: 0.5
- type: "Dense"
units: 10 # Number of classes
activation: "softmax"
# Training Configuration
training:
optimizer:
name: "adam"
learning_rate: 0.001
beta_1: 0.9
beta_2: 0.999
epsilon: 1e-07
loss: "categorical_crossentropy"
metrics:
- "accuracy"
- "precision"
- "recall"
- "f1_score"
batch_size: 32
epochs: 100
# Learning Rate Schedule
lr_schedule:
type: "reduce_on_plateau"
factor: 0.5
patience: 5
min_lr: 1e-7
# Early Stopping
early_stopping:
monitor: "val_loss"
patience: 10
restore_best_weights: true
# Checkpointing
checkpoint:
filepath: "models/best_model.h5"
monitor: "val_accuracy"
save_best_only: true
mode: "max"
# Data Augmentation
augmentation:
enabled: true
params:
rotation_range: 20
width_shift_range: 0.2
height_shift_range: 0.2
horizontal_flip: true
vertical_flip: false
zoom_range: 0.2
shear_range: 0.2
fill_mode: "nearest"
# Hardware Configuration
hardware:
device: "auto" # auto, cpu, gpu
mixed_precision: true
multi_gpu: false
num_workers: 4
# Logging and Monitoring
logging:
tensorboard:
enabled: true
log_dir: "logs/tensorboard"
wandb:
enabled: false
project: "deep-learning-project"
mlflow:
enabled: true
tracking_uri: "mlruns"
Deep Learning Assets
Configuration Templates
neural_network_config.yaml
Complete configuration template for defining neural network architectures including:
- Model architecture definition (layers, activations)
- Training hyperparameters (optimizer, loss, metrics)
- Data augmentation settings
- Hardware configuration (GPU, mixed precision)
- Logging and monitoring setup (TensorBoard, MLflow, W&B)
Usage
import yaml
with open('neural_network_config.yaml', 'r') as f:
config = yaml.safe_load(f)
# Access model configuration
model_layers = config['model']['layers']
training_params = config['training']Customization
1. Copy the template to your project 2. Modify layer definitions for your architecture 3. Adjust training hyperparameters 4. Configure hardware settings for your environment
Deep Learning Architecture Guide
Neural Network Architectures Decision Tree
START: What type of data?
│
├─► Tabular Data
│ └─► MLP (Multi-Layer Perceptron)
│ • 2-5 hidden layers
│ • ReLU activation
│ • Dropout for regularization
│
├─► Image Data
│ ├─► Classification → CNN Architectures
│ │ ├─► Small dataset → Transfer Learning (ResNet, EfficientNet)
│ │ ├─► Medium dataset → Custom CNN or Fine-tuned pretrained
│ │ └─► Large dataset → Train from scratch or Vision Transformer
│ │
│ ├─► Object Detection
│ │ ├─► Real-time → YOLO, SSD
│ │ └─► High accuracy → Faster R-CNN, Mask R-CNN
│ │
│ └─► Segmentation
│ ├─► Semantic → U-Net, DeepLab
│ └─► Instance → Mask R-CNN
│
├─► Sequential Data (Time Series, Text)
│ ├─► Short sequences → 1D CNN
│ ├─► Long sequences → LSTM, GRU
│ └─► Attention needed → Transformer
│
├─► Text Data (NLP)
│ ├─► Classification → BERT, RoBERTa
│ ├─► Generation → GPT, T5
│ └─► Embeddings → Word2Vec, FastText, Sentence-BERT
│
└─► Graph Data
└─► GNN (Graph Neural Networks)
├─► Node classification → GCN, GAT
└─► Graph classification → Graph-level poolingArchitecture Comparison Table
| Architecture | Best For | Params | Training Time | Accuracy |
|---|---|---|---|---|
| ResNet-50 | General image tasks | 25M | Medium | High |
| EfficientNet-B0 | Mobile/Edge | 5.3M | Fast | High |
| VGG-16 | Feature extraction | 138M | Slow | Good |
| MobileNetV3 | Mobile deployment | 5.4M | Fast | Good |
| ViT-Base | Large datasets | 86M | Slow | Very High |
| BERT-Base | NLP tasks | 110M | Slow | Very High |
| GPT-2 | Text generation | 1.5B | Very Slow | Very High |
Layer Selection Guide
Activation Functions
| Function | Use Case | Pros | Cons |
|---|---|---|---|
| ReLU | Hidden layers (default) | Fast, no vanishing gradient | Dead neurons |
| LeakyReLU | Alternative to ReLU | No dead neurons | Slightly slower |
| GELU | Transformers | Smooth, better gradients | Computationally expensive |
| Sigmoid | Binary output | Bounded (0,1) | Vanishing gradient |
| Softmax | Multi-class output | Probability distribution | Numerical instability |
| Tanh | RNN hidden states | Bounded (-1,1) | Vanishing gradient |
Regularization Techniques
Technique │ When to Use │ Typical Values
────────────────┼────────────────────────────────┼─────────────────
Dropout │ Fully connected layers │ 0.2-0.5
L2 (Weight Dec) │ Always recommended │ 1e-4 to 1e-2
Batch Norm │ After conv/dense, before act │ momentum=0.99
Layer Norm │ Transformers, RNNs │ eps=1e-6
Data Augment │ Limited training data │ Task-specific
Early Stopping │ Prevent overfitting │ patience=5-10Transfer Learning Strategy
# Strategy Selection Based on Dataset Size
Dataset Size vs Domain Similarity Matrix:
│ Similar Domain │ Different Domain
────────────────────┼────────────────┼──────────────────
Small Dataset │ Fine-tune │ Fine-tune deeper
(< 1K samples) │ top layers │ layers + augment
────────────────────┼────────────────┼──────────────────
Medium Dataset │ Fine-tune │ Fine-tune all
(1K - 10K samples) │ all layers │ with low LR
────────────────────┼────────────────┼──────────────────
Large Dataset │ Fine-tune or │ Train from
(> 10K samples) │ train scratch │ scratchHyperparameter Guidelines
Learning Rate
Model Type │ Initial LR │ Schedule
────────────────────┼─────────────────┼──────────────────
CNN from scratch │ 0.001 - 0.01 │ StepLR or Cosine
Fine-tuning │ 0.0001 - 0.001 │ ReduceOnPlateau
Transformers │ 1e-5 - 5e-5 │ Linear warmup
GANs │ 0.0001 - 0.0002 │ Fixed or decayBatch Size
Memory Available │ Recommended Batch Size
────────────────────┼─────────────────────────
8 GB GPU │ 16 - 32 (images)
16 GB GPU │ 32 - 64 (images)
24+ GB GPU │ 64 - 128 (images)
Gradient Accum │ Effective batch = batch × accum_stepsCommon Mistakes and Solutions
| Mistake | Symptom | Solution |
|---|---|---|
| Too high LR | Loss explodes/oscillates | Reduce LR by 10x |
| Too low LR | Very slow convergence | Increase LR, use scheduler |
| No normalization | Unstable training | Add BatchNorm/LayerNorm |
| Too deep network | Vanishing gradients | Add skip connections |
| Small dataset | Overfitting | Augmentation, transfer learning |
| Wrong initialization | Dead/saturated neurons | Use He/Xavier init |
Model Debugging Checklist
□ Data pipeline verified (visualize samples)
□ Model can overfit single batch
□ Gradients flowing (not NaN or zero)
□ Learning rate appropriate (loss decreasing)
□ Validation metrics improving
□ No data leakage (train/val properly split)
□ Augmentation not too aggressive
□ Class imbalance addressedReferences
#!/usr/bin/env python3
"""
Deep Learning Training Script
Supports PyTorch and TensorFlow/Keras frameworks
"""
import os
import yaml
import argparse
from pathlib import Path
from datetime import datetime
def load_config(config_path: str) -> dict:
"""Load YAML configuration file."""
with open(config_path, 'r') as f:
return yaml.safe_load(f)
def create_pytorch_model(config: dict):
"""Create PyTorch neural network from config."""
import torch
import torch.nn as nn
class DynamicNet(nn.Module):
def __init__(self, layer_configs):
super().__init__()
self.layers = nn.ModuleList()
for layer_cfg in layer_configs:
layer_type = layer_cfg['type']
if layer_type == 'Conv2D':
self.layers.append(nn.Conv2d(
in_channels=layer_cfg.get('in_channels', 3),
out_channels=layer_cfg['filters'],
kernel_size=tuple(layer_cfg['kernel_size']),
padding=layer_cfg.get('padding', 'same')
))
if layer_cfg.get('activation') == 'relu':
self.layers.append(nn.ReLU())
elif layer_type == 'BatchNormalization':
# Batch norm channels inferred from previous conv
self.layers.append(nn.BatchNorm2d(layer_cfg.get('num_features', 64)))
elif layer_type == 'MaxPooling2D':
self.layers.append(nn.MaxPool2d(
kernel_size=tuple(layer_cfg['pool_size'])
))
elif layer_type == 'Dropout':
self.layers.append(nn.Dropout(layer_cfg['rate']))
elif layer_type == 'Flatten':
self.layers.append(nn.Flatten())
elif layer_type == 'Dense':
self.layers.append(nn.Linear(
in_features=layer_cfg.get('in_features', 512),
out_features=layer_cfg['units']
))
if layer_cfg.get('activation') == 'relu':
self.layers.append(nn.ReLU())
elif layer_cfg.get('activation') == 'softmax':
self.layers.append(nn.Softmax(dim=1))
def forward(self, x):
for layer in self.layers:
x = layer(x)
return x
return DynamicNet(config['model']['layers'])
def create_keras_model(config: dict):
"""Create Keras/TensorFlow model from config."""
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
model = keras.Sequential()
input_shape = tuple(config['model']['input']['shape'])
first_layer = True
for layer_cfg in config['model']['layers']:
layer_type = layer_cfg['type']
if layer_type == 'Conv2D':
kwargs = {
'filters': layer_cfg['filters'],
'kernel_size': tuple(layer_cfg['kernel_size']),
'activation': layer_cfg.get('activation'),
'padding': layer_cfg.get('padding', 'valid')
}
if first_layer:
kwargs['input_shape'] = input_shape
first_layer = False
model.add(layers.Conv2D(**kwargs))
elif layer_type == 'BatchNormalization':
model.add(layers.BatchNormalization())
elif layer_type == 'MaxPooling2D':
model.add(layers.MaxPooling2D(pool_size=tuple(layer_cfg['pool_size'])))
elif layer_type == 'Dropout':
model.add(layers.Dropout(layer_cfg['rate']))
elif layer_type == 'Flatten':
model.add(layers.Flatten())
elif layer_type == 'Dense':
model.add(layers.Dense(
units=layer_cfg['units'],
activation=layer_cfg.get('activation')
))
return model
def train_pytorch(model, train_loader, val_loader, config: dict):
"""Train PyTorch model."""
import torch
import torch.nn as nn
import torch.optim as optim
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device)
# Setup optimizer
opt_config = config['training']['optimizer']
optimizer = optim.Adam(
model.parameters(),
lr=opt_config['learning_rate'],
betas=(opt_config['beta_1'], opt_config['beta_2']),
eps=opt_config['epsilon']
)
# Loss function
criterion = nn.CrossEntropyLoss()
# Training loop
epochs = config['training']['epochs']
best_val_loss = float('inf')
patience_counter = 0
for epoch in range(epochs):
model.train()
train_loss = 0.0
for batch_idx, (data, target) in enumerate(train_loader):
data, target = data.to(device), target.to(device)
optimizer.zero_grad()
output = model(data)
loss = criterion(output, target)
loss.backward()
optimizer.step()
train_loss += loss.item()
# Validation
model.eval()
val_loss = 0.0
correct = 0
with torch.no_grad():
for data, target in val_loader:
data, target = data.to(device), target.to(device)
output = model(data)
val_loss += criterion(output, target).item()
pred = output.argmax(dim=1, keepdim=True)
correct += pred.eq(target.view_as(pred)).sum().item()
val_loss /= len(val_loader)
accuracy = 100. * correct / len(val_loader.dataset)
print(f'Epoch {epoch+1}/{epochs}')
print(f' Train Loss: {train_loss/len(train_loader):.4f}')
print(f' Val Loss: {val_loss:.4f}, Accuracy: {accuracy:.2f}%')
# Early stopping
if val_loss < best_val_loss:
best_val_loss = val_loss
patience_counter = 0
torch.save(model.state_dict(), 'best_model.pt')
else:
patience_counter += 1
if patience_counter >= config['training']['early_stopping']['patience']:
print(f'Early stopping at epoch {epoch+1}')
break
return model
def train_keras(model, train_data, val_data, config: dict):
"""Train Keras/TensorFlow model."""
from tensorflow import keras
# Compile model
opt_config = config['training']['optimizer']
optimizer = keras.optimizers.Adam(
learning_rate=opt_config['learning_rate'],
beta_1=opt_config['beta_1'],
beta_2=opt_config['beta_2'],
epsilon=opt_config['epsilon']
)
model.compile(
optimizer=optimizer,
loss=config['training']['loss'],
metrics=config['training']['metrics'][:2] # accuracy, precision
)
# Callbacks
callbacks = []
# Early stopping
es_config = config['training']['early_stopping']
callbacks.append(keras.callbacks.EarlyStopping(
monitor=es_config['monitor'],
patience=es_config['patience'],
restore_best_weights=es_config['restore_best_weights']
))
# Learning rate reduction
lr_config = config['training']['lr_schedule']
callbacks.append(keras.callbacks.ReduceLROnPlateau(
monitor='val_loss',
factor=lr_config['factor'],
patience=lr_config['patience'],
min_lr=lr_config['min_lr']
))
# Model checkpoint
ckpt_config = config['training']['checkpoint']
os.makedirs(os.path.dirname(ckpt_config['filepath']), exist_ok=True)
callbacks.append(keras.callbacks.ModelCheckpoint(
filepath=ckpt_config['filepath'],
monitor=ckpt_config['monitor'],
save_best_only=ckpt_config['save_best_only'],
mode=ckpt_config['mode']
))
# Train
history = model.fit(
train_data,
validation_data=val_data,
epochs=config['training']['epochs'],
batch_size=config['training']['batch_size'],
callbacks=callbacks
)
return model, history
def main():
parser = argparse.ArgumentParser(description='Train Deep Learning Model')
parser.add_argument('--config', type=str, required=True, help='Path to config YAML')
parser.add_argument('--framework', type=str, default='keras',
choices=['pytorch', 'keras'], help='DL framework')
parser.add_argument('--data-dir', type=str, default='data', help='Data directory')
parser.add_argument('--output-dir', type=str, default='outputs', help='Output directory')
args = parser.parse_args()
# Load configuration
config = load_config(args.config)
print(f"Loaded configuration from {args.config}")
# Create output directory
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
output_dir = Path(args.output_dir) / timestamp
output_dir.mkdir(parents=True, exist_ok=True)
print(f"\n{'='*50}")
print(f"Deep Learning Training Pipeline")
print(f"Framework: {args.framework.upper()}")
print(f"Model: {config['model']['name']}")
print(f"Output: {output_dir}")
print(f"{'='*50}\n")
if args.framework == 'pytorch':
model = create_pytorch_model(config)
print(f"Created PyTorch model")
# Note: Add data loading logic for your specific use case
print("Training with PyTorch...")
else:
model = create_keras_model(config)
model.summary()
print("Training with Keras/TensorFlow...")
print("\n[SUCCESS] Training pipeline initialized!")
print(f"Epochs: {config['training']['epochs']}")
print(f"Batch Size: {config['training']['batch_size']}")
print(f"Learning Rate: {config['training']['optimizer']['learning_rate']}")
if __name__ == '__main__':
main()