Skip to content

Commit

Permalink
Update Constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
paschermayr committed Oct 24, 2022
1 parent 1e45efb commit 5ec10fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Baytes"
uuid = "72ddfcfc-6e9d-43df-829b-7aed7c549d4f"
authors = ["Patrick Aschermayr <p.aschermayr@gmail.com>"]
version = "0.2.0"
version = "0.2.1"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand Down
13 changes: 10 additions & 3 deletions src/sampling/construct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function construct(
tempering::BaytesCore.TemperingMethod,
datatune::DataTune,
chains::Integer,
updatesampler::BaytesCore.UpdateBool,
args...;
) where {D}
## Initiate Tempering Tune with correct model parameter type.
Expand All @@ -91,7 +92,7 @@ function construct(
_rng,
modelᵛ[begin],
BaytesCore.adjust(datatuneᵛ[begin], data),
temperature₀,
BaytesCore.ProposalTune(temperature₀, updatesampler, datatuneᵛ[begin]),
default
),
args,
Expand All @@ -104,7 +105,7 @@ function construct(
algorithm -> algorithm(
_rng, modelᵛ[Nchain],
BaytesCore.adjust(datatuneᵛ[Nchain], data),
temperature₀,
BaytesCore.ProposalTune(temperature₀, updatesampler, datatuneᵛ[Nchain]),
default
),
args,
Expand All @@ -120,14 +121,20 @@ function construct(
tempering::BaytesCore.TemperingMethod,
datatune::DataTune,
chains::Integer,
updatesampler::BaytesCore.UpdateBool,
smc::SMCConstructor;
) where {D}
## Assign tempering struct with correct temperature type
temperingtune, temperature₀ = construct(tempering, model, default.chains)
## Assign model for chains
modelᵛ, datatuneᵛ = construct(model, datatune, chains, smc)
## Assign algorithm
algorithmsᵛ = smc(_rng, model, BaytesCore.adjust(datatune, data), temperature₀, default)
algorithmsᵛ = smc(_rng,
model,
BaytesCore.adjust(datatune, data),
BaytesCore.ProposalTune(temperature₀, updatesampler, datatune),
default
)
return modelᵛ, algorithmsᵛ, temperingtune, datatuneᵛ
end

Expand Down
2 changes: 1 addition & 1 deletion src/sampling/sample.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function sample(
## Initialize algorithms
println("Constructing new sampler...")
modelᵛ, algorithmᵛ, tempertune, datatuneᵛ = construct(
_rng, model, data, default, tempering, datatune, chains, args...
_rng, model, data, default, tempering, datatune, chains, updatesampler, args...
)
## Initialize trace
trace = Trace(
Expand Down

2 comments on commit 5ec10fe

@paschermayr
Copy link
Owner Author

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/70933

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.1 -m "<description of version>" 5ec10fe32713631739f0a78c51418ebe36058d1e
git push origin v0.2.1

Please sign in to comment.