Skip to content

Commit bc08f6a

Browse files
committed
hotfix
1 parent 26b1332 commit bc08f6a

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/cholesky.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ function make_transform_matrix(
255255
# M is in sparse format
256256
# but sometimes it is actually a dense matrix
257257
M = fac\(X'Y)
258-
format_matrix(M, output_format, output_format=output_format, verbose=verbose)
258+
format_matrix(M, output_format, sparse_ratio=sparse_ratio, verbose=verbose)
259259
end
260260

261261
"""

src/make_semantic_matrix.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,35 @@ function make_S_matrix(
381381
sd_noise=1::Int64
382382
)::Matrix
383383

384+
# collect all infl_features
385+
base_f = [f for b in base for f in unique(data[:,b])]
386+
387+
# maps features to indices
388+
base_f2i = Dict(v=>i for (i,v) in enumerate(base_f))
389+
390+
if isdeep # deep mode random means for each feature
391+
base_means = rand(Normal(0, sd_base_mean), length(base_f))
392+
base_m = [rand(Normal(base_means[i], sd_base), ncol) for i in 1:length(base_f)]
393+
else # otherwise use mean=0 for all features
394+
base_m = [rand(Normal(0, sd_base), ncol) for i in 1:length(base_f)]
395+
end
396+
397+
# julia is column-wise language
398+
# assign St first then do transpose is faster
399+
St = Array{AbstractFloat, 2}(undef, ncol, size(data, 1))
400+
for i in 1:size(data, 1)
401+
s_base = sum([base_m[base_f2i[f]] for f in data[i, base]])
402+
s = s_base
403+
St[:,i] = s
404+
end
405+
406+
# add random var to S
407+
if add_noise
408+
noise = rand(Normal(0, sd_noise), size(St, 1), size(St, 2))
409+
St += noise
410+
end
411+
412+
St'
384413
end
385414

386415
"""

0 commit comments

Comments
 (0)