Skip to content

Commit

Permalink
Merge pull request #52 from charles-river-analytics/MultiInterfaceRej…
Browse files Browse the repository at this point in the history
…uvinate

MultiInterface.jl Rejuvenation
  • Loading branch information
mharradon authored Apr 10, 2024
2 parents b9066fb + 3631dda commit bed4ae8
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 1,916 deletions.
381 changes: 154 additions & 227 deletions MultiInterface.jl/src/MultiInterface.jl

Large diffs are not rendered by default.

788 changes: 0 additions & 788 deletions MultiInterface.jl/src/validation.jl

This file was deleted.

693 changes: 0 additions & 693 deletions MultiInterface.jl/test/validation.jl

This file was deleted.

2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.8.5"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Cassette = "7057c7e9-c182-5462-911a-8362d720325c"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand All @@ -24,7 +23,6 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[compat]
AbstractTrees = "0.3.4 - 0.4"
Cassette = "0.3"
DataStructures = "0.18.11"
Distributions = "0.25.52"
Folds = "0.2.7"
Expand Down
1 change: 0 additions & 1 deletion src/Scruff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ include("models.jl") ## Scruff.Models module
include("runtime.jl") ## Scruff module
include("runtime_utils.jl") ## Scruff.RTUtils module
include("algorithms.jl") ## Scruff.Algorithms module
include("logger.jl") ## Scruff module

end
5 changes: 4 additions & 1 deletion src/algorithms/instant/importance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ It proposes a value for the `instance` from its sfunc, and scores it by the evid
if any.
"""
function rejection_proposal(runtime::Runtime, instance::VariableInstance)
proposer(parent_values) = (sample(get_sfunc(instance), parent_values), 0.0)
sfunc = get_sfunc(instance)
proposer(parent_values) = (sample(sfunc, parent_values), 0.0)
proposer
end

function _get_hard_evidence(runtime, instance)::Union{HardScore, Nothing}
Expand Down Expand Up @@ -152,6 +154,7 @@ LW(num_particles) = Importance(lw_proposal, num_particles)

function _importance(runtime::Runtime, num_samples::Int, proposal_function::Function,
samples::Vector{Dict{Symbol, Any}}, lws)

net = runtime.network
nodes = topsort(get_initial_graph(net))
proposers = Function[]
Expand Down
204 changes: 0 additions & 204 deletions src/logger.jl

This file was deleted.

5 changes: 5 additions & 0 deletions src/sfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ using ..MultiInterface

using ...Scruff
using ..Utils
using ..Operators
import ..Operators
Operators.@import_operators()
import ..Operators: __OptVec, Support, SupportQuality

macro impl(expr)
return esc(MultiInterface.impl(__module__, __source__, expr, Operators))
end

include("sfuncs/dist/dist.jl")
include("sfuncs/dist/cat.jl")
include("sfuncs/dist/constant.jl")
Expand Down

0 comments on commit bed4ae8

Please sign in to comment.