pub struct Model {Show 15 fields
pub layers: Vec<Layer>,
pub lambda: f64,
pub optimizer: Optimizer,
pub layers_debug: Option<Vec<Layer>>,
pub input: Option<Matrix>,
pub input_label: Option<Matrix>,
pub itermediate_evaluation_results: Option<Vec<Matrix>>,
pub softmax_output: Option<Matrix>,
pub data_loss: Option<f64>,
pub reg_loss: Option<f64>,
pub loss: Option<f64>,
pub d_score: Option<Matrix>,
pub d_zs: Option<Vec<Matrix>>,
pub d_ws: Option<Vec<Matrix>>,
pub d_bs: Option<Vec<Matrix>>,
}Fields§
§layers: Vec<Layer>§lambda: f64§optimizer: Optimizer§layers_debug: Option<Vec<Layer>>§input: Option<Matrix>§input_label: Option<Matrix>§itermediate_evaluation_results: Option<Vec<Matrix>>§softmax_output: Option<Matrix>§data_loss: Option<f64>§reg_loss: Option<f64>§loss: Option<f64>§d_score: Option<Matrix>§d_zs: Option<Vec<Matrix>>§d_ws: Option<Vec<Matrix>>§d_bs: Option<Vec<Matrix>>Implementations§
Source§impl Model
impl Model
pub fn init(layers: Vec<Layer>, optimizer: Optimizer, lambda: f64) -> Model
Sourcepub fn evaluate(&mut self, input: &Matrix, debug: bool) -> Matrix
pub fn evaluate(&mut self, input: &Matrix, debug: bool) -> Matrix
Examples found in repository?
examples/mnist.rs (line 28)
14pub fn testing() {
15 println!("extracting mnist data...");
16 let labels: Matrix = extract_labels("t10k-labels.idx1-ubyte");
17 let mut images: Matrix = extract_images("t10k-images.idx3-ubyte");
18 println!("extraction done");
19
20 images.normalize();
21 println!("number of images {}", images.height);
22 println!("number of pixels in each image {}", images.width);
23
24 println!("loading pre-trained model...");
25 let mut model: Model = load_model("mnist_128x128".to_string()).unwrap();
26
27 println!("evaluating...");
28 let score = model.evaluate(&images, false);
29 let acc = model.accuracy(&score, &labels);
30
31 println!("acc : {}", acc);
32}pub fn compute_loss( &mut self, output: &Matrix, labels: &Matrix, debug: bool, ) -> (f64, f64)
pub fn compute_d_score(score: &Matrix, labels: &Matrix) -> Matrix
pub fn update_params( &mut self, d_score: Matrix, input: Matrix, iteration: i32, debug: bool, )
pub fn train( &mut self, data: &Matrix, labels: &Matrix, batch_size: u32, epochs: u32, validation_dataset_size: usize, checkpoint: Option<Checkpoint>, print_frequency: usize, debug: bool, silent_mode: bool, ) -> Option<Vec<Model>>
Sourcepub fn accuracy(&mut self, score: &Matrix, labels: &Matrix) -> f64
pub fn accuracy(&mut self, score: &Matrix, labels: &Matrix) -> f64
Examples found in repository?
examples/mnist.rs (line 29)
14pub fn testing() {
15 println!("extracting mnist data...");
16 let labels: Matrix = extract_labels("t10k-labels.idx1-ubyte");
17 let mut images: Matrix = extract_images("t10k-images.idx3-ubyte");
18 println!("extraction done");
19
20 images.normalize();
21 println!("number of images {}", images.height);
22 println!("number of pixels in each image {}", images.width);
23
24 println!("loading pre-trained model...");
25 let mut model: Model = load_model("mnist_128x128".to_string()).unwrap();
26
27 println!("evaluating...");
28 let score = model.evaluate(&images, false);
29 let acc = model.accuracy(&score, &labels);
30
31 println!("acc : {}", acc);
32}pub fn evaluation_output(score: &Matrix) -> Matrix
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnwindSafe for Model
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more