diff --git a/src/mlp.rs b/src/mlp.rs index e2c5045..bfeab48 100644 --- a/src/mlp.rs +++ b/src/mlp.rs @@ -146,6 +146,24 @@ impl MLP { // Phase 2 implementation } + /// Number of input features the network expects. + pub fn input_size(&self) -> usize { + self.input_size + } + + /// Number of output classes the network produces. + pub fn output_size(&self) -> usize { + self.output_size + } + + /// Run one training step: compute loss and gradients via `backward`, + /// apply them with `update`, and return the loss for this step. + pub fn train_step(&mut self, input: &[f32], target: &[f32], learning_rate: f32) -> f32 { + let (loss, gradients) = self.backward(input, target); + self.update(&gradients, learning_rate); + loss + } + /// Argmax: Return the index of the maximum value. pub fn argmax(values: &[f32]) -> usize { values diff --git a/src/orchestrator.rs b/src/orchestrator.rs index 0ae248a..e139bf2 100644 --- a/src/orchestrator.rs +++ b/src/orchestrator.rs @@ -88,6 +88,11 @@ impl Orchestrator { self.context.switch_project(project); } + /// Borrow the active project name, if one is set. + pub fn current_project(&self) -> Option<&str> { + self.context.current_project() + } + /// Drop the active project's conversation history. pub fn clear_history(&mut self) { self.context.clear_history();