Skip to content

Commit 5d4b36c

Browse files
add details method for AbstractSem
1 parent 93d22da commit 5d4b36c

1 file changed

Lines changed: 34 additions & 3 deletions

File tree

src/frontend/fit/summary.jl

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
function details(sem::AbstractSem)
2+
print("Structural Equation Model")
3+
print(_subtype_info(sem))
4+
print("\n")
5+
print("- Loss Functions \n")
6+
for term in loss_terms(sem)
7+
print(" > ")
8+
details(term)
9+
println()
10+
end
11+
end
12+
13+
function details(term::LossTerm)
14+
if !issemloss(term)
15+
print(term.loss)
16+
else
17+
println("Structural Equation Model Loss ($(nameof(typeof(term.loss))))")
18+
if !isnothing(id(term))
19+
print(" - id: $(id(term)) \n")
20+
end
21+
println(" - Observed: $(nameof(typeof(observed(term)))) ($(nsamples(term)) samples)")
22+
println(" - Implied: $(nameof(typeof(implied(term)))) ($(nparams(term)) parameters)")
23+
println(" - Variables: $(nobserved_vars(term)) observed, $(nlatent_vars(term)) latent")
24+
if !isnothing(weight(term))
25+
print(" - weight: $(round(weight(term), digits=3))")
26+
end
27+
end
28+
end
29+
130
function details(sem_fit::SemFit; show_fitmeasures = false, color = :light_cyan, digits = 2)
231
print("\n")
332
println("Fitted Structural Equation Model")
@@ -325,11 +354,13 @@ function Base.findall(fun::Function, partable::ParameterTable)
325354
end
326355

327356
"""
328-
(1) details(sem_fit::SemFit; show_fitmeasures = false)
357+
(1) details(model::AbstractSem)
358+
359+
(2) details(sem_fit::SemFit; show_fitmeasures = false)
329360
330-
(2) details(partable::AbstractParameterTable; ...)
361+
(3) details(partable::AbstractParameterTable; ...)
331362
332-
Print information about (1) a fitted SEM or (2) a parameter table to stdout.
363+
Print information about (1) a SEM, (2) a fitted SEM or (3) a parameter table to stdout.
333364
334365
# Extended help
335366
## Addition keyword arguments

0 commit comments

Comments
 (0)