1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//! # OptiRS Learned - Learned Optimizers and Meta-Learning
//!
//! **Version:** 0.3.1
//! **Status:** Research Phase (Early Implementation)
//!
//! ⚠️ **Warning:** This crate is in early research phase. APIs may change significantly
//! in future releases. Not recommended for production use.
//!
//! `optirs-learned` provides learned optimizers, meta-learning algorithms, and adaptive
//! optimization systems built on [SciRS2](https://github.com/cool-japan/scirs).
//!
//! ## Dependencies
//!
//! - `scirs2-core` 0.1.1 - Required foundation
//! - `optirs-core` 0.1.0 - Core optimizers
//!
//! ## Implementation Status (v0.1.0)
//!
//! - 🚧 Transformer-based optimizers (in development)
//! - 🚧 LSTM optimizers (planned)
//! - 🚧 Meta-learning framework (in development)
//! - 📝 Research prototypes only
//! - 📝 No production-ready implementations yet
//!
//! ## Status: Research Phase
//!
//! This crate implements cutting-edge research in learned optimization.
//!
//! ## Features
//!
//! ### Transformer-Based Optimizers
//! - **Self-Attention** - Learn optimization patterns across parameters
//! - **Cross-Attention** - Share optimization knowledge between layers
//! - **Positional Encoding** - Parameter-aware optimization
//! - **Multi-Head** - Diverse optimization strategies
//!
//! ### LSTM Optimizers
//! - **Recurrent State** - Maintain long-term optimization memory
//! - **Gating Mechanisms** - Adaptive learning rate control
//! - **Sequence Modeling** - Learn optimization trajectories
//! - **Stateful Updates** - Context-aware parameter updates
//!
//! ### Meta-Learning
//! - **MAML** - Model-Agnostic Meta-Learning
//! - **Reptile** - First-order meta-learning
//! - **Meta-SGD** - Learn learning rates and update rules
//! - **Task Adaptation** - Rapid fine-tuning on new tasks
//!
//! ### Few-Shot Optimization
//! - **Fast Adaptation** - Few-step convergence on new problems
//! - **Transfer Learning** - Knowledge transfer across domains
//! - **Online Learning** - Continuous adaptation during training
//! - **Hypernetworks** - Generate optimizer parameters on-the-fly
//!
//! ## Example Usage (Future)
//!
//! ```rust,ignore
//! use optirs_learned::{TransformerOptimizer, MetaLearningConfig};
//! use scirs2_core::ndarray::Array1;
//!
//! // Create transformer-based optimizer
//! let config = MetaLearningConfig {
//! num_heads: 8,
//! hidden_dim: 256,
//! num_layers: 4,
//! };
//!
//! let mut optimizer = TransformerOptimizer::new(config)?;
//!
//! // Meta-train on multiple tasks
//! for task in tasks {
//! optimizer.meta_train(&task)?;
//! }
//!
//! // Rapid adaptation to new task
//! let params = Array1::from_elem(1000, 1.0);
//! let grads = Array1::from_elem(1000, 0.01);
//! let updated = optimizer.step(¶ms, &grads)?; // Fast convergence
//! ```
//!
//! ## Research Highlights
//!
//! - **Outperforms Hand-Designed** - Better than Adam on many tasks
//! - **Generalizes Across Domains** - Vision, NLP, RL all benefit
//! - **Few-Shot Learning** - Converges in 10-100 steps vs thousands
//! - **Adaptive Schedules** - Learns optimal learning rate schedules
//!
//! ## Architecture
//!
//! Built exclusively on SciRS2:
//! - **ML Pipeline**: `scirs2_core::ml_pipeline::MLPipeline`
//! - **Neural**: `scirs2_core::neural_architecture_search`
//! - **Memory**: `scirs2_core::memory_efficient::LazyArray`
//! - **Metrics**: `scirs2_core::ml_pipeline::PipelineMetrics`
//!
//! ## References
//!
//! - Learning to Learn by Gradient Descent by Gradient Descent (Andrychowicz et al., 2016)
//! - Learned Optimizers that Scale and Generalize (Metz et al., 2022)
//! - VeLO: Training Versatile Learned Optimizers (Metz et al., 2023)
//!
//! ## Contributing
//!
//! Research contributions welcome! Follow SciRS2 integration guidelines.
pub use ;
pub use ;
pub use ;
pub use LSTMOptimizer;
pub use TransformerOptimizer;
pub use TransformerOptimizer as TransformerBasedOptimizer;