Skip to content

Commit

Permalink
cd keyword and up version
Browse files Browse the repository at this point in the history
  • Loading branch information
cossio committed Sep 3, 2020
1 parent 3458039 commit 780790a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RestrictedBoltzmannMachines"
uuid = "12e6b396-7db5-4506-8cb6-664a4fe1e50e"
authors = ["Jorge Fernandez-de-Cossio-Diaz <[email protected]>"]
version = "0.2.5"
version = "0.2.6"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
4 changes: 2 additions & 2 deletions src/train/cd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ end
end

"""
train!(rbm, data, [cd])
train!(rbm, data)
We measure training time in units of observations presented to the model.
For example, if you want to train for 100 epochs, then set `iters = 100 * data.nobs`,
where `data.nobs` is the number of observations in the dataset.
"""
function train!(rbm::RBM, data::Data, cd::Union{CD,PCD} = PCD();
function train!(rbm::RBM, data::Data; cd::Union{CD,PCD} = PCD(),
iters::Int, opt = ADAM(), ps::Params = params(rbm),
vm::AbstractArray = update_chains(rbm, cd, first(data).v), # Markov chains
history = nothing, # stores training history
Expand Down
2 changes: 1 addition & 1 deletion test/profile/profiling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Profile.init(n=10^7, delay=0.01)
@time train!(rbm, train_loader)
@profiler train!(rbm, train_loader)

train!(rbm, train_loader, PCD(1))
train!(rbm, train_loader)
#@descend train!(rbm, train_loader)
first(train_loader)

Expand Down
4 changes: 2 additions & 2 deletions test/rbm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ end
gauge!(student)
@test norm(teacher.weights) 1
ps = params(student.weights)
train!(student, train_data, PCD(5); iters=10000 * 32, ps = ps, opt = Flux.ADAM())
train!(student, train_data; cd=PCD(5), iters=10000 * 32, ps = ps, opt = Flux.ADAM())
@test norm(teacher.weights) 1
@show dot(teacher.weights, student.weights)
@test abs(dot(teacher.weights, student.weights)) 0.8
Expand All @@ -174,7 +174,7 @@ end
gauge!(student)
@test norm(teacher.weights) 1
ps = params(student.weights)
train!(student, train_data, PCD(5); iters=10000 * 32, ps = ps, opt = Flux.ADAM())
train!(student, train_data; cd=PCD(5), iters=10000 * 32, ps = ps, opt = Flux.ADAM())
@test norm(teacher.weights) 1
@show dot(teacher.weights, student.weights)
@test abs(dot(teacher.weights, student.weights)) 0.8
Expand Down

2 comments on commit 780790a

@cossio
Copy link
Owner

@cossio cossio commented on 780790a Sep 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/20761

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.6 -m "<description of version>" 780790a0acc27dfe82a5edb1b9a69ad6707ba576
git push origin v0.2.6

Please sign in to comment.