omgkit 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -10
- package/package.json +1 -1
- package/plugin/agents/ai-architect-agent.md +282 -0
- package/plugin/agents/data-scientist-agent.md +221 -0
- package/plugin/agents/experiment-analyst-agent.md +318 -0
- package/plugin/agents/ml-engineer-agent.md +165 -0
- package/plugin/agents/mlops-engineer-agent.md +324 -0
- package/plugin/agents/model-optimizer-agent.md +287 -0
- package/plugin/agents/production-engineer-agent.md +360 -0
- package/plugin/agents/research-scientist-agent.md +274 -0
- package/plugin/commands/omgdata/augment.md +86 -0
- package/plugin/commands/omgdata/collect.md +81 -0
- package/plugin/commands/omgdata/label.md +83 -0
- package/plugin/commands/omgdata/split.md +83 -0
- package/plugin/commands/omgdata/validate.md +76 -0
- package/plugin/commands/omgdata/version.md +85 -0
- package/plugin/commands/omgdeploy/ab.md +94 -0
- package/plugin/commands/omgdeploy/cloud.md +89 -0
- package/plugin/commands/omgdeploy/edge.md +93 -0
- package/plugin/commands/omgdeploy/package.md +91 -0
- package/plugin/commands/omgdeploy/serve.md +92 -0
- package/plugin/commands/omgfeature/embed.md +93 -0
- package/plugin/commands/omgfeature/extract.md +93 -0
- package/plugin/commands/omgfeature/select.md +85 -0
- package/plugin/commands/omgfeature/store.md +97 -0
- package/plugin/commands/omgml/init.md +60 -0
- package/plugin/commands/omgml/status.md +82 -0
- package/plugin/commands/omgops/drift.md +87 -0
- package/plugin/commands/omgops/monitor.md +99 -0
- package/plugin/commands/omgops/pipeline.md +102 -0
- package/plugin/commands/omgops/registry.md +109 -0
- package/plugin/commands/omgops/retrain.md +91 -0
- package/plugin/commands/omgoptim/distill.md +90 -0
- package/plugin/commands/omgoptim/profile.md +92 -0
- package/plugin/commands/omgoptim/prune.md +81 -0
- package/plugin/commands/omgoptim/quantize.md +83 -0
- package/plugin/commands/omgtrain/baseline.md +78 -0
- package/plugin/commands/omgtrain/compare.md +99 -0
- package/plugin/commands/omgtrain/evaluate.md +85 -0
- package/plugin/commands/omgtrain/train.md +81 -0
- package/plugin/commands/omgtrain/tune.md +89 -0
- package/plugin/registry.yaml +252 -2
- package/plugin/skills/ml-systems/SKILL.md +65 -0
- package/plugin/skills/ml-systems/ai-accelerators/SKILL.md +342 -0
- package/plugin/skills/ml-systems/data-eng/SKILL.md +126 -0
- package/plugin/skills/ml-systems/deep-learning-primer/SKILL.md +143 -0
- package/plugin/skills/ml-systems/deployment-paradigms/SKILL.md +148 -0
- package/plugin/skills/ml-systems/dnn-architectures/SKILL.md +128 -0
- package/plugin/skills/ml-systems/edge-deployment/SKILL.md +366 -0
- package/plugin/skills/ml-systems/efficient-ai/SKILL.md +316 -0
- package/plugin/skills/ml-systems/feature-engineering/SKILL.md +151 -0
- package/plugin/skills/ml-systems/ml-frameworks/SKILL.md +187 -0
- package/plugin/skills/ml-systems/ml-serving-optimization/SKILL.md +371 -0
- package/plugin/skills/ml-systems/ml-systems-fundamentals/SKILL.md +103 -0
- package/plugin/skills/ml-systems/ml-workflow/SKILL.md +162 -0
- package/plugin/skills/ml-systems/mlops/SKILL.md +386 -0
- package/plugin/skills/ml-systems/model-deployment/SKILL.md +350 -0
- package/plugin/skills/ml-systems/model-dev/SKILL.md +160 -0
- package/plugin/skills/ml-systems/model-optimization/SKILL.md +339 -0
- package/plugin/skills/ml-systems/robust-ai/SKILL.md +395 -0
- package/plugin/skills/ml-systems/training-data/SKILL.md +152 -0
- package/plugin/workflows/ml-systems/data-preparation-workflow.md +276 -0
- package/plugin/workflows/ml-systems/edge-deployment-workflow.md +413 -0
- package/plugin/workflows/ml-systems/full-ml-lifecycle-workflow.md +405 -0
- package/plugin/workflows/ml-systems/hyperparameter-tuning-workflow.md +352 -0
- package/plugin/workflows/ml-systems/mlops-pipeline-workflow.md +384 -0
- package/plugin/workflows/ml-systems/model-deployment-workflow.md +392 -0
- package/plugin/workflows/ml-systems/model-development-workflow.md +218 -0
- package/plugin/workflows/ml-systems/model-evaluation-workflow.md +416 -0
- package/plugin/workflows/ml-systems/model-optimization-workflow.md +390 -0
- package/plugin/workflows/ml-systems/monitoring-drift-workflow.md +446 -0
- package/plugin/workflows/ml-systems/retraining-workflow.md +401 -0
- package/plugin/workflows/ml-systems/training-pipeline-workflow.md +382 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Model Deployment Workflow
|
|
3
|
+
description: Complete model deployment workflow from packaging to production serving with monitoring and rollback capabilities.
|
|
4
|
+
category: ml-systems
|
|
5
|
+
complexity: medium
|
|
6
|
+
agents:
|
|
7
|
+
- production-engineer-agent
|
|
8
|
+
- mlops-engineer-agent
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Model Deployment Workflow
|
|
12
|
+
|
|
13
|
+
Deploy ML models to production environments.
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
19
|
+
│ MODEL DEPLOYMENT WORKFLOW │
|
|
20
|
+
├─────────────────────────────────────────────────────────────┤
|
|
21
|
+
│ │
|
|
22
|
+
│ 1. PACKAGE 2. STAGE 3. TEST │
|
|
23
|
+
│ ↓ ↓ ↓ │
|
|
24
|
+
│ Containerize Deploy staging Integration tests │
|
|
25
|
+
│ Model archive Config verify Load testing │
|
|
26
|
+
│ Dependencies Health checks Smoke tests │
|
|
27
|
+
│ │
|
|
28
|
+
│ 4. DEPLOY 5. VALIDATE 6. MONITOR │
|
|
29
|
+
│ ↓ ↓ ↓ │
|
|
30
|
+
│ Canary/Blue-green Shadow mode Metrics │
|
|
31
|
+
│ Traffic shift A/B comparison Alerts │
|
|
32
|
+
│ Rollback ready Approval Dashboards │
|
|
33
|
+
│ │
|
|
34
|
+
└─────────────────────────────────────────────────────────────┘
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Steps
|
|
38
|
+
|
|
39
|
+
### Step 1: Package
|
|
40
|
+
**Agent**: production-engineer-agent
|
|
41
|
+
|
|
42
|
+
**Inputs**:
|
|
43
|
+
- Trained model
|
|
44
|
+
- Inference code
|
|
45
|
+
- Dependencies
|
|
46
|
+
|
|
47
|
+
**Actions**:
|
|
48
|
+
```bash
|
|
49
|
+
# Package model
|
|
50
|
+
/omgdeploy:package --model model.pt --handler handler.py --output model-package/
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Dockerfile**:
|
|
54
|
+
```dockerfile
|
|
55
|
+
FROM python:3.10-slim
|
|
56
|
+
|
|
57
|
+
# Install dependencies
|
|
58
|
+
COPY requirements.txt .
|
|
59
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
60
|
+
|
|
61
|
+
# Copy model and code
|
|
62
|
+
COPY model.pt /app/model.pt
|
|
63
|
+
COPY handler.py /app/handler.py
|
|
64
|
+
COPY serve.py /app/serve.py
|
|
65
|
+
|
|
66
|
+
WORKDIR /app
|
|
67
|
+
|
|
68
|
+
# Health check
|
|
69
|
+
HEALTHCHECK --interval=30s --timeout=10s \
|
|
70
|
+
CMD curl -f http://localhost:8000/health || exit 1
|
|
71
|
+
|
|
72
|
+
EXPOSE 8000
|
|
73
|
+
CMD ["python", "serve.py"]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Model Archive (TorchServe)**:
|
|
77
|
+
```bash
|
|
78
|
+
torch-model-archiver \
|
|
79
|
+
--model-name my_model \
|
|
80
|
+
--version 1.0 \
|
|
81
|
+
--serialized-file model.pt \
|
|
82
|
+
--handler handler.py \
|
|
83
|
+
--extra-files config.json \
|
|
84
|
+
--export-path model-store/
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Outputs**:
|
|
88
|
+
- Docker image
|
|
89
|
+
- Model archive
|
|
90
|
+
- Deployment manifests
|
|
91
|
+
|
|
92
|
+
### Step 2: Stage
|
|
93
|
+
**Agent**: mlops-engineer-agent
|
|
94
|
+
|
|
95
|
+
**Inputs**:
|
|
96
|
+
- Packaged model
|
|
97
|
+
- Staging environment config
|
|
98
|
+
- Test data
|
|
99
|
+
|
|
100
|
+
**Actions**:
|
|
101
|
+
```bash
|
|
102
|
+
# Deploy to staging
|
|
103
|
+
/omgdeploy:serve --env staging --config staging.yaml
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Kubernetes Manifest**:
|
|
107
|
+
```yaml
|
|
108
|
+
apiVersion: apps/v1
|
|
109
|
+
kind: Deployment
|
|
110
|
+
metadata:
|
|
111
|
+
name: ml-model-staging
|
|
112
|
+
namespace: ml-staging
|
|
113
|
+
spec:
|
|
114
|
+
replicas: 2
|
|
115
|
+
selector:
|
|
116
|
+
matchLabels:
|
|
117
|
+
app: ml-model
|
|
118
|
+
env: staging
|
|
119
|
+
template:
|
|
120
|
+
metadata:
|
|
121
|
+
labels:
|
|
122
|
+
app: ml-model
|
|
123
|
+
env: staging
|
|
124
|
+
spec:
|
|
125
|
+
containers:
|
|
126
|
+
- name: model
|
|
127
|
+
image: ml-model:v1.0.0
|
|
128
|
+
ports:
|
|
129
|
+
- containerPort: 8000
|
|
130
|
+
resources:
|
|
131
|
+
requests:
|
|
132
|
+
memory: "2Gi"
|
|
133
|
+
cpu: "1"
|
|
134
|
+
limits:
|
|
135
|
+
memory: "4Gi"
|
|
136
|
+
cpu: "2"
|
|
137
|
+
livenessProbe:
|
|
138
|
+
httpGet:
|
|
139
|
+
path: /health
|
|
140
|
+
port: 8000
|
|
141
|
+
initialDelaySeconds: 60
|
|
142
|
+
readinessProbe:
|
|
143
|
+
httpGet:
|
|
144
|
+
path: /ready
|
|
145
|
+
port: 8000
|
|
146
|
+
initialDelaySeconds: 30
|
|
147
|
+
env:
|
|
148
|
+
- name: MODEL_VERSION
|
|
149
|
+
value: "v1.0.0"
|
|
150
|
+
- name: LOG_LEVEL
|
|
151
|
+
value: "INFO"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Outputs**:
|
|
155
|
+
- Staging deployment
|
|
156
|
+
- Health check results
|
|
157
|
+
- Configuration verified
|
|
158
|
+
|
|
159
|
+
### Step 3: Test
|
|
160
|
+
**Agent**: production-engineer-agent
|
|
161
|
+
|
|
162
|
+
**Inputs**:
|
|
163
|
+
- Staging endpoint
|
|
164
|
+
- Test cases
|
|
165
|
+
- Performance requirements
|
|
166
|
+
|
|
167
|
+
**Actions**:
|
|
168
|
+
```python
|
|
169
|
+
# Integration tests
|
|
170
|
+
def test_model_endpoint():
|
|
171
|
+
response = requests.post(
|
|
172
|
+
f"{STAGING_URL}/predict",
|
|
173
|
+
json={"features": [1.0, 2.0, 3.0]}
|
|
174
|
+
)
|
|
175
|
+
assert response.status_code == 200
|
|
176
|
+
assert "prediction" in response.json()
|
|
177
|
+
|
|
178
|
+
# Load testing
|
|
179
|
+
def load_test(endpoint, rps, duration_seconds):
|
|
180
|
+
from locust import HttpUser, task
|
|
181
|
+
|
|
182
|
+
class ModelUser(HttpUser):
|
|
183
|
+
@task
|
|
184
|
+
def predict(self):
|
|
185
|
+
self.client.post("/predict", json={"features": sample_data})
|
|
186
|
+
|
|
187
|
+
# Run with: locust -f load_test.py --headless -u 100 -r 10 -t 60s
|
|
188
|
+
|
|
189
|
+
# Smoke tests
|
|
190
|
+
smoke_tests = [
|
|
191
|
+
{"name": "health_check", "endpoint": "/health", "expected": 200},
|
|
192
|
+
{"name": "prediction", "endpoint": "/predict", "method": "POST", "expected": 200},
|
|
193
|
+
{"name": "batch", "endpoint": "/batch_predict", "method": "POST", "expected": 200},
|
|
194
|
+
]
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Outputs**:
|
|
198
|
+
- Test results
|
|
199
|
+
- Load test metrics
|
|
200
|
+
- Go/No-Go decision
|
|
201
|
+
|
|
202
|
+
### Step 4: Deploy
|
|
203
|
+
**Agent**: mlops-engineer-agent
|
|
204
|
+
|
|
205
|
+
**Inputs**:
|
|
206
|
+
- Tested staging deployment
|
|
207
|
+
- Production config
|
|
208
|
+
- Deployment strategy
|
|
209
|
+
|
|
210
|
+
**Actions**:
|
|
211
|
+
```bash
|
|
212
|
+
# Deploy to production with canary
|
|
213
|
+
/omgdeploy:cloud --env production --strategy canary --percentage 10
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Canary Deployment**:
|
|
217
|
+
```yaml
|
|
218
|
+
apiVersion: argoproj.io/v1alpha1
|
|
219
|
+
kind: Rollout
|
|
220
|
+
metadata:
|
|
221
|
+
name: ml-model
|
|
222
|
+
spec:
|
|
223
|
+
replicas: 10
|
|
224
|
+
strategy:
|
|
225
|
+
canary:
|
|
226
|
+
canaryService: ml-model-canary
|
|
227
|
+
stableService: ml-model-stable
|
|
228
|
+
steps:
|
|
229
|
+
- setWeight: 10
|
|
230
|
+
- pause: {duration: 10m}
|
|
231
|
+
- analysis:
|
|
232
|
+
templates:
|
|
233
|
+
- templateName: success-rate
|
|
234
|
+
- setWeight: 25
|
|
235
|
+
- pause: {duration: 10m}
|
|
236
|
+
- setWeight: 50
|
|
237
|
+
- pause: {duration: 10m}
|
|
238
|
+
- setWeight: 100
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Blue-Green Alternative**:
|
|
242
|
+
```bash
|
|
243
|
+
# Switch traffic
|
|
244
|
+
kubectl patch service ml-model -p '{"spec":{"selector":{"version":"v2"}}}'
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Outputs**:
|
|
248
|
+
- Production deployment
|
|
249
|
+
- Traffic routing
|
|
250
|
+
- Rollback readiness
|
|
251
|
+
|
|
252
|
+
### Step 5: Validate
|
|
253
|
+
**Agent**: experiment-analyst-agent
|
|
254
|
+
|
|
255
|
+
**Inputs**:
|
|
256
|
+
- Production metrics
|
|
257
|
+
- Baseline metrics
|
|
258
|
+
- Validation criteria
|
|
259
|
+
|
|
260
|
+
**Actions**:
|
|
261
|
+
```bash
|
|
262
|
+
# A/B comparison
|
|
263
|
+
/omgdeploy:ab --control v1 --treatment v2 --duration 24h --metric conversion
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
def validate_production(old_version, new_version, duration_hours=24):
|
|
268
|
+
# Collect metrics
|
|
269
|
+
old_metrics = get_metrics(old_version, hours=duration_hours)
|
|
270
|
+
new_metrics = get_metrics(new_version, hours=duration_hours)
|
|
271
|
+
|
|
272
|
+
validation = {
|
|
273
|
+
'latency': {
|
|
274
|
+
'old_p95': old_metrics['latency_p95'],
|
|
275
|
+
'new_p95': new_metrics['latency_p95'],
|
|
276
|
+
'regression': new_metrics['latency_p95'] > old_metrics['latency_p95'] * 1.1
|
|
277
|
+
},
|
|
278
|
+
'accuracy': {
|
|
279
|
+
'old': old_metrics['accuracy'],
|
|
280
|
+
'new': new_metrics['accuracy'],
|
|
281
|
+
'improvement': new_metrics['accuracy'] - old_metrics['accuracy']
|
|
282
|
+
},
|
|
283
|
+
'error_rate': {
|
|
284
|
+
'old': old_metrics['error_rate'],
|
|
285
|
+
'new': new_metrics['error_rate'],
|
|
286
|
+
'acceptable': new_metrics['error_rate'] < 0.01
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
validation['approved'] = (
|
|
291
|
+
not validation['latency']['regression'] and
|
|
292
|
+
validation['accuracy']['improvement'] >= -0.01 and
|
|
293
|
+
validation['error_rate']['acceptable']
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
return validation
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Outputs**:
|
|
300
|
+
- Validation report
|
|
301
|
+
- Comparison metrics
|
|
302
|
+
- Promotion approval
|
|
303
|
+
|
|
304
|
+
### Step 6: Monitor
|
|
305
|
+
**Agent**: mlops-engineer-agent
|
|
306
|
+
|
|
307
|
+
**Inputs**:
|
|
308
|
+
- Production deployment
|
|
309
|
+
- Monitoring config
|
|
310
|
+
- Alert thresholds
|
|
311
|
+
|
|
312
|
+
**Actions**:
|
|
313
|
+
```bash
|
|
314
|
+
# Setup monitoring
|
|
315
|
+
/omgops:monitor --deployment ml-model --config monitoring.yaml
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
```yaml
|
|
319
|
+
# Prometheus alerts
|
|
320
|
+
groups:
|
|
321
|
+
- name: ml-model-alerts
|
|
322
|
+
rules:
|
|
323
|
+
- alert: HighLatency
|
|
324
|
+
expr: histogram_quantile(0.99, model_latency_seconds) > 0.5
|
|
325
|
+
for: 5m
|
|
326
|
+
labels:
|
|
327
|
+
severity: warning
|
|
328
|
+
|
|
329
|
+
- alert: HighErrorRate
|
|
330
|
+
expr: rate(model_errors_total[5m]) / rate(model_requests_total[5m]) > 0.05
|
|
331
|
+
for: 5m
|
|
332
|
+
labels:
|
|
333
|
+
severity: critical
|
|
334
|
+
|
|
335
|
+
- alert: LowThroughput
|
|
336
|
+
expr: rate(model_requests_total[5m]) < 10
|
|
337
|
+
for: 10m
|
|
338
|
+
labels:
|
|
339
|
+
severity: warning
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Grafana Dashboard**:
|
|
343
|
+
```json
|
|
344
|
+
{
|
|
345
|
+
"panels": [
|
|
346
|
+
{"title": "Request Rate", "expr": "rate(model_requests_total[1m])"},
|
|
347
|
+
{"title": "Latency P99", "expr": "histogram_quantile(0.99, model_latency_seconds)"},
|
|
348
|
+
{"title": "Error Rate", "expr": "rate(model_errors_total[5m]) / rate(model_requests_total[5m])"},
|
|
349
|
+
{"title": "Model Version", "expr": "model_version_info"}
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
**Outputs**:
|
|
355
|
+
- Monitoring dashboards
|
|
356
|
+
- Alert configurations
|
|
357
|
+
- Runbooks
|
|
358
|
+
|
|
359
|
+
## Rollback Procedure
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Immediate rollback
|
|
363
|
+
kubectl rollout undo deployment/ml-model
|
|
364
|
+
|
|
365
|
+
# Rollback to specific version
|
|
366
|
+
kubectl rollout undo deployment/ml-model --to-revision=3
|
|
367
|
+
|
|
368
|
+
# Verify rollback
|
|
369
|
+
kubectl rollout status deployment/ml-model
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
## Artifacts
|
|
373
|
+
|
|
374
|
+
- `Dockerfile` - Container definition
|
|
375
|
+
- `k8s/` - Kubernetes manifests
|
|
376
|
+
- `monitoring/` - Dashboards and alerts
|
|
377
|
+
- `runbooks/` - Operational procedures
|
|
378
|
+
- `deployment-log.json` - Deployment history
|
|
379
|
+
|
|
380
|
+
## Next Workflows
|
|
381
|
+
|
|
382
|
+
After deployment:
|
|
383
|
+
- → **monitoring-drift-workflow** for drift detection
|
|
384
|
+
- → **retraining-workflow** for model updates
|
|
385
|
+
|
|
386
|
+
## Quality Gates
|
|
387
|
+
|
|
388
|
+
- [ ] All steps completed successfully
|
|
389
|
+
- [ ] Metrics meet defined thresholds
|
|
390
|
+
- [ ] Documentation updated
|
|
391
|
+
- [ ] Artifacts versioned and stored
|
|
392
|
+
- [ ] Stakeholder approval obtained
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Model Development Workflow
|
|
3
|
+
description: End-to-end model development workflow from problem definition to trained model, including baseline establishment and iterative improvement.
|
|
4
|
+
category: ml-systems
|
|
5
|
+
complexity: medium
|
|
6
|
+
agents:
|
|
7
|
+
- data-scientist-agent
|
|
8
|
+
- research-scientist-agent
|
|
9
|
+
- experiment-analyst-agent
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Model Development Workflow
|
|
13
|
+
|
|
14
|
+
Complete workflow for developing ML models from problem definition to trained model.
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
20
|
+
│ MODEL DEVELOPMENT WORKFLOW │
|
|
21
|
+
├─────────────────────────────────────────────────────────────┤
|
|
22
|
+
│ │
|
|
23
|
+
│ 1. PROBLEM 2. DATA 3. BASELINE │
|
|
24
|
+
│ DEFINITION EXPLORATION MODELS │
|
|
25
|
+
│ ↓ ↓ ↓ │
|
|
26
|
+
│ Define metrics EDA & quality Simple models │
|
|
27
|
+
│ Success criteria Feature dist. Benchmark │
|
|
28
|
+
│ │
|
|
29
|
+
│ 4. FEATURE 5. MODEL 6. VALIDATION │
|
|
30
|
+
│ ENGINEERING TRAINING & SELECTION │
|
|
31
|
+
│ ↓ ↓ ↓ │
|
|
32
|
+
│ Transform data Train models Cross-validate │
|
|
33
|
+
│ Create features Tune hyperparams Select best │
|
|
34
|
+
│ │
|
|
35
|
+
└─────────────────────────────────────────────────────────────┘
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Steps
|
|
39
|
+
|
|
40
|
+
### Step 1: Problem Definition
|
|
41
|
+
**Agent**: data-scientist-agent
|
|
42
|
+
|
|
43
|
+
**Inputs**:
|
|
44
|
+
- Business requirements
|
|
45
|
+
- Available data sources
|
|
46
|
+
- Constraints (latency, cost, etc.)
|
|
47
|
+
|
|
48
|
+
**Actions**:
|
|
49
|
+
```bash
|
|
50
|
+
# Initialize project structure
|
|
51
|
+
/omgml:init <project_name> --template classification|regression|ranking
|
|
52
|
+
|
|
53
|
+
# Define success metrics
|
|
54
|
+
# Create experiment tracking
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Outputs**:
|
|
58
|
+
- Clear problem statement
|
|
59
|
+
- Success metrics defined
|
|
60
|
+
- Baseline criteria established
|
|
61
|
+
|
|
62
|
+
### Step 2: Data Exploration
|
|
63
|
+
**Agent**: data-scientist-agent
|
|
64
|
+
|
|
65
|
+
**Inputs**:
|
|
66
|
+
- Raw datasets
|
|
67
|
+
- Data dictionaries
|
|
68
|
+
|
|
69
|
+
**Actions**:
|
|
70
|
+
```bash
|
|
71
|
+
# Validate data quality
|
|
72
|
+
/omgdata:validate --schema schema.yaml --data data.csv
|
|
73
|
+
|
|
74
|
+
# Exploratory analysis
|
|
75
|
+
# - Distribution analysis
|
|
76
|
+
# - Missing value patterns
|
|
77
|
+
# - Correlation analysis
|
|
78
|
+
# - Target variable analysis
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Outputs**:
|
|
82
|
+
- Data quality report
|
|
83
|
+
- Feature distributions
|
|
84
|
+
- Initial insights
|
|
85
|
+
- Data cleaning requirements
|
|
86
|
+
|
|
87
|
+
### Step 3: Baseline Models
|
|
88
|
+
**Agent**: data-scientist-agent, experiment-analyst-agent
|
|
89
|
+
|
|
90
|
+
**Inputs**:
|
|
91
|
+
- Cleaned dataset
|
|
92
|
+
- Target variable
|
|
93
|
+
|
|
94
|
+
**Actions**:
|
|
95
|
+
```bash
|
|
96
|
+
# Train baseline models
|
|
97
|
+
/omgtrain:baseline --data data.csv --target target_column
|
|
98
|
+
|
|
99
|
+
# Establishes benchmarks with:
|
|
100
|
+
# - Dummy classifiers (majority, random, stratified)
|
|
101
|
+
# - Simple models (logistic regression, decision tree)
|
|
102
|
+
# - Basic feature set
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Outputs**:
|
|
106
|
+
- Baseline performance metrics
|
|
107
|
+
- Simple model benchmarks
|
|
108
|
+
- Performance floor established
|
|
109
|
+
|
|
110
|
+
### Step 4: Feature Engineering
|
|
111
|
+
**Agent**: data-scientist-agent
|
|
112
|
+
|
|
113
|
+
**Inputs**:
|
|
114
|
+
- Data exploration insights
|
|
115
|
+
- Domain knowledge
|
|
116
|
+
- Baseline results
|
|
117
|
+
|
|
118
|
+
**Actions**:
|
|
119
|
+
```bash
|
|
120
|
+
# Extract features
|
|
121
|
+
/omgfeature:extract --input data.csv --output features/
|
|
122
|
+
|
|
123
|
+
# Feature selection
|
|
124
|
+
/omgfeature:select --method mutual_info --k 50
|
|
125
|
+
|
|
126
|
+
# Store features
|
|
127
|
+
/omgfeature:store --name project_features
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Outputs**:
|
|
131
|
+
- Engineered features
|
|
132
|
+
- Feature importance rankings
|
|
133
|
+
- Feature store entries
|
|
134
|
+
|
|
135
|
+
### Step 5: Model Training
|
|
136
|
+
**Agent**: research-scientist-agent
|
|
137
|
+
|
|
138
|
+
**Inputs**:
|
|
139
|
+
- Engineered features
|
|
140
|
+
- Target variable
|
|
141
|
+
- Baseline performance
|
|
142
|
+
|
|
143
|
+
**Actions**:
|
|
144
|
+
```bash
|
|
145
|
+
# Train models
|
|
146
|
+
/omgtrain:train --config configs/experiment.yaml
|
|
147
|
+
|
|
148
|
+
# Hyperparameter tuning
|
|
149
|
+
/omgtrain:tune --model xgboost --trials 100
|
|
150
|
+
|
|
151
|
+
# Compare results
|
|
152
|
+
/omgtrain:compare --experiments exp1,exp2,exp3
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Outputs**:
|
|
156
|
+
- Trained models
|
|
157
|
+
- Experiment logs
|
|
158
|
+
- Performance metrics
|
|
159
|
+
|
|
160
|
+
### Step 6: Validation & Selection
|
|
161
|
+
**Agent**: experiment-analyst-agent
|
|
162
|
+
|
|
163
|
+
**Inputs**:
|
|
164
|
+
- All trained models
|
|
165
|
+
- Validation dataset
|
|
166
|
+
- Business requirements
|
|
167
|
+
|
|
168
|
+
**Actions**:
|
|
169
|
+
```bash
|
|
170
|
+
# Comprehensive evaluation
|
|
171
|
+
/omgtrain:evaluate --model best_model.pt --data test.csv
|
|
172
|
+
|
|
173
|
+
# Analysis includes:
|
|
174
|
+
# - Cross-validation scores
|
|
175
|
+
# - Holdout test performance
|
|
176
|
+
# - Error analysis
|
|
177
|
+
# - Fairness assessment
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Outputs**:
|
|
181
|
+
- Final model selection
|
|
182
|
+
- Performance report
|
|
183
|
+
- Model documentation
|
|
184
|
+
- Registered model in registry
|
|
185
|
+
|
|
186
|
+
## Checkpoints
|
|
187
|
+
|
|
188
|
+
| Phase | Checkpoint | Criteria |
|
|
189
|
+
|-------|------------|----------|
|
|
190
|
+
| 1 | Problem defined | Clear metrics, success criteria |
|
|
191
|
+
| 2 | Data validated | Quality checks pass, no blockers |
|
|
192
|
+
| 3 | Baseline established | Simple models trained and logged |
|
|
193
|
+
| 4 | Features ready | Feature set defined, stored |
|
|
194
|
+
| 5 | Models trained | Multiple experiments complete |
|
|
195
|
+
| 6 | Model selected | Best model meets criteria |
|
|
196
|
+
|
|
197
|
+
## Artifacts
|
|
198
|
+
|
|
199
|
+
- `configs/experiment.yaml` - Experiment configuration
|
|
200
|
+
- `features/` - Engineered features
|
|
201
|
+
- `models/` - Trained model artifacts
|
|
202
|
+
- `reports/` - Analysis reports
|
|
203
|
+
- `mlflow/` - Experiment tracking data
|
|
204
|
+
|
|
205
|
+
## Next Workflows
|
|
206
|
+
|
|
207
|
+
After completing model development:
|
|
208
|
+
- → **model-evaluation-workflow** for detailed evaluation
|
|
209
|
+
- → **model-optimization-workflow** for performance optimization
|
|
210
|
+
- → **model-deployment-workflow** for production deployment
|
|
211
|
+
|
|
212
|
+
## Quality Gates
|
|
213
|
+
|
|
214
|
+
- [ ] All steps completed successfully
|
|
215
|
+
- [ ] Metrics meet defined thresholds
|
|
216
|
+
- [ ] Documentation updated
|
|
217
|
+
- [ ] Artifacts versioned and stored
|
|
218
|
+
- [ ] Stakeholder approval obtained
|