agentdb 2.0.0-alpha.1 → 2.0.0-alpha.2
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/dist/agentdb.min.js +4 -4
- package/dist/simulation/cli.js +0 -0
- package/dist/src/cli/lib/config-manager.d.ts.map +1 -1
- package/dist/src/cli/lib/config-manager.js.map +1 -1
- package/dist/src/cli/lib/history-tracker.d.ts.map +1 -1
- package/dist/src/cli/lib/history-tracker.js +7 -1
- package/dist/src/cli/lib/history-tracker.js.map +1 -1
- package/examples/README.md +105 -0
- package/examples/quickstart.js +43 -0
- package/package.json +6 -2
- package/simulation/.claude-flow/metrics/agent-metrics.json +1 -0
- package/simulation/.claude-flow/metrics/performance.json +87 -0
- package/simulation/.claude-flow/metrics/task-metrics.json +10 -0
- package/simulation/COMPLETION-STATUS.md +139 -0
- package/simulation/FINAL-RESULTS.md +414 -0
- package/simulation/FINAL-STATUS.md +281 -0
- package/simulation/INTEGRATION-COMPLETE.md +452 -0
- package/simulation/MIGRATION-STATUS.md +231 -0
- package/simulation/OPTIMIZATION-RESULTS.md +397 -0
- package/simulation/PHASE1-COMPLETE.md +163 -0
- package/simulation/README.md +848 -0
- package/simulation/SIMULATION-RESULTS.md +239 -0
- package/simulation/cli.ts +78 -0
- package/simulation/configs/default.json +37 -0
- package/simulation/data/advanced/aidefence.graph +0 -0
- package/simulation/data/advanced/bmssp.graph +0 -0
- package/simulation/data/advanced/consciousness.graph +0 -0
- package/simulation/data/advanced/goalie.graph +0 -0
- package/simulation/data/advanced/psycho-symbolic.graph +0 -0
- package/simulation/data/advanced/research-swarm.graph +0 -0
- package/simulation/data/advanced/sublinear.graph +0 -0
- package/simulation/data/advanced/temporal.graph +0 -0
- package/simulation/data/causal.graph +0 -0
- package/simulation/data/graph-traversal.graph +0 -0
- package/simulation/data/lean-agentic.graph +0 -0
- package/simulation/data/reflexion.graph +0 -0
- package/simulation/data/skills.graph +0 -0
- package/simulation/data/stock-market.graph +0 -0
- package/simulation/data/strange-loops.graph +0 -0
- package/simulation/data/swarm.graph +0 -0
- package/simulation/data/voting-consensus.graph +0 -0
- package/simulation/docs/CLI-INTEGRATION-PLAN.md +1038 -0
- package/simulation/docs/COMPREHENSIVE-LATENT-SPACE-COMPLETION.md +354 -0
- package/simulation/docs/DOCUMENTATION-INDEX.md +226 -0
- package/simulation/docs/IMPLEMENTATION-COMPLETE.md +521 -0
- package/simulation/docs/OPTIMIZATION-SUMMARY.md +279 -0
- package/simulation/docs/README.md +229 -0
- package/simulation/docs/SWARM-5-INTEGRATION-SUMMARY.md +528 -0
- package/simulation/docs/TESTING-SUMMARY.md +304 -0
- package/simulation/docs/architecture/EXTENSION-API.md +868 -0
- package/simulation/docs/architecture/INTEGRATION-ARCHITECTURE.md +1138 -0
- package/simulation/docs/architecture/OPTIMIZATION-STRATEGY.md +778 -0
- package/simulation/docs/architecture/SIMULATION-ARCHITECTURE.md +892 -0
- package/simulation/docs/guides/CLI-REFERENCE.md +896 -0
- package/simulation/docs/guides/CUSTOM-SIMULATIONS.md +931 -0
- package/simulation/docs/guides/DEPLOYMENT.md +832 -0
- package/simulation/docs/guides/IMPLEMENTATION-SUMMARY.md +544 -0
- package/simulation/docs/guides/MIGRATION-GUIDE.md +591 -0
- package/simulation/docs/guides/QUICK-START.md +361 -0
- package/simulation/docs/guides/README.md +736 -0
- package/simulation/docs/guides/TROUBLESHOOTING.md +817 -0
- package/simulation/docs/guides/WIZARD-GUIDE.md +869 -0
- package/simulation/docs/reports/latent-space/MASTER-SYNTHESIS.md +345 -0
- package/simulation/docs/reports/latent-space/README.md +132 -0
- package/simulation/docs/reports/latent-space/attention-analysis-RESULTS.md +238 -0
- package/simulation/docs/reports/latent-space/clustering-analysis-RESULTS.md +210 -0
- package/simulation/docs/reports/latent-space/hnsw-exploration-RESULTS.md +332 -0
- package/simulation/docs/reports/latent-space/hypergraph-exploration-RESULTS.md +37 -0
- package/simulation/docs/reports/latent-space/neural-augmentation-RESULTS.md +69 -0
- package/simulation/docs/reports/latent-space/quantum-hybrid-RESULTS.md +91 -0
- package/simulation/docs/reports/latent-space/self-organizing-hnsw-RESULTS.md +51 -0
- package/simulation/docs/reports/latent-space/traversal-optimization-RESULTS.md +238 -0
- package/simulation/reports/README.md +397 -0
- package/simulation/reports/advanced-simulations-performance.md +1241 -0
- package/simulation/reports/aidefence-integration-2025-11-30T01-36-53-486Z.json +30 -0
- package/simulation/reports/architecture-analysis.md +1396 -0
- package/simulation/reports/basic-scenarios-performance.md +1840 -0
- package/simulation/reports/bmssp-integration-2025-11-30T01-36-27-193Z.json +30 -0
- package/simulation/reports/bmssp-integration-2025-11-30T03-38-12-887Z.json +30 -0
- package/simulation/reports/causal-reasoning-2025-11-29T23-35-21-795Z.json +36 -0
- package/simulation/reports/causal-reasoning-2025-11-30T00-58-42-862Z.json +30 -0
- package/simulation/reports/causal-reasoning-2025-11-30T00-59-12-546Z.json +40 -0
- package/simulation/reports/consciousness-explorer-2025-11-30T01-36-51-269Z.json +31 -0
- package/simulation/reports/core-benchmarks.md +727 -0
- package/simulation/reports/goalie-integration-2025-11-30T01-36-52-377Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-29T23-35-35-279Z.json +78 -0
- package/simulation/reports/graph-traversal-2025-11-29T23-37-36-697Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-03-59-716Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-05-10-984Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-06-16-334Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-06-53-312Z.json +30 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-07-51-075Z.json +24 -0
- package/simulation/reports/graph-traversal-2025-11-30T01-08-22-179Z.json +42 -0
- package/simulation/reports/lean-agentic-swarm-2025-11-29T23-37-23-804Z.json +148 -0
- package/simulation/reports/lean-agentic-swarm-2025-11-30T01-31-24-401Z.json +31 -0
- package/simulation/reports/lean-agentic-swarm-2025-11-30T03-38-01-470Z.json +31 -0
- package/simulation/reports/multi-agent-swarm-2025-11-29T23-35-28-093Z.json +78 -0
- package/simulation/reports/multi-agent-swarm-2025-11-30T01-03-54-062Z.json +42 -0
- package/simulation/reports/multi-agent-swarm-2025-11-30T01-05-06-092Z.json +42 -0
- package/simulation/reports/psycho-symbolic-reasoner-2025-11-30T01-36-50-180Z.json +30 -0
- package/simulation/reports/quality-metrics.md +727 -0
- package/simulation/reports/reflexion-learning-2025-11-29T23-35-09-774Z.json +48 -0
- package/simulation/reports/reflexion-learning-2025-11-29T23-37-16-934Z.json +36 -0
- package/simulation/reports/reflexion-learning-2025-11-30T00-07-49-259Z.json +30 -0
- package/simulation/reports/reflexion-learning-2025-11-30T00-09-29-319Z.json +51 -0
- package/simulation/reports/reflexion-learning-2025-11-30T00-28-37-659Z.json +51 -0
- package/simulation/reports/reflexion-learning-2025-11-30T01-31-30-690Z.json +29 -0
- package/simulation/reports/reflexion-learning-2025-11-30T03-38-06-937Z.json +29 -0
- package/simulation/reports/research-foundations.md +2004 -0
- package/simulation/reports/research-swarm-2025-11-30T01-36-54-647Z.json +30 -0
- package/simulation/reports/scalability-deployment.md +2404 -0
- package/simulation/reports/skill-evolution-2025-11-29T23-35-15-945Z.json +36 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-03-17-995Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-03-48-441Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-05-00-554Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-06-11-436Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-06-51-979Z.json +30 -0
- package/simulation/reports/skill-evolution-2025-11-30T01-07-32-695Z.json +40 -0
- package/simulation/reports/stock-market-emergence-2025-11-30T00-11-43-865Z.json +56 -0
- package/simulation/reports/stock-market-emergence-2025-11-30T00-28-57-495Z.json +56 -0
- package/simulation/reports/strange-loops-2025-11-29T23-37-30-621Z.json +78 -0
- package/simulation/reports/strange-loops-2025-11-30T00-07-55-415Z.json +30 -0
- package/simulation/reports/strange-loops-2025-11-30T00-09-35-133Z.json +30 -0
- package/simulation/reports/strange-loops-2025-11-30T00-48-50-744Z.json +24 -0
- package/simulation/reports/strange-loops-2025-11-30T00-54-48-044Z.json +24 -0
- package/simulation/reports/strange-loops-2025-11-30T00-57-27-633Z.json +24 -0
- package/simulation/reports/strange-loops-2025-11-30T00-57-59-135Z.json +42 -0
- package/simulation/reports/sublinear-solver-2025-11-30T01-36-33-134Z.json +30 -0
- package/simulation/reports/temporal-lead-solver-2025-11-30T01-36-38-628Z.json +30 -0
- package/simulation/reports/use-cases-applications.md +2212 -0
- package/simulation/reports/voting-system-consensus-2025-11-30T00-11-37-199Z.json +58 -0
- package/simulation/reports/voting-system-consensus-2025-11-30T00-28-47-735Z.json +58 -0
- package/simulation/runner.ts +300 -0
- package/simulation/scenarios/README-advanced/aidefence-integration.md +63 -0
- package/simulation/scenarios/README-advanced/bmssp-integration.md +58 -0
- package/simulation/scenarios/README-advanced/consciousness-explorer.md +53 -0
- package/simulation/scenarios/README-advanced/goalie-integration.md +61 -0
- package/simulation/scenarios/README-advanced/psycho-symbolic-reasoner.md +55 -0
- package/simulation/scenarios/README-advanced/research-swarm.md +63 -0
- package/simulation/scenarios/README-advanced/sublinear-solver.md +58 -0
- package/simulation/scenarios/README-advanced/temporal-lead-solver.md +55 -0
- package/simulation/scenarios/README-basic/causal-reasoning.md +39 -0
- package/simulation/scenarios/README-basic/graph-traversal.md +41 -0
- package/simulation/scenarios/README-basic/lean-agentic-swarm.md +122 -0
- package/simulation/scenarios/README-basic/multi-agent-swarm.md +34 -0
- package/simulation/scenarios/README-basic/reflexion-learning.md +41 -0
- package/simulation/scenarios/README-basic/skill-evolution.md +38 -0
- package/simulation/scenarios/README-basic/stock-market-emergence.md +28 -0
- package/simulation/scenarios/README-basic/strange-loops.md +36 -0
- package/simulation/scenarios/README-basic/voting-system-consensus.md +28 -0
- package/simulation/scenarios/README.md +438 -0
- package/simulation/scenarios/aidefence-integration.ts +165 -0
- package/simulation/scenarios/bmssp-integration.ts +137 -0
- package/simulation/scenarios/causal-reasoning.ts +143 -0
- package/simulation/scenarios/consciousness-explorer.ts +139 -0
- package/simulation/scenarios/domain-examples/.claude-flow/metrics/agent-metrics.json +1 -0
- package/simulation/scenarios/domain-examples/.claude-flow/metrics/performance.json +87 -0
- package/simulation/scenarios/domain-examples/.claude-flow/metrics/task-metrics.json +10 -0
- package/simulation/scenarios/domain-examples/README.md +525 -0
- package/simulation/scenarios/domain-examples/e-commerce-recommendations.ts +220 -0
- package/simulation/scenarios/domain-examples/index.ts +81 -0
- package/simulation/scenarios/domain-examples/iot-sensor-networks.ts +290 -0
- package/simulation/scenarios/domain-examples/medical-imaging.ts +181 -0
- package/simulation/scenarios/domain-examples/robotics-navigation.ts +214 -0
- package/simulation/scenarios/domain-examples/scientific-research.ts +250 -0
- package/simulation/scenarios/domain-examples/trading-systems.ts +138 -0
- package/simulation/scenarios/goalie-integration.ts +161 -0
- package/simulation/scenarios/graph-traversal.ts +129 -0
- package/simulation/scenarios/latent-space/OPTIMIZATION-COMPLETE.md +287 -0
- package/simulation/scenarios/latent-space/README-attention-analysis.md +170 -0
- package/simulation/scenarios/latent-space/README-clustering-analysis.md +239 -0
- package/simulation/scenarios/latent-space/README-hnsw-exploration.md +199 -0
- package/simulation/scenarios/latent-space/README-hypergraph-exploration.md +279 -0
- package/simulation/scenarios/latent-space/README-neural-augmentation.md +267 -0
- package/simulation/scenarios/latent-space/README-quantum-hybrid.md +276 -0
- package/simulation/scenarios/latent-space/README-self-organizing-hnsw.md +244 -0
- package/simulation/scenarios/latent-space/README-traversal-optimization.md +212 -0
- package/simulation/scenarios/latent-space/attention-analysis.ts +598 -0
- package/simulation/scenarios/latent-space/clustering-analysis.ts +796 -0
- package/simulation/scenarios/latent-space/hnsw-exploration.ts +526 -0
- package/simulation/scenarios/latent-space/hypergraph-exploration.ts +706 -0
- package/simulation/scenarios/latent-space/index.ts +47 -0
- package/simulation/scenarios/latent-space/neural-augmentation.ts +604 -0
- package/simulation/scenarios/latent-space/quantum-hybrid.ts +508 -0
- package/simulation/scenarios/latent-space/self-organizing-hnsw.ts +680 -0
- package/simulation/scenarios/latent-space/traversal-optimization.ts +782 -0
- package/simulation/scenarios/lean-agentic-swarm.ts +182 -0
- package/simulation/scenarios/multi-agent-swarm.ts +146 -0
- package/simulation/scenarios/psycho-symbolic-reasoner.ts +136 -0
- package/simulation/scenarios/reflexion-learning.ts +132 -0
- package/simulation/scenarios/research-swarm.ts +187 -0
- package/simulation/scenarios/skill-evolution.ts +135 -0
- package/simulation/scenarios/stock-market-emergence.ts +323 -0
- package/simulation/scenarios/strange-loops.ts +175 -0
- package/simulation/scenarios/sublinear-solver.ts +108 -0
- package/simulation/scenarios/temporal-lead-solver.ts +121 -0
- package/simulation/scenarios/voting-system-consensus.ts +251 -0
- package/simulation/tests/latent-space/attention-analysis.test.ts +204 -0
- package/simulation/tests/latent-space/clustering-analysis.test.ts +281 -0
- package/simulation/tests/latent-space/hnsw-exploration.test.ts +253 -0
- package/simulation/tests/latent-space/hypergraph-exploration.test.ts +295 -0
- package/simulation/tests/latent-space/neural-augmentation.test.ts +326 -0
- package/simulation/tests/latent-space/quantum-hybrid.test.ts +307 -0
- package/simulation/tests/latent-space/self-organizing-hnsw.test.ts +291 -0
- package/simulation/tests/latent-space/traversal-optimization.test.ts +261 -0
- package/simulation/types.ts +177 -0
- package/simulation/utils/PerformanceOptimizer.ts +269 -0
- package/src/cli/lib/history-tracker.ts +7 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Medical Imaging: High-Precision Image Similarity Search
|
|
3
|
+
*
|
|
4
|
+
* Use Case: Medical diagnosis requires highest possible accuracy
|
|
5
|
+
* for similar case retrieval and diagnostic assistance.
|
|
6
|
+
*
|
|
7
|
+
* Optimization Priority: RECALL/PRECISION (latency trade-off acceptable)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { UnifiedMetrics } from '../../types';
|
|
11
|
+
|
|
12
|
+
export const MEDICAL_ATTENTION_CONFIG = {
|
|
13
|
+
heads: 16, // More heads = better quality (vs 8-head optimal)
|
|
14
|
+
forwardPassTargetMs: 50, // 50ms acceptable (diagnostic aid, not real-time)
|
|
15
|
+
batchSize: 32, // Batch processing for efficiency
|
|
16
|
+
precision: 'float32' as const, // Full precision (medical data critical)
|
|
17
|
+
ensembleSize: 3, // 3-model ensemble for robustness
|
|
18
|
+
|
|
19
|
+
// High-recall configuration
|
|
20
|
+
recallTarget: 0.99, // 99% recall required (vs 96.8% general)
|
|
21
|
+
precisionTarget: 0.95, // 95% precision required
|
|
22
|
+
|
|
23
|
+
// Self-healing with medical data integrity
|
|
24
|
+
selfHealing: {
|
|
25
|
+
enabled: true,
|
|
26
|
+
adaptationIntervalMs: 1000, // 1s monitoring (less critical than trading)
|
|
27
|
+
degradationThreshold: 0.01, // 1% tolerance (strict for medical)
|
|
28
|
+
dataIntegrityChecks: true // Verify data quality
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Medical-specific metrics
|
|
33
|
+
export interface MedicalMetrics extends UnifiedMetrics {
|
|
34
|
+
recallAt100: number; // Recall@100 (retrieve more candidates)
|
|
35
|
+
precisionAt10: number; // Precision@10 (top results critical)
|
|
36
|
+
diagnosticAgreement: number; // Agreement with expert diagnosis
|
|
37
|
+
falseNegativeRate: number; // Critical for medical (missed diagnoses)
|
|
38
|
+
dataIntegrityScore: number; // DICOM compliance, quality checks
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Similar case interface
|
|
42
|
+
export interface SimilarCase {
|
|
43
|
+
caseId: string;
|
|
44
|
+
diagnosis: string;
|
|
45
|
+
similarity: number;
|
|
46
|
+
radiologistNotes: string;
|
|
47
|
+
confidence: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Example: Similar case retrieval for diagnosis
|
|
51
|
+
export async function findSimilarCases(
|
|
52
|
+
patientScan: Float32Array, // MRI/CT scan embeddings
|
|
53
|
+
medicalDatabase: any, // HNSWGraph type
|
|
54
|
+
applyAttention: (data: Float32Array, config: any) => Promise<Float32Array>,
|
|
55
|
+
runEnsemble: (data: Float32Array, size: number) => Promise<any[]>,
|
|
56
|
+
calculateEnsembleConfidence: (candidate: any, ensemble: any[]) => number,
|
|
57
|
+
minConfidence: number = 0.95
|
|
58
|
+
): Promise<SimilarCase[]> {
|
|
59
|
+
const config = MEDICAL_ATTENTION_CONFIG;
|
|
60
|
+
|
|
61
|
+
// 16-head attention for high-quality embeddings
|
|
62
|
+
const enhanced = await applyAttention(patientScan, config);
|
|
63
|
+
|
|
64
|
+
// High-recall search (k=100 for comprehensive retrieval)
|
|
65
|
+
const candidates = await medicalDatabase.search(enhanced, 100);
|
|
66
|
+
|
|
67
|
+
// Ensemble voting for robustness
|
|
68
|
+
const ensembleResults = await runEnsemble(patientScan, config.ensembleSize);
|
|
69
|
+
|
|
70
|
+
// Filter by confidence threshold
|
|
71
|
+
return candidates
|
|
72
|
+
.filter((c: any) => c.score >= minConfidence)
|
|
73
|
+
.map((c: any) => ({
|
|
74
|
+
caseId: c.id,
|
|
75
|
+
diagnosis: c.metadata.diagnosis,
|
|
76
|
+
similarity: c.score,
|
|
77
|
+
radiologistNotes: c.metadata.notes,
|
|
78
|
+
confidence: calculateEnsembleConfidence(c, ensembleResults)
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Performance targets for medical imaging
|
|
83
|
+
export const MEDICAL_PERFORMANCE_TARGETS = {
|
|
84
|
+
recallAt100: 0.99, // 99% recall (comprehensive retrieval)
|
|
85
|
+
precisionAt10: 0.95, // 95% precision (top 10 highly relevant)
|
|
86
|
+
p50LatencyMs: 50, // 50ms median (batch processing acceptable)
|
|
87
|
+
falseNegativeRate: 0.01, // <1% false negatives (critical)
|
|
88
|
+
uptimePercent: 99.9 // 99.9% uptime (3 nines)
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Medical imaging modality-specific configurations
|
|
92
|
+
export const MEDICAL_CONFIG_VARIATIONS = {
|
|
93
|
+
// CT scans (high resolution, more detail needed)
|
|
94
|
+
ctScans: {
|
|
95
|
+
...MEDICAL_ATTENTION_CONFIG,
|
|
96
|
+
heads: 20, // Even more heads for fine detail
|
|
97
|
+
recallTarget: 0.995, // 99.5% recall
|
|
98
|
+
ensembleSize: 5 // Larger ensemble
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// MRI scans (multiple sequences, complex)
|
|
102
|
+
mriScans: {
|
|
103
|
+
...MEDICAL_ATTENTION_CONFIG,
|
|
104
|
+
heads: 16,
|
|
105
|
+
multiSequenceFusion: true, // Fuse T1, T2, FLAIR, etc.
|
|
106
|
+
recallTarget: 0.99
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
// X-rays (simpler, faster acceptable)
|
|
110
|
+
xrays: {
|
|
111
|
+
...MEDICAL_ATTENTION_CONFIG,
|
|
112
|
+
heads: 12,
|
|
113
|
+
forwardPassTargetMs: 30, // Faster processing
|
|
114
|
+
recallTarget: 0.98
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
// Pathology slides (ultra-high resolution)
|
|
118
|
+
pathology: {
|
|
119
|
+
...MEDICAL_ATTENTION_CONFIG,
|
|
120
|
+
heads: 24, // Maximum detail
|
|
121
|
+
forwardPassTargetMs: 100, // Allow more time
|
|
122
|
+
recallTarget: 0.995,
|
|
123
|
+
hierarchicalProcessing: true // Process at multiple scales
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Clinical urgency adaptations
|
|
128
|
+
export function adaptConfigToUrgency(
|
|
129
|
+
baseConfig: typeof MEDICAL_ATTENTION_CONFIG,
|
|
130
|
+
urgency: 'routine' | 'urgent' | 'emergency'
|
|
131
|
+
): typeof MEDICAL_ATTENTION_CONFIG {
|
|
132
|
+
switch (urgency) {
|
|
133
|
+
case 'routine':
|
|
134
|
+
return {
|
|
135
|
+
...baseConfig,
|
|
136
|
+
heads: 20, // Maximum quality
|
|
137
|
+
forwardPassTargetMs: 100, // Allow more time
|
|
138
|
+
ensembleSize: 5 // Largest ensemble
|
|
139
|
+
};
|
|
140
|
+
case 'urgent':
|
|
141
|
+
return {
|
|
142
|
+
...baseConfig,
|
|
143
|
+
heads: 16, // Balanced
|
|
144
|
+
forwardPassTargetMs: 50
|
|
145
|
+
};
|
|
146
|
+
case 'emergency':
|
|
147
|
+
return {
|
|
148
|
+
...baseConfig,
|
|
149
|
+
heads: 12, // Faster, still high quality
|
|
150
|
+
forwardPassTargetMs: 20,
|
|
151
|
+
ensembleSize: 1, // Skip ensemble for speed
|
|
152
|
+
recallTarget: 0.97 // Slight quality trade-off
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Data quality monitoring
|
|
158
|
+
export interface MedicalDataQuality {
|
|
159
|
+
dicomCompliance: boolean;
|
|
160
|
+
resolutionAdequate: boolean;
|
|
161
|
+
contrastQuality: number;
|
|
162
|
+
artifactScore: number;
|
|
163
|
+
calibrationValid: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function validateMedicalData(scan: any): MedicalDataQuality {
|
|
167
|
+
return {
|
|
168
|
+
dicomCompliance: checkDICOMHeaders(scan),
|
|
169
|
+
resolutionAdequate: checkResolution(scan),
|
|
170
|
+
contrastQuality: assessContrast(scan),
|
|
171
|
+
artifactScore: detectArtifacts(scan),
|
|
172
|
+
calibrationValid: verifyCalibration(scan)
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Placeholder validation functions
|
|
177
|
+
function checkDICOMHeaders(scan: any): boolean { return true; }
|
|
178
|
+
function checkResolution(scan: any): boolean { return true; }
|
|
179
|
+
function assessContrast(scan: any): number { return 0.95; }
|
|
180
|
+
function detectArtifacts(scan: any): number { return 0.02; }
|
|
181
|
+
function verifyCalibration(scan: any): boolean { return true; }
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Robotics Navigation: Adaptive Real-Time Path Planning
|
|
3
|
+
*
|
|
4
|
+
* Use Case: Autonomous robots need real-time similarity search
|
|
5
|
+
* for environment matching and obstacle avoidance.
|
|
6
|
+
*
|
|
7
|
+
* Optimization Priority: BALANCED (latency + accuracy)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { UnifiedMetrics } from '../../types';
|
|
11
|
+
|
|
12
|
+
export const ROBOTICS_ATTENTION_CONFIG = {
|
|
13
|
+
heads: 8, // Optimal balance (validated)
|
|
14
|
+
forwardPassTargetMs: 10, // 10ms for 100Hz control loop
|
|
15
|
+
batchSize: 4, // Small batches for real-time
|
|
16
|
+
precision: 'float16' as const, // Reduced precision for edge devices
|
|
17
|
+
edgeOptimized: true, // NVIDIA Jetson, Intel NCS optimization
|
|
18
|
+
|
|
19
|
+
// Dynamic attention based on environment complexity
|
|
20
|
+
dynamicHeads: {
|
|
21
|
+
enabled: true,
|
|
22
|
+
simple: 4, // 4 heads for simple environments
|
|
23
|
+
complex: 12, // 12 heads for complex scenes
|
|
24
|
+
adaptationStrategy: 'scene-complexity' as const
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
// Dynamic-k based on navigation context
|
|
28
|
+
dynamicK: {
|
|
29
|
+
min: 5,
|
|
30
|
+
max: 20,
|
|
31
|
+
adaptationStrategy: 'obstacle-density' as const // More obstacles = more candidates
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
// Self-healing for continuous operation
|
|
35
|
+
selfHealing: {
|
|
36
|
+
enabled: true,
|
|
37
|
+
adaptationIntervalMs: 100,
|
|
38
|
+
degradationThreshold: 0.05,
|
|
39
|
+
hardwareMonitoring: true // Battery, temperature, GPU
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Robotics-specific metrics
|
|
44
|
+
export interface RoboticsMetrics extends UnifiedMetrics {
|
|
45
|
+
controlLoopLatencyMs: number; // Control loop latency (10ms target)
|
|
46
|
+
navigationAccuracy: number; // Path planning accuracy
|
|
47
|
+
obstacleDetectionRate: number; // Obstacle detection success rate
|
|
48
|
+
powerConsumptionW: number; // Power consumption (battery life)
|
|
49
|
+
temperatureCelsius: number; // Hardware temperature monitoring
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Robot context interface
|
|
53
|
+
export interface RobotContext {
|
|
54
|
+
velocity: number;
|
|
55
|
+
batteryPercent: number;
|
|
56
|
+
temperatureCelsius: number;
|
|
57
|
+
missionCriticality: 'low' | 'medium' | 'high';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Navigation plan interface
|
|
61
|
+
export interface NavigationPlan {
|
|
62
|
+
bestMatch: any;
|
|
63
|
+
suggestedPath: any;
|
|
64
|
+
confidence: number;
|
|
65
|
+
latencyMs: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Example: Environment matching for navigation
|
|
69
|
+
export async function matchEnvironment(
|
|
70
|
+
currentSensorData: Float32Array, // LIDAR, camera, IMU
|
|
71
|
+
knownEnvironments: any, // HNSWGraph type
|
|
72
|
+
robotContext: RobotContext,
|
|
73
|
+
applyAttention: (data: Float32Array, config: any) => Promise<Float32Array>,
|
|
74
|
+
analyzeSceneComplexity: (data: Float32Array) => number,
|
|
75
|
+
calculateObstacleDensity: (data: Float32Array) => number,
|
|
76
|
+
computePath: (matches: any[]) => any
|
|
77
|
+
): Promise<NavigationPlan> {
|
|
78
|
+
const startTime = Date.now();
|
|
79
|
+
const config = ROBOTICS_ATTENTION_CONFIG;
|
|
80
|
+
|
|
81
|
+
// Adaptive attention based on scene complexity
|
|
82
|
+
const sceneComplexity = analyzeSceneComplexity(currentSensorData);
|
|
83
|
+
const adaptiveHeads = sceneComplexity > 0.7 ? 12 : 4;
|
|
84
|
+
|
|
85
|
+
// Apply attention with adaptive heads
|
|
86
|
+
const enhanced = await applyAttention(currentSensorData, {
|
|
87
|
+
...config,
|
|
88
|
+
heads: adaptiveHeads
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Dynamic-k based on obstacle density
|
|
92
|
+
const obstacleDensity = calculateObstacleDensity(currentSensorData);
|
|
93
|
+
const k = Math.round(5 + obstacleDensity * 15); // 5-20 range
|
|
94
|
+
|
|
95
|
+
// Search for similar environments
|
|
96
|
+
const matches = await knownEnvironments.search(enhanced, k);
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
bestMatch: matches[0],
|
|
100
|
+
suggestedPath: computePath(matches),
|
|
101
|
+
confidence: matches[0].score,
|
|
102
|
+
latencyMs: Date.now() - startTime // Track real-time performance
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Performance targets for robotics
|
|
107
|
+
export const ROBOTICS_PERFORMANCE_TARGETS = {
|
|
108
|
+
controlLoopLatencyMs: 10, // 10ms for 100Hz control
|
|
109
|
+
navigationAccuracy: 0.95, // 95% path planning accuracy
|
|
110
|
+
p99LatencyMs: 15, // 15ms p99 (real-time critical)
|
|
111
|
+
powerConsumptionW: 20, // 20W max (battery life)
|
|
112
|
+
uptimePercent: 99.0 // 99% uptime (2 nines, field operation)
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// Robot platform-specific configurations
|
|
116
|
+
export const ROBOTICS_CONFIG_VARIATIONS = {
|
|
117
|
+
// High-performance robots (Boston Dynamics Spot, ANYmal)
|
|
118
|
+
highPerformance: {
|
|
119
|
+
...ROBOTICS_ATTENTION_CONFIG,
|
|
120
|
+
heads: 12,
|
|
121
|
+
forwardPassTargetMs: 5, // 5ms for 200Hz control
|
|
122
|
+
precision: 'float32' as const, // Full precision available
|
|
123
|
+
powerConsumptionW: 100 // Higher power budget
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
// Consumer drones (DJI, Parrot)
|
|
127
|
+
consumerDrone: {
|
|
128
|
+
...ROBOTICS_ATTENTION_CONFIG,
|
|
129
|
+
heads: 6,
|
|
130
|
+
forwardPassTargetMs: 20, // 50Hz control acceptable
|
|
131
|
+
precision: 'float16' as const,
|
|
132
|
+
powerConsumptionW: 15 // Battery constrained
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
// Industrial AGVs (warehouse robots)
|
|
136
|
+
industrialAGV: {
|
|
137
|
+
...ROBOTICS_ATTENTION_CONFIG,
|
|
138
|
+
heads: 8,
|
|
139
|
+
forwardPassTargetMs: 15,
|
|
140
|
+
precision: 'float32' as const,
|
|
141
|
+
dynamicK: { min: 10, max: 30, adaptationStrategy: 'warehouse-density' as const }
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
// Embedded robots (Raspberry Pi, Arduino)
|
|
145
|
+
embedded: {
|
|
146
|
+
...ROBOTICS_ATTENTION_CONFIG,
|
|
147
|
+
heads: 4,
|
|
148
|
+
forwardPassTargetMs: 50, // Slower acceptable
|
|
149
|
+
precision: 'int8' as const, // Quantized for embedded
|
|
150
|
+
powerConsumptionW: 5 // Very power constrained
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// Environment adaptation
|
|
155
|
+
export function adaptConfigToEnvironment(
|
|
156
|
+
baseConfig: typeof ROBOTICS_ATTENTION_CONFIG,
|
|
157
|
+
environment: 'indoor' | 'outdoor' | 'underground' | 'aerial'
|
|
158
|
+
): typeof ROBOTICS_ATTENTION_CONFIG {
|
|
159
|
+
switch (environment) {
|
|
160
|
+
case 'indoor':
|
|
161
|
+
return {
|
|
162
|
+
...baseConfig,
|
|
163
|
+
heads: 8,
|
|
164
|
+
dynamicK: { ...baseConfig.dynamicK, min: 5, max: 15 }
|
|
165
|
+
};
|
|
166
|
+
case 'outdoor':
|
|
167
|
+
return {
|
|
168
|
+
...baseConfig,
|
|
169
|
+
heads: 10, // More complexity
|
|
170
|
+
dynamicK: { ...baseConfig.dynamicK, min: 10, max: 25 },
|
|
171
|
+
selfHealing: { ...baseConfig.selfHealing, adaptationIntervalMs: 50 }
|
|
172
|
+
};
|
|
173
|
+
case 'underground':
|
|
174
|
+
return {
|
|
175
|
+
...baseConfig,
|
|
176
|
+
heads: 6, // Limited sensors
|
|
177
|
+
forwardPassTargetMs: 15
|
|
178
|
+
// Note: Network resilience handled at transport layer
|
|
179
|
+
};
|
|
180
|
+
case 'aerial':
|
|
181
|
+
return {
|
|
182
|
+
...baseConfig,
|
|
183
|
+
heads: 12, // Complex 3D navigation
|
|
184
|
+
forwardPassTargetMs: 8,
|
|
185
|
+
dynamicK: { ...baseConfig.dynamicK, min: 8, max: 20 }
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Power-aware configuration adjustment
|
|
191
|
+
export function adaptConfigToPower(
|
|
192
|
+
baseConfig: typeof ROBOTICS_ATTENTION_CONFIG,
|
|
193
|
+
batteryPercent: number
|
|
194
|
+
): typeof ROBOTICS_ATTENTION_CONFIG {
|
|
195
|
+
if (batteryPercent < 20) {
|
|
196
|
+
// Critical battery - minimize computation
|
|
197
|
+
return {
|
|
198
|
+
...baseConfig,
|
|
199
|
+
heads: 4,
|
|
200
|
+
batchSize: 1
|
|
201
|
+
// Note: Precision optimization coming in future release
|
|
202
|
+
};
|
|
203
|
+
} else if (batteryPercent < 50) {
|
|
204
|
+
// Low battery - reduce quality slightly
|
|
205
|
+
return {
|
|
206
|
+
...baseConfig,
|
|
207
|
+
heads: 6,
|
|
208
|
+
precision: 'float16' as const
|
|
209
|
+
};
|
|
210
|
+
} else {
|
|
211
|
+
// Normal operation
|
|
212
|
+
return baseConfig;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scientific Research: Research Paper Similarity and Discovery
|
|
3
|
+
*
|
|
4
|
+
* Use Case: Find similar research papers, identify research trends,
|
|
5
|
+
* and discover cross-domain connections.
|
|
6
|
+
*
|
|
7
|
+
* Optimization Priority: QUALITY + CROSS-DOMAIN DISCOVERY
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { UnifiedMetrics } from '../../types';
|
|
11
|
+
|
|
12
|
+
export const RESEARCH_ATTENTION_CONFIG = {
|
|
13
|
+
heads: 12, // High-quality attention (more than 8-head optimal)
|
|
14
|
+
forwardPassTargetMs: 100, // 100ms acceptable (research workflow)
|
|
15
|
+
batchSize: 128, // Large batches for corpus processing
|
|
16
|
+
precision: 'float32' as const, // Full precision for scientific data
|
|
17
|
+
crossDomainDiscovery: true, // Enable cross-field connections
|
|
18
|
+
|
|
19
|
+
// Hierarchical clustering for research topics
|
|
20
|
+
clustering: {
|
|
21
|
+
algorithm: 'hierarchical' as const, // Better for taxonomy
|
|
22
|
+
linkage: 'ward' as const, // Ward's minimum variance
|
|
23
|
+
hierarchicalLevels: 5, // Deep taxonomy (field > subfield > topic > subtopic > specific)
|
|
24
|
+
semanticPurity: 0.90 // High purity for research domains
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
// High-recall for comprehensive literature review
|
|
28
|
+
recallTarget: 0.98, // 98% recall (don't miss relevant papers)
|
|
29
|
+
|
|
30
|
+
// Self-organizing for evolving research landscape
|
|
31
|
+
selfHealing: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
adaptationIntervalMs: 60000, // 1-minute adaptation (not real-time)
|
|
34
|
+
degradationThreshold: 0.03, // 3% tolerance
|
|
35
|
+
taxonomyUpdates: true // Update research taxonomy
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Research-specific metrics
|
|
40
|
+
export interface ResearchMetrics extends UnifiedMetrics {
|
|
41
|
+
crossDomainConnections: number; // Cross-field discoveries
|
|
42
|
+
citationAccuracy: number; // Citation network accuracy
|
|
43
|
+
taxonomyQuality: number; // Research taxonomy quality
|
|
44
|
+
noveltyScore: number; // Novel connection discovery rate
|
|
45
|
+
expertAgreement: number; // Agreement with domain experts
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Research connection interface
|
|
49
|
+
export interface ResearchConnection {
|
|
50
|
+
paperId: string;
|
|
51
|
+
title: string;
|
|
52
|
+
authors: string[];
|
|
53
|
+
similarity: number;
|
|
54
|
+
domain: string;
|
|
55
|
+
crossDomainConnection?: {
|
|
56
|
+
targetDomain: string;
|
|
57
|
+
connectionType: string;
|
|
58
|
+
noveltyScore: number;
|
|
59
|
+
};
|
|
60
|
+
citations: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Example: Research paper discovery with cross-domain connections
|
|
64
|
+
export async function discoverRelatedResearch(
|
|
65
|
+
paperEmbedding: Float32Array, // Paper abstract + citations embeddings
|
|
66
|
+
researchCorpus: any, // HNSWGraph type
|
|
67
|
+
applyAttention: (data: Float32Array, config: any) => Promise<Float32Array>,
|
|
68
|
+
buildResearchTaxonomy: (papers: any[], config: any) => Promise<any>,
|
|
69
|
+
findCrossDomainConnections: (papers: any[], taxonomy: any) => Promise<any[]>,
|
|
70
|
+
findDomain: (paper: any, taxonomy: any) => string,
|
|
71
|
+
includeCrossDomain: boolean = true
|
|
72
|
+
): Promise<ResearchConnection[]> {
|
|
73
|
+
const config = RESEARCH_ATTENTION_CONFIG;
|
|
74
|
+
|
|
75
|
+
// 12-head attention for nuanced understanding
|
|
76
|
+
const enhanced = await applyAttention(paperEmbedding, config);
|
|
77
|
+
|
|
78
|
+
// High-recall search (k=100 for comprehensive review)
|
|
79
|
+
const candidates = await researchCorpus.search(enhanced, 100);
|
|
80
|
+
|
|
81
|
+
// Hierarchical clustering for taxonomy
|
|
82
|
+
const taxonomy = await buildResearchTaxonomy(candidates, config.clustering);
|
|
83
|
+
|
|
84
|
+
// Cross-domain discovery (find connections across fields)
|
|
85
|
+
const crossDomain = includeCrossDomain
|
|
86
|
+
? await findCrossDomainConnections(candidates, taxonomy)
|
|
87
|
+
: [];
|
|
88
|
+
|
|
89
|
+
return candidates.map((p: any) => ({
|
|
90
|
+
paperId: p.id,
|
|
91
|
+
title: p.metadata.title,
|
|
92
|
+
authors: p.metadata.authors,
|
|
93
|
+
similarity: p.score,
|
|
94
|
+
domain: findDomain(p, taxonomy),
|
|
95
|
+
crossDomainConnection: crossDomain.find((c: any) => c.paperId === p.id),
|
|
96
|
+
citations: p.metadata.citations
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Performance targets for research
|
|
101
|
+
export const RESEARCH_PERFORMANCE_TARGETS = {
|
|
102
|
+
recallAt100: 0.98, // 98% recall (comprehensive)
|
|
103
|
+
p95LatencyMs: 200, // 200ms p95 (batch processing)
|
|
104
|
+
crossDomainRate: 0.15, // 15% cross-domain discoveries
|
|
105
|
+
expertAgreement: 0.85, // 85% agreement with experts
|
|
106
|
+
uptimePercent: 99.0 // 99% uptime (2 nines)
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Research field-specific configurations
|
|
110
|
+
export const RESEARCH_CONFIG_VARIATIONS = {
|
|
111
|
+
// Computer science (fast-moving field, many papers)
|
|
112
|
+
computerScience: {
|
|
113
|
+
...RESEARCH_ATTENTION_CONFIG,
|
|
114
|
+
heads: 10,
|
|
115
|
+
forwardPassTargetMs: 50, // Faster for large corpus
|
|
116
|
+
batchSize: 256,
|
|
117
|
+
recallTarget: 0.97 // Slightly lower for speed
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
// Medicine (high precision required, slower pace)
|
|
121
|
+
medicine: {
|
|
122
|
+
...RESEARCH_ATTENTION_CONFIG,
|
|
123
|
+
heads: 16, // Maximum quality
|
|
124
|
+
forwardPassTargetMs: 150,
|
|
125
|
+
recallTarget: 0.99, // Highest recall
|
|
126
|
+
precision: 'float32' as const
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
// Physics (mathematical precision, cross-domain links)
|
|
130
|
+
physics: {
|
|
131
|
+
...RESEARCH_ATTENTION_CONFIG,
|
|
132
|
+
heads: 14,
|
|
133
|
+
crossDomainDiscovery: true,
|
|
134
|
+
clustering: {
|
|
135
|
+
...RESEARCH_ATTENTION_CONFIG.clustering,
|
|
136
|
+
hierarchicalLevels: 6 // Deeper for specialized subfields
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
// Social sciences (qualitative, broader connections)
|
|
141
|
+
socialSciences: {
|
|
142
|
+
...RESEARCH_ATTENTION_CONFIG,
|
|
143
|
+
heads: 12,
|
|
144
|
+
crossDomainDiscovery: true,
|
|
145
|
+
clustering: {
|
|
146
|
+
...RESEARCH_ATTENTION_CONFIG.clustering,
|
|
147
|
+
semanticPurity: 0.85 // More flexible clustering
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// Search mode adaptations
|
|
153
|
+
export function adaptConfigToSearchMode(
|
|
154
|
+
baseConfig: typeof RESEARCH_ATTENTION_CONFIG,
|
|
155
|
+
mode: 'literature-review' | 'novelty-discovery' | 'citation-tracing' | 'interdisciplinary'
|
|
156
|
+
): typeof RESEARCH_ATTENTION_CONFIG {
|
|
157
|
+
switch (mode) {
|
|
158
|
+
case 'literature-review':
|
|
159
|
+
return {
|
|
160
|
+
...baseConfig,
|
|
161
|
+
heads: 12,
|
|
162
|
+
recallTarget: 0.99, // Comprehensive recall
|
|
163
|
+
crossDomainDiscovery: false // Stay within field
|
|
164
|
+
};
|
|
165
|
+
case 'novelty-discovery':
|
|
166
|
+
return {
|
|
167
|
+
...baseConfig,
|
|
168
|
+
heads: 16, // Maximum quality
|
|
169
|
+
crossDomainDiscovery: true,
|
|
170
|
+
clustering: {
|
|
171
|
+
...baseConfig.clustering,
|
|
172
|
+
semanticPurity: 0.80 // More flexible for novel connections
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
case 'citation-tracing':
|
|
176
|
+
return {
|
|
177
|
+
...baseConfig,
|
|
178
|
+
heads: 10,
|
|
179
|
+
forwardPassTargetMs: 50,
|
|
180
|
+
recallTarget: 0.95, // Fast, focused
|
|
181
|
+
crossDomainDiscovery: false
|
|
182
|
+
};
|
|
183
|
+
case 'interdisciplinary':
|
|
184
|
+
return {
|
|
185
|
+
...baseConfig,
|
|
186
|
+
heads: 14,
|
|
187
|
+
crossDomainDiscovery: true,
|
|
188
|
+
clustering: {
|
|
189
|
+
...baseConfig.clustering,
|
|
190
|
+
hierarchicalLevels: 6, // Deep taxonomy for connections
|
|
191
|
+
semanticPurity: 0.82 // Flexible for cross-field
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Research stage adaptations
|
|
198
|
+
export function adaptConfigToResearchStage(
|
|
199
|
+
baseConfig: typeof RESEARCH_ATTENTION_CONFIG,
|
|
200
|
+
stage: 'initial-exploration' | 'hypothesis-formation' | 'validation' | 'writing'
|
|
201
|
+
): typeof RESEARCH_ATTENTION_CONFIG {
|
|
202
|
+
switch (stage) {
|
|
203
|
+
case 'initial-exploration':
|
|
204
|
+
return {
|
|
205
|
+
...baseConfig,
|
|
206
|
+
heads: 12,
|
|
207
|
+
crossDomainDiscovery: true,
|
|
208
|
+
recallTarget: 0.95 // Broad search
|
|
209
|
+
};
|
|
210
|
+
case 'hypothesis-formation':
|
|
211
|
+
return {
|
|
212
|
+
...baseConfig,
|
|
213
|
+
heads: 14,
|
|
214
|
+
crossDomainDiscovery: true,
|
|
215
|
+
recallTarget: 0.98 // Comprehensive
|
|
216
|
+
};
|
|
217
|
+
case 'validation':
|
|
218
|
+
return {
|
|
219
|
+
...baseConfig,
|
|
220
|
+
heads: 16, // Maximum precision
|
|
221
|
+
recallTarget: 0.99,
|
|
222
|
+
crossDomainDiscovery: false // Focused
|
|
223
|
+
};
|
|
224
|
+
case 'writing':
|
|
225
|
+
return {
|
|
226
|
+
...baseConfig,
|
|
227
|
+
heads: 10,
|
|
228
|
+
forwardPassTargetMs: 50, // Fast lookups
|
|
229
|
+
recallTarget: 0.95
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Citation network analysis
|
|
235
|
+
export interface CitationNetworkMetrics {
|
|
236
|
+
networkDensity: number;
|
|
237
|
+
clusteringCoefficient: number;
|
|
238
|
+
averagePathLength: number;
|
|
239
|
+
communityModularity: number;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function analyzeCitationNetwork(papers: ResearchConnection[]): CitationNetworkMetrics {
|
|
243
|
+
// Placeholder implementation
|
|
244
|
+
return {
|
|
245
|
+
networkDensity: 0.15,
|
|
246
|
+
clusteringCoefficient: 0.45,
|
|
247
|
+
averagePathLength: 3.2,
|
|
248
|
+
communityModularity: 0.78
|
|
249
|
+
};
|
|
250
|
+
}
|