cossio / RestrictedBoltzmannMachines.jl

Train and sample Restricted Boltzmann machines in Julia
MIT License
15 stars 3 forks source link

example code for testing out GaussianRBM #24

Closed bhomass closed 1 year ago

bhomass commented 1 year ago

I want to try GaussianRBM, but there isn't any examples code. The GaussianRBM constructor starts with the mean and std of the input layer. These parameters afaik are learned parameters during model training. How can they be fed during the instantiation of the model? unless you mean some random initial value.

if so, what random value should I enter?

bhomass commented 1 year ago

looks like the values are initialized to 0, and 1, respectively for the hidden gaussian mean and std. but no clue to the visible parameters.

bhomass commented 1 year ago

function Gaussian(::Type{T}, sz::Dims) where {T} θ = zeros(T, sz) γ = ones(T, sz) return Gaussian(; θ, γ) end

This suggests initial θ, γ is also 0, and 1 for the visible?

cossio commented 1 year ago

Gaussian is constructed with zero θ and unit γ by default. But initialize!(rbm, data) can be used to set the visible layer parameters (in this case, θ, γ) so as to match the single site statistics of the data (mean, variance).

bhomass commented 1 year ago

nice. thanks!