pub struct DeepBoltzmannMachine { /* private fields */ }Expand description
Deep Boltzmann Machine with multiple layers
Implementations§
Source§impl DeepBoltzmannMachine
impl DeepBoltzmannMachine
Sourcepub fn new(
layer_sizes: Vec<usize>,
temperature: f64,
learning_rate: f64,
) -> Result<Self>
pub fn new( layer_sizes: Vec<usize>, temperature: f64, learning_rate: f64, ) -> Result<Self>
Create a new Deep Boltzmann Machine
Examples found in repository?
examples/quantum_boltzmann.rs (lines 139-143)
136fn deep_boltzmann_demo() -> Result<()> {
137 // Create a 3-layer DBM
138 let layer_sizes = vec![8, 4, 2];
139 let mut dbm = DeepBoltzmannMachine::new(
140 layer_sizes.clone(),
141 1.0, // temperature
142 0.01, // learning rate
143 )?;
144
145 println!(" Created Deep Boltzmann Machine:");
146 println!(" - Architecture: {layer_sizes:?}");
147 println!(" - Total layers: {}", dbm.rbms().len());
148
149 // Generate hierarchical data
150 let data = generate_hierarchical_data(300, 8);
151
152 // Layer-wise pretraining
153 println!("\n Performing layer-wise pretraining...");
154 dbm.pretrain(
155 &data, 50, // epochs per layer
156 30, // batch size
157 )?;
158
159 println!("\n Pretraining complete!");
160 println!(" Each layer learned increasingly abstract features");
161
162 Ok(())
163}Sourcepub fn pretrain(
&mut self,
data: &Array2<f64>,
epochs_per_layer: usize,
batch_size: usize,
) -> Result<()>
pub fn pretrain( &mut self, data: &Array2<f64>, epochs_per_layer: usize, batch_size: usize, ) -> Result<()>
Layer-wise pretraining
Examples found in repository?
examples/quantum_boltzmann.rs (lines 154-157)
136fn deep_boltzmann_demo() -> Result<()> {
137 // Create a 3-layer DBM
138 let layer_sizes = vec![8, 4, 2];
139 let mut dbm = DeepBoltzmannMachine::new(
140 layer_sizes.clone(),
141 1.0, // temperature
142 0.01, // learning rate
143 )?;
144
145 println!(" Created Deep Boltzmann Machine:");
146 println!(" - Architecture: {layer_sizes:?}");
147 println!(" - Total layers: {}", dbm.rbms().len());
148
149 // Generate hierarchical data
150 let data = generate_hierarchical_data(300, 8);
151
152 // Layer-wise pretraining
153 println!("\n Performing layer-wise pretraining...");
154 dbm.pretrain(
155 &data, 50, // epochs per layer
156 30, // batch size
157 )?;
158
159 println!("\n Pretraining complete!");
160 println!(" Each layer learned increasingly abstract features");
161
162 Ok(())
163}Sourcepub fn rbms(&self) -> &[QuantumRBM]
pub fn rbms(&self) -> &[QuantumRBM]
Get the RBMs
Examples found in repository?
examples/quantum_boltzmann.rs (line 147)
136fn deep_boltzmann_demo() -> Result<()> {
137 // Create a 3-layer DBM
138 let layer_sizes = vec![8, 4, 2];
139 let mut dbm = DeepBoltzmannMachine::new(
140 layer_sizes.clone(),
141 1.0, // temperature
142 0.01, // learning rate
143 )?;
144
145 println!(" Created Deep Boltzmann Machine:");
146 println!(" - Architecture: {layer_sizes:?}");
147 println!(" - Total layers: {}", dbm.rbms().len());
148
149 // Generate hierarchical data
150 let data = generate_hierarchical_data(300, 8);
151
152 // Layer-wise pretraining
153 println!("\n Performing layer-wise pretraining...");
154 dbm.pretrain(
155 &data, 50, // epochs per layer
156 30, // batch size
157 )?;
158
159 println!("\n Pretraining complete!");
160 println!(" Each layer learned increasingly abstract features");
161
162 Ok(())
163}Auto Trait Implementations§
impl Freeze for DeepBoltzmannMachine
impl RefUnwindSafe for DeepBoltzmannMachine
impl Send for DeepBoltzmannMachine
impl Sync for DeepBoltzmannMachine
impl Unpin for DeepBoltzmannMachine
impl UnsafeUnpin for DeepBoltzmannMachine
impl UnwindSafe for DeepBoltzmannMachine
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.