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 131-135)
128fn deep_boltzmann_demo() -> Result<()> {
129 // Create a 3-layer DBM
130 let layer_sizes = vec![8, 4, 2];
131 let mut dbm = DeepBoltzmannMachine::new(
132 layer_sizes.clone(),
133 1.0, // temperature
134 0.01, // learning rate
135 )?;
136
137 println!(" Created Deep Boltzmann Machine:");
138 println!(" - Architecture: {layer_sizes:?}");
139 println!(" - Total layers: {}", dbm.rbms().len());
140
141 // Generate hierarchical data
142 let data = generate_hierarchical_data(300, 8);
143
144 // Layer-wise pretraining
145 println!("\n Performing layer-wise pretraining...");
146 dbm.pretrain(
147 &data, 50, // epochs per layer
148 30, // batch size
149 )?;
150
151 println!("\n Pretraining complete!");
152 println!(" Each layer learned increasingly abstract features");
153
154 Ok(())
155}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 146-149)
128fn deep_boltzmann_demo() -> Result<()> {
129 // Create a 3-layer DBM
130 let layer_sizes = vec![8, 4, 2];
131 let mut dbm = DeepBoltzmannMachine::new(
132 layer_sizes.clone(),
133 1.0, // temperature
134 0.01, // learning rate
135 )?;
136
137 println!(" Created Deep Boltzmann Machine:");
138 println!(" - Architecture: {layer_sizes:?}");
139 println!(" - Total layers: {}", dbm.rbms().len());
140
141 // Generate hierarchical data
142 let data = generate_hierarchical_data(300, 8);
143
144 // Layer-wise pretraining
145 println!("\n Performing layer-wise pretraining...");
146 dbm.pretrain(
147 &data, 50, // epochs per layer
148 30, // batch size
149 )?;
150
151 println!("\n Pretraining complete!");
152 println!(" Each layer learned increasingly abstract features");
153
154 Ok(())
155}Sourcepub fn rbms(&self) -> &[QuantumRBM]
pub fn rbms(&self) -> &[QuantumRBM]
Get the RBMs
Examples found in repository?
examples/quantum_boltzmann.rs (line 139)
128fn deep_boltzmann_demo() -> Result<()> {
129 // Create a 3-layer DBM
130 let layer_sizes = vec![8, 4, 2];
131 let mut dbm = DeepBoltzmannMachine::new(
132 layer_sizes.clone(),
133 1.0, // temperature
134 0.01, // learning rate
135 )?;
136
137 println!(" Created Deep Boltzmann Machine:");
138 println!(" - Architecture: {layer_sizes:?}");
139 println!(" - Total layers: {}", dbm.rbms().len());
140
141 // Generate hierarchical data
142 let data = generate_hierarchical_data(300, 8);
143
144 // Layer-wise pretraining
145 println!("\n Performing layer-wise pretraining...");
146 dbm.pretrain(
147 &data, 50, // epochs per layer
148 30, // batch size
149 )?;
150
151 println!("\n Pretraining complete!");
152 println!(" Each layer learned increasingly abstract features");
153
154 Ok(())
155}Auto Trait Implementations§
impl Freeze for DeepBoltzmannMachine
impl RefUnwindSafe for DeepBoltzmannMachine
impl Send for DeepBoltzmannMachine
impl Sync for DeepBoltzmannMachine
impl Unpin 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.