Keras
Build, train, and debug deep learning models with Keras patterns, layer recipes, and training diagnostics.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/ivangdavila/kerasSetup
On first use, check setup.md for integration guidelines. The skill stores preferences in ~/keras/ when the user confirms.
When to Use
User builds neural networks with Keras or TensorFlow. Agent handles model architecture, layer configuration, training loops, callbacks, debugging loss issues, and deployment preparation.
Architecture
Memory lives in ~/keras/. See memory-template.md for setup.
~/keras/
├── memory.md # Preferred architectures, hyperparams
└── models/ # Saved model configs (optional)
Quick Reference
| Topic | File |
|---|---|
| Setup process | setup.md |
| Memory template | memory-template.md |
| Layer patterns | layers.md |
| Training diagnostics | training.md |
| Common architectures | architectures.md |
Core Rules
1. Sequential vs Functional API
- Sequential: simple stacks, no branching
- Functional: multi-input/output, skip connections, shared layers
- Subclassing: custom forward pass, dynamic architectures
# Sequential - simple stack
model = keras.Sequential([
layers.Dense(64, activation='relu'),
layers.Dense(10, activation='softmax')
])
# Functional - flexible graphs
inputs = keras.Input(shape=(784,))
x = layers.Dense(64, activation='relu')(inputs)
outputs = layers.Dense(10, activation='softmax')(x)
model = keras.Model(inputs, outputs)
2. Input Shape Patterns
- First layer needs
input_shape(exclude batch) - Images:
(height, width, channels)for channels_last - Sequences:
(timesteps, features) - Tabular:
(features,)
# Image input
layers.Conv2D(32, 3, input_shape=(224, 224, 3))
# Sequence input
layers.LSTM(64, input_shape=(100, 50)) # 100 timesteps, 50 features
# Tabular input
layers.Dense(64, input_shape=(20,)) # 20 features
3. Activation Functions
| Task | Output Activation | Loss |
|---|---|---|
| Binary classification | sigmoid | binary_crossentropy |
| Multi-class | softmax | categorical_crossentropy |
| Multi-label | sigmoid | binary_crossentropy |
| Regression | linear (none) | mse or mae |
4. Regularization Stack
Apply in this order for overfitting:
- Dropout - after dense/conv layers (0.2-0.5)
- BatchNorm - before or after activation
- L2 regularization - in layer (0.01-0.001)
- Early stopping - callback with patience
layers.Dense(64, activation='relu', kernel_regularizer=keras.regularizers.l2(0.01))
layers.Dropout(0.3)
layers.BatchNormalization()
5. Callbacks Essentials
callbacks = [
keras.callbacks.EarlyStopping(
monitor='val_loss', patience=5, restore_best_weights=True
),
keras.callbacks.ModelCheckpoint(
'best_model.keras', save_best_only=True
),
keras.callbacks.ReduceLROnPlateau(
monitor='val_loss', factor=0.5, patience=3
),
keras.callbacks.TensorBoard(log_dir='./logs')
]
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-ivangdavila-keras": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
Animations
Create performant web animations with proper accessibility and timing.
Arduino
Develop Arduino projects avoiding common wiring, power, and code pitfalls.
Bulgarian
Write Bulgarian that sounds human. Not formal, not robotic, not AI-generated.
Arabic
Write Arabic that sounds human. Not formal, not robotic, not AI-generated.
Assistant
Manage tasks, communications, and scheduling with proactive and organized support.