dendritic_autodiff/
lib.rs

1
2//! # Dendritic Autodifferentiation Crate
3//!
4//! This crate allows for autodifferentiation to be performed during backpropogation of some ML algorithms.
5//! The autodiff library currently supports operations for weight regularization, dot product and elementwise operations.
6//! This crate serves as the base depedencies for most of the algorithms in the regression package
7//!
8//! ## Features
9//! - **Node**: Node structure for holding shared methods across all values in a computation graph.
10//! - **Ops**: Operations with forward and backward pass implemented
11//! - **Regularizers**: Operations specific to weight regualarization to prevent overfitting
12//!
13//! ## Example Usage
14//! This is an example of creating the computation graph for a linear operation
15
16//! ```rust
17//! use dendritic_ndarray::ndarray::NDArray;
18//! use dendritic_ndarray::ops::*;
19//! use dendritic_autodiff::node::*; 
20//! use dendritic_autodiff::ops::*;
21//! use dendritic_autodiff::regularizers::*; 
22//!
23//! fn main() {
24
25//!     //Load saved ndarrays (model parameters)
26//!     let x_path = "data/linear_modeling_data/inputs"; 
27//!     let w_path = "data/linear_modeling_data/weights";
28//!     let b_path = "data/linear_modeling_data/bias";
29//!
30//!     let x: NDArray<f64> = NDArray::load(x_path).unwrap();
31//!     let w: NDArray<f64> = NDArray::load(w_path).unwrap();
32//!     let b: NDArray<f64> = NDArray::load(b_path).unwrap();
33//!
34//!     // Convert ndarrays to value nodes
35//!     let inputs = Value::new(&x);
36//!     let weights = Value::new(&w);
37//!     let bias = Value::new(&b);
38//!
39//!     // Create computation graph for linear layer
40//!     let mut linear= ScaleAdd::new(
41//!         Dot::new(inputs.clone(), weights.clone()),
42//!         bias
43//!     );
44//!
45//!     linear.forward(); // perform forward pass
46//! }
47//! ```
48//! ## Disclaimer
49//! The dendritic project is a toy machine learning library built for learning and research purposes.
50//! It is not advised by the maintainer to use this library as a production ready machine learning library.
51//! This is a project that is still very much a work in progress.
52pub mod node;
53pub mod ops;
54pub mod regularizers;