Skip to content

Commit 8311f51

Browse files
authored
Merge pull request #16 from lanl-ansi/multi-symmetrization
Adding Symmetrization to multiRISE
2 parents 3ed16a4 + 9058e83 commit 8311f51

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/GraphicalModelLearning.jl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,22 @@ function learn{T <: Real}(samples::Array{T,2}, formulation::multiRISE, method::N
129129
reconstruction[inter] = deepcopy(nodal_reconstruction[inter])
130130
end
131131
end
132-
#if formulation.symmetrization
133-
# reconstruction = 0.5*(reconstruction + transpose(reconstruction))
134-
#end
132+
133+
if formulation.symmetrization
134+
reconstruction_list = Dict{Tuple,Vector{Real}}()
135+
for (k,v) in reconstruction
136+
key = tuple(sort([i for i in k])...)
137+
if !haskey(reconstruction_list, key)
138+
reconstruction_list[key] = Vector{Real}()
139+
end
140+
push!(reconstruction_list[key], v)
141+
end
142+
143+
reconstruction = Dict{Tuple,Real}()
144+
for (k,v) in reconstruction_list
145+
reconstruction[k] = mean(v)
146+
end
147+
end
135148

136149
return reconstruction
137150
end

0 commit comments

Comments
 (0)