Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
03dac06
CommutationMatrix type
alyst Apr 23, 2024
47a1757
simplify elimination_matrix()
alyst Apr 14, 2024
fd212c0
simplify duplication_matrix()
Apr 3, 2024
2984203
add tests for commutation/dublication/elimination matrices
Maximilian-Stefan-Ernst Apr 23, 2024
b6db6b1
small unit test fixes
alyst Apr 23, 2024
3abe92e
commutation_matrix * vec method
alyst Apr 23, 2024
c1e7a69
more comm_matrix tests
alyst Apr 23, 2024
cdc4415
Merge pull request #202 from alyst/spec_matrices
Maximilian-Stefan-Ernst Apr 24, 2024
22542ea
SemSpecification base type
alyst Apr 28, 2024
8d41874
SemSpecification: use in methods
alyst Apr 28, 2024
239a942
rename identifier -> param
alyst Apr 28, 2024
61282bc
ParTable: columns[:identifier] => columns[:param]
alyst Apr 28, 2024
a0e76cc
getindex(EnsParTable, i) instead of get_group()
Mar 17, 2024
e177e29
replace no-op ctors with convert(T, obj)
Mar 17, 2024
161dc58
ParamTable: convert vars from Dict to fields
alyst May 27, 2024
afaff2c
ParamTable: update StenGraph-based ctor
alyst May 27, 2024
6308cdd
rename Base.sort() to sort_vars()
alyst May 27, 2024
92730f8
don't import ==
Mar 11, 2024
83e7828
don't import push!()
Mar 11, 2024
a2eed98
don't import DataFrame
alyst May 2, 2024
458f1cf
remove no-op push!()
Mar 23, 2024
ff2140a
ParTable ctor: simplify rows code
alyst May 27, 2024
edc8443
ParTable: full support for Iterator iface
alyst May 27, 2024
018b077
RAMConstant: simplify
Mar 9, 2024
70e6199
RAMMatrices: optimize F_indices init
Mar 9, 2024
9bf094e
RAMMatrices: declare types for all fields
Mar 9, 2024
9a5842e
RAMMatrices: option to keep zero constants
Mar 10, 2024
296d827
nonunique() helper function
Apr 4, 2024
dec1f4d
add check_vars() and check_params()
alyst May 3, 2024
a7a17df
RAMMatrices ctor: dims and vars checks
alyst May 3, 2024
25cd574
RAMMatrices: cleanup params index
alyst May 3, 2024
98b74d9
include RAMMatrices before EnsParTable
alyst Mar 18, 2024
5cdbe7c
fix EnsParTable to Dict{RAMMatrices} convert
Mar 17, 2024
e71573b
DataFrame(EnsParTable)
Mar 20, 2024
d5ac0d1
params() API method
alyst May 1, 2024
957aa8c
EnsParTable ctor: enforce same params in tables
alyst May 9, 2024
7def9bf
formatting fixes
alyst May 1, 2024
becc6b5
ParTable ctor: allow providing columns data
alyst May 1, 2024
c29b0c7
update_partable!() cleanup + docstring
alyst May 1, 2024
b9d8bc5
update_partable!(): SemFit methods use basic one
alyst May 1, 2024
6a484f1
ParTable: add explicit params field
alyst May 1, 2024
3804cc3
n_par() -> nparams()
Mar 17, 2024
ca9f860
param_values(ParTable)
alyst May 27, 2024
b117b34
lavaan_param_values(lav_fit, partable)
alyst May 1, 2024
398870b
compare_estimates() -> test_estimates()
alyst May 1, 2024
a2518b7
update_partable!(): dict-based generic version
alyst May 27, 2024
84945fa
ParTable: getindex() returns NamedTuple
alyst May 2, 2024
60e864b
ParTable: graph-based ctor supports params= kw
alyst May 2, 2024
88ea6b6
rename parameter_type to relation
alyst May 2, 2024
d57c08b
sem_summary(): cleanup filters
alyst May 2, 2024
14970a2
fix sem_summary method for partable
Maximilian-Stefan-Ernst May 19, 2024
4ba5fa8
show(ParTable): suppress NaNs
alyst May 27, 2024
10ada01
sort_vars!(ParTable): cleanup
alyst May 19, 2024
42da8a8
Project.toml: disable SymbolicUtils 1.6
alyst May 11, 2024
7892b6d
Project.toml: support StenoGraphs 0.3
alyst May 11, 2024
63ae853
RAM ctor: better error for missing meanstruct
Maximilian-Stefan-Ernst May 19, 2024
7a39a0d
add function param_indices
Maximilian-Stefan-Ernst May 19, 2024
79af810
start fixing docs
Maximilian-Stefan-Ernst May 19, 2024
7ba872a
fix regularization docs
Maximilian-Stefan-Ernst May 19, 2024
c3ee769
introduce formatting error
Maximilian-Stefan-Ernst May 19, 2024
5bb89a0
update_start(): fix docstring typo
alyst May 27, 2024
43dceff
push!(::ParTable, Tuple): check keys compat
alyst May 27, 2024
165474c
SemObsCov ctor: restrict n_obs to integer
alyst May 27, 2024
b2012b0
fixup param_indices()
alyst May 27, 2024
55f9087
Merge pull request #203 from alyst/refactor_semspec
Maximilian-Stefan-Ernst May 31, 2024
619d89a
common.jl: common vars API methods
alyst Jul 30, 2024
6aa0fd9
SemSpecification: vars API
alyst Jun 17, 2024
2e4784a
RAMMatrices: vars API
Mar 20, 2024
467c034
ParamTable: vars API
alyst May 27, 2024
d6b1449
SemImply: vars and params API
alyst Jul 30, 2024
56e68e0
RAM imply: use vars API
Mar 17, 2024
e27f028
RAMSymbolic: use vars API
Mar 17, 2024
814d615
start_simple(): use vars API
Mar 17, 2024
0ac47b4
starts_fabin3: use vars API
Mar 17, 2024
0d45014
remove get_colnames()
Mar 12, 2024
09f5eca
remove get_n_nodes()
Mar 17, 2024
3161745
get_data() -> samples()
alyst Jun 17, 2024
08044e1
SemObsData: remove rowwise
alyst Apr 19, 2024
5c0c588
AbstractSemSingle: vars API
alyst Jun 17, 2024
913964b
rename n_obs() -> nsamples()
alyst Jun 17, 2024
35c0466
rename n_man() -> nobserved_vars()
alyst Jun 26, 2024
d22254c
move Sem methods out of types.jl
alyst Jun 17, 2024
1b13c73
rows(::SemObservedMissing) -> pattern_rows()
alyst Jun 17, 2024
aec4358
fix formatting
alyst Jul 30, 2024
95dc477
samples(SemObsCov) throws an exception
alyst Jun 26, 2024
1f67019
SemObserved tests: refactor and add var API tests
alyst Jul 30, 2024
3e9aac3
ParTable(graph): group is only valid for ensemble
alyst Jun 27, 2024
7a07233
ParTable(graph): fix NaN modif detection
alyst Jun 27, 2024
c0e2c9e
export vars, params and observed APIs
alyst Jul 30, 2024
86c172a
refactor SemSpec tests
alyst Jul 30, 2024
2f6e8b7
add Sem unit tests
alyst Jun 27, 2024
399845f
Merge pull request #207 from alyst/vars_api
Maximilian-Stefan-Ernst Jul 31, 2024
e44dc90
Merge pull request #209 from StructuralEquationModels/main
Maximilian-Stefan-Ernst Jul 31, 2024
ae6255a
dont allow fixed and labeled parameters
Maximilian-Stefan-Ernst Aug 7, 2024
fd40fda
Merge pull request #210 from StructuralEquationModels/hotfix/labeled_…
Maximilian-Stefan-Ernst Aug 7, 2024
93ee772
add test for labeled and fixed parameters
Maximilian-Stefan-Ernst Aug 7, 2024
8119ad2
remove get_observed()
alyst Aug 1, 2024
1c179d4
fix ridge eval
Mar 17, 2024
22e76eb
MeanStructure, HessianEvaluation traits
Mar 19, 2024
af09c79
obj/grad/hess: refactor evaluation API
alyst Aug 11, 2024
3c533b6
se_hessian(): rename hessian -> method
alyst Mar 20, 2024
9e33add
se_hessian!(): optimize calc
Mar 23, 2024
5ad013e
H_scaling(): cleanup
alyst Mar 20, 2024
a32903e
SemOptOptim: remove redundant sem_fit()
alyst Mar 21, 2024
7ab2dcb
SemOptNLopt: remove redundant sem_fit()
alyst Mar 21, 2024
65d1112
SemOptOptim: use evaluate!() directly
alyst Mar 21, 2024
9ac8f88
SemOptNLopt: use evaluate!() directly
alyst Mar 21, 2024
cc778e2
SemWLS: dim checks
Apr 3, 2024
0d33ba4
fixup formatting
alyst Aug 11, 2024
1c376a5
WLS: use 5-arg mul!()
Mar 20, 2024
4a6f51b
ML: use 5-arg mul!()
Mar 23, 2024
d2b7e8c
FIML: use 5-arg mul!
Mar 20, 2024
d0ea406
fix the error message
alyst Aug 14, 2024
56ec1c9
HessianEvaluation -> HessianEval
alyst Oct 8, 2024
c673cd1
MeanStructure -> MeanStruct
alyst Oct 8, 2024
0cecaa8
SemImply: replace common type params with fields
alyst Oct 8, 2024
a073af5
Merge pull request #214 from alyst/refactor_evaluate
Maximilian-Stefan-Ernst Oct 29, 2024
6aa591e
Merge pull request #218 from StructuralEquationModels/devel
Maximilian-Stefan-Ernst Oct 29, 2024
d42f4e6
close #216
Maximilian-Stefan-Ernst Oct 29, 2024
23d0ace
close #205
Maximilian-Stefan-Ernst Oct 29, 2024
8a06e9a
update EnsembleParameterTable docs and add methods for par table equa…
Maximilian-Stefan-Ernst Oct 29, 2024
1244d20
close #213
Maximilian-Stefan-Ernst Oct 29, 2024
28ee1ae
close #157
Maximilian-Stefan-Ernst Oct 29, 2024
54354cd
Merge pull request #224 from StructuralEquationModels/release/v0.3.0
Maximilian-Stefan-Ernst Nov 21, 2024
1fd1a6a
add method for
Maximilian-Stefan-Ernst Nov 21, 2024
071005b
format
Maximilian-Stefan-Ernst Nov 21, 2024
a97b4b4
Merge branch 'devel' into simulation-wrapper
Maximilian-Stefan-Ernst Nov 21, 2024
b7c111d
increase test sample size
Maximilian-Stefan-Ernst Nov 21, 2024
8b0322f
Merge pull request #225 from StructuralEquationModels/simulation-wrapper
Maximilian-Stefan-Ernst Nov 21, 2024
3bda87d
Project.toml: update Symbolics deps
Sep 14, 2024
70a4e1f
tests/examples: import -> using
alyst Mar 15, 2024
56a1b04
add ParamsArray
alyst Nov 22, 2024
81d0ab7
materialize!(Symm/LowTri/UpTri)
Mar 22, 2024
fd13c74
ParamsArray: faster sparse materialize!
Mar 22, 2024
19497d5
ParamsArray: use Iterators.flatten() (faster)
Jul 3, 2024
139338d
Base.hash(::ParamsArray)
alyst Aug 11, 2024
5850784
colnames -> vars
alyst Aug 11, 2024
0f747b7
update_partable!(): better params unique check
Apr 4, 2024
aa34d53
start_fabin3: check obs_mean data & meanstructure
alyst Aug 1, 2024
13aacd0
params/vars API tweaks and tests
alyst Nov 22, 2024
8c26c35
generic imply: keep F sparse
Mar 22, 2024
5b9327e
Merge pull request #219 from alyst/params_array
Maximilian-Stefan-Ernst Nov 23, 2024
3816539
tests helper: is_extended_tests()
Mar 12, 2024
b8d9a8f
Optim sem_fit(): use provided optimizer
May 26, 2024
dd275d5
prepare_start_params(): arg-dependent dispatch
alyst Dec 19, 2024
0131bb7
prepare_param_bounds() API for optim
alyst Dec 19, 2024
fbdcc7f
u/l_bounds support for Optim.jl
alyst Dec 19, 2024
d1f323a
SemOptimizer(engine = ...) ctor
alyst Apr 14, 2024
0a6b073
SEMNLOptExt for NLopt
Apr 3, 2024
730eadc
NLopt: sem_fit(): use provided optimizer
alyst Nov 24, 2024
23e2265
SEMProximalOptExt for Proximal opt
alyst Dec 19, 2024
8a98831
merge diff/*.jl optimizer code into optimizer/*.jl
alyst Dec 20, 2024
9e2672d
Optim: document u/l bounds
alyst Dec 20, 2024
d618898
remove unused options field from Proximal optimizer
Maximilian-Stefan-Ernst Dec 19, 2024
d055c78
decouple optimizer from Sem model
alyst Dec 20, 2024
71bced7
fix inequality constraints test
alyst Nov 24, 2024
928af39
add ProximalSEM tests
Maximilian-Stefan-Ernst Dec 20, 2024
c19c4a7
optim/documentation.jl: rename to abstract.jl
alyst Dec 20, 2024
c5b48c7
ext: change folder layout
alyst Dec 20, 2024
b839635
Merge pull request #228 from alyst/optim_extensions
Maximilian-Stefan-Ernst Dec 22, 2024
d5357f0
Project.toml: fix ProximalOperators ID
alyst Dec 24, 2024
48a744f
docs: fix nsamples, nobserved_vars
alyst Aug 1, 2024
5faf116
cleanup data columns reordering
alyst Mar 20, 2024
30e0b24
SemObservedCov: def as an alias of SemObservedData
alyst Jan 1, 2025
86c5e2d
SemObserved: store observed_vars
May 9, 2024
ef1861e
nsamples(observed::SemObserved): unify
May 9, 2024
1d573a3
FIML: simplify index generation
alyst Dec 25, 2024
b825667
SemObservedMissing: refactor
alyst Dec 25, 2024
a848ed3
remove cov_and_mean(): not used anymore
alyst Mar 18, 2024
c952792
SemObserved: unify data preparation
alyst Jan 1, 2025
2596c61
tests: update SemObserved tests
alyst Dec 28, 2024
80a64c9
prep_data: warn if obs_vars order don't match spec
alyst Jan 1, 2025
673aa2b
SemObsData: observed_var_prefix kwarg
alyst Dec 25, 2024
8c7cd14
ParTable: add graph-based kw-only constructor
Maximilian-Stefan-Ernst Jan 2, 2025
ff67cf7
Project.toml: fix ProximalAlgorithms to 0.5
alyst Jan 6, 2025
d3915c1
Merge pull request #230 from alyst/enhance_data_import
Maximilian-Stefan-Ernst Jan 9, 2025
e63d5d8
switch to ProximalAlgorithms.jl v0.7
alyst Jan 6, 2025
e2d6aa1
move params() to common.jl
alyst Aug 11, 2024
92b5741
RAM ctor: use random parameters instead of NaNs
Apr 1, 2024
ae2291a
move check_acyclic() to abstract.jl
alyst Jun 13, 2024
3175257
AbstractSem: improve imply/observed API redirect
alyst Dec 22, 2024
c8b1645
imply -> implied, SemImply -> SemImplied
alyst Jan 9, 2025
39aee3d
imply -> implied: file renames
alyst Dec 23, 2024
1fe165b
close #158
Maximilian-Stefan-Ernst Feb 2, 2025
e051d71
close #232
Maximilian-Stefan-Ernst Feb 2, 2025
03416eb
Merge pull request #240 from StructuralEquationModels/rename_sem_summary
Maximilian-Stefan-Ernst Feb 2, 2025
ba9390f
Merge pull request #235 from alyst/implied_rename
Maximilian-Stefan-Ernst Feb 2, 2025
8b0f880
Update ext/SEMProximalOptExt/ProximalAlgorithms.jl
Maximilian-Stefan-Ernst Feb 2, 2025
351fd70
Merge pull request #234 from alyst/prox_algo_07
Maximilian-Stefan-Ernst Feb 2, 2025
8c703d6
suppress uninformative warnings during package testing
Maximilian-Stefan-Ernst Feb 2, 2025
ba9d2c9
turn simplification of symbolic terms by default off
Maximilian-Stefan-Ernst Feb 3, 2025
cd6413b
new version of StenoGraph results in fewer deprication notices
aaronpeikert Feb 3, 2025
5bebe4e
Merge pull request #241 from StructuralEquationModels/test_warnings
Maximilian-Stefan-Ernst Feb 3, 2025
9244edf
Merge pull request #244 from StructuralEquationModels/make_simplify_o…
Maximilian-Stefan-Ernst Feb 3, 2025
f0df653
fix exporting structs from package extensions
Maximilian-Stefan-Ernst Feb 4, 2025
81a4bd9
fix NLopt extension
Maximilian-Stefan-Ernst Feb 4, 2025
9729819
fix Proximal extension
Maximilian-Stefan-Ernst Feb 4, 2025
127da26
fix printing
Maximilian-Stefan-Ernst Feb 4, 2025
f67d48c
fix regularization docs
Maximilian-Stefan-Ernst Feb 4, 2025
bcfae6a
Merge pull request #246 from StructuralEquationModels/fix_extensions
Maximilian-Stefan-Ernst Feb 4, 2025
0659738
Merge pull request #247 from StructuralEquationModels/devel
Maximilian-Stefan-Ernst Feb 4, 2025
e9dbb62
start reworking docs
Maximilian-Stefan-Ernst Feb 4, 2025
cca2496
finish rewriting docs
Maximilian-Stefan-Ernst Feb 4, 2025
b91f25a
rm ProximalSEM from docs deps
Maximilian-Stefan-Ernst Feb 4, 2025
56650e7
fix docs
Maximilian-Stefan-Ernst Feb 4, 2025
0f09635
fix docs
Maximilian-Stefan-Ernst Feb 4, 2025
5cc61bb
try to fix svgs for docs
Maximilian-Stefan-Ernst Feb 4, 2025
a4b7fe6
try to fix svgs for docs
Maximilian-Stefan-Ernst Feb 4, 2025
a8ae75c
Merge pull request #248 from StructuralEquationModels/documentation/0…
Maximilian-Stefan-Ernst Feb 4, 2025
b327012
update README
Maximilian-Stefan-Ernst Feb 4, 2025
4091804
bump version
Maximilian-Stefan-Ernst Feb 4, 2025
955a181
give macos some slack and format
Maximilian-Stefan-Ernst Feb 4, 2025
c73df59
Rename params (#253) (#257)
Maximilian-Stefan-Ernst Mar 17, 2025
70931dd
merge main
Maximilian-Stefan-Ernst Mar 18, 2025
c50d6f0
add param_labels docstring
Maximilian-Stefan-Ernst Mar 18, 2025
d0cecb1
fix docs
Maximilian-Stefan-Ernst Mar 18, 2025
82a90a3
fix docs
Maximilian-Stefan-Ernst Mar 18, 2025
8a438af
fix docs
Maximilian-Stefan-Ernst Mar 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsAPI = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
StenoGraphs = "78862bba-adae-4a83-bb4d-33c106177f81"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Models you can fit include
- Multigroup SEM
- Sums of arbitrary loss functions (everything the optimizer can handle).

# What are the merrits?
# What are the merits?

We provide fast objective functions, gradients, and for some cases hessians as well as approximations thereof.
As a user, you can easily define custom loss functions.
Expand Down
10 changes: 5 additions & 5 deletions docs/src/developer/loss.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ model = SemFiniteDiff(
loss = (SemML, myridge)
)

model_fit = sem_fit(model)
model_fit = fit(model)
```

This is one way of specifying the model - we now have **one model** with **multiple loss functions**. Because we did not provide a gradient for `Ridge`, we have to specify a `SemFiniteDiff` model that computes numerical gradients with finite difference approximation.
Expand Down Expand Up @@ -117,17 +117,17 @@ model_new = Sem(
loss = (SemML, myridge)
)

model_fit = sem_fit(model_new)
model_fit = fit(model_new)
```

The results are the same, but we can verify that the computational costs are way lower (for this, the julia package `BenchmarkTools` has to be installed):

```julia
using BenchmarkTools

@benchmark sem_fit(model)
@benchmark fit(model)

@benchmark sem_fit(model_new)
@benchmark fit(model_new)
```

The exact results of those benchmarks are of course highly depended an your system (processor, RAM, etc.), but you should see that the median computation time with analytical gradients drops to about 5% of the computation without analytical gradients.
Expand Down Expand Up @@ -241,7 +241,7 @@ model_ml = SemFiniteDiff(
loss = MaximumLikelihood()
)

model_fit = sem_fit(model_ml)
model_fit = fit(model_ml)
```

If you want to differentiate your own loss functions via automatic differentiation, check out the [AutoDiffSEM](https://github.com/StructuralEquationModels/AutoDiffSEM) package.
6 changes: 3 additions & 3 deletions docs/src/developer/optimizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ algorithm(optimizer::SemOptimizerName) = optimizer.algorithm
options(optimizer::SemOptimizerName) = optimizer.options
```

Note that your optimizer is a subtype of `SemOptimizer{:Name}`, where you can choose a `:Name` that can later be used as a keyword argument to `sem_fit(engine = :Name)`.
Note that your optimizer is a subtype of `SemOptimizer{:Name}`, where you can choose a `:Name` that can later be used as a keyword argument to `fit(engine = :Name)`.
Similarly, `SemOptimizer{:Name}(args...; kwargs...) = SemOptimizerName(args...; kwargs...)` should be defined as well as a constructor that uses only keyword arguments:

´´´julia
Expand All @@ -46,10 +46,10 @@ SemOptimizerName(;
´´´
A method for `update_observed` and additional methods might be usefull, but are not necessary.

Now comes the substantive part: We need to provide a method for `sem_fit`:
Now comes the substantive part: We need to provide a method for `fit`:

```julia
function sem_fit(
function fit(
optim::SemOptimizerName,
model::AbstractSem,
start_params::AbstractVector;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/internals/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Source code is in the `"src"` folder:
- `"types.jl"` defines all abstract types and the basic type hierarchy
- `"objective_gradient_hessian.jl"` contains methods for computing objective, gradient and hessian values for different model types as well as generic fallback methods
- The four folders `"observed"`, `"implied"`, `"loss"` and `"diff"` contain implementations of specific subtypes (for example, the `"loss"` folder contains a file `"ML.jl"` that implements the `SemML` loss function).
- `"optimizer"` contains connections to different optimization backends (aka methods for `sem_fit`)
- `"optimizer"` contains connections to different optimization backends (aka methods for `fit`)
- `"optim.jl"`: connection to the `Optim.jl` package
- `"frontend"` contains user-facing functions
- `"specification"` contains functionality for model specification
Expand Down
6 changes: 3 additions & 3 deletions docs/src/performance/mixed_differentiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ model_ridge = SemFiniteDiff(

model_ml_ridge = SemEnsemble(model_ml, model_ridge)

model_ml_ridge_fit = sem_fit(model_ml_ridge)
model_ml_ridge_fit = fit(model_ml_ridge)
```

The results of both methods will be the same, but we can verify that the computation costs differ (the package `BenchmarkTools` has to be installed for this):

```julia
using BenchmarkTools

@benchmark sem_fit(model)
@benchmark fit(model)

@benchmark sem_fit(model_ml_ridge)
@benchmark fit(model_ml_ridge)
```
4 changes: 2 additions & 2 deletions docs/src/performance/mkl.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ To check the performance implications for fitting a SEM, you can use the [`Bench
```julia
using BenchmarkTools

@benchmark sem_fit($your_model)
@benchmark fit($your_model)

using MKL

@benchmark sem_fit($your_model)
@benchmark fit($your_model)
```
2 changes: 1 addition & 1 deletion docs/src/performance/simulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ models = [model1, model2]
fits = Vector{SemFit}(undef, 2)

Threads.@threads for i in 1:2
fits[i] = sem_fit(models[i])
fits[i] = fit(models[i])
end
```

Expand Down
4 changes: 2 additions & 2 deletions docs/src/performance/starting_values.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Starting values

The `sem_fit` function has a keyword argument that takes either a vector of starting values or a function that takes a model as input to compute starting values. Current options are `start_fabin3` for fabin 3 starting values [^Hägglund82] or `start_simple` for simple starting values. Additional keyword arguments to `sem_fit` are passed to the starting value function. For example,
The `fit` function has a keyword argument that takes either a vector of starting values or a function that takes a model as input to compute starting values. Current options are `start_fabin3` for fabin 3 starting values [^Hägglund82] or `start_simple` for simple starting values. Additional keyword arguments to `fit` are passed to the starting value function. For example,

```julia
sem_fit(
fit(
model;
start_val = start_simple,
start_covariances_latent = 0.5
Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/collection/multigroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ model_ml_multigroup = SemEnsemble(
We now fit the model and inspect the parameter estimates:

```@example mg; ansicolor = true
fit = sem_fit(model_ml_multigroup)
update_estimate!(partable, fit)
sem_fit = fit(model_ml_multigroup)
update_estimate!(partable, sem_fit)
details(partable)
```

Expand Down
6 changes: 3 additions & 3 deletions docs/src/tutorials/constraints/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ model = Sem(
data = data
)

model_fit = sem_fit(model)
model_fit = fit(model)

update_estimate!(partable, model_fit)

Expand Down Expand Up @@ -153,7 +153,7 @@ model_constrained = Sem(
data = data
)

model_fit_constrained = sem_fit(constrained_optimizer, model_constrained)
model_fit_constrained = fit(constrained_optimizer, model_constrained)
```

As you can see, the optimizer converged (`:XTOL_REACHED`) and investigating the solution yields
Expand All @@ -162,7 +162,7 @@ As you can see, the optimizer converged (`:XTOL_REACHED`) and investigating the
update_partable!(
partable,
:estimate_constr,
params(model_fit_constrained),
param_labels(model_fit_constrained),
solution(model_fit_constrained),
)

Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/construction/build_by_parts.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ optimizer = SemOptimizerOptim()

model_ml = Sem(observed, implied_ram, loss_ml)

sem_fit(optimizer, model_ml)
fit(optimizer, model_ml)
```
2 changes: 1 addition & 1 deletion docs/src/tutorials/construction/outer_constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ model = SemFiniteDiff(
)
```

constructs a model that will use finite difference approximation if you estimate the parameters via `sem_fit(model)`.
constructs a model that will use finite difference approximation if you estimate the parameters via `fit(model)`.
2 changes: 1 addition & 1 deletion docs/src/tutorials/first_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ model = Sem(
We can now fit the model via

```@example high_level; ansicolor = true
model_fit = sem_fit(model)
model_fit = fit(model)
```

and compute fit measures as
Expand Down
12 changes: 6 additions & 6 deletions docs/src/tutorials/fitting/fitting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
As we saw in [A first model](@ref), after you have build a model, you can fit it via

```julia
model_fit = sem_fit(model)
model_fit = fit(model)

# output

Expand Down Expand Up @@ -45,30 +45,30 @@ Structural Equation Model

## Choosing an optimizer

To choose a different optimizer, you can call `sem_fit` with the keyword argument `engine = ...`, and pass additional keyword arguments:
To choose a different optimizer, you can call `fit` with the keyword argument `engine = ...`, and pass additional keyword arguments:

```julia
using Optim

model_fit = sem_fit(model; engine = :Optim, algorithm = BFGS())
model_fit = fit(model; engine = :Optim, algorithm = BFGS())
```

Available options for engine are `:Optim`, `:NLopt` and `:Proximal`, where `:NLopt` and `:Proximal` are only available if the `NLopt.jl` and `ProximalAlgorithms.jl` packages are loaded respectively.

The available keyword arguments are listed in the sections [Using Optim.jl](@ref), [Using NLopt.jl](@ref) and [Regularization](@ref).

Alternative, you can also explicitely define a `SemOptimizer` and pass it as the first argument to `sem_fit`:
Alternative, you can also explicitely define a `SemOptimizer` and pass it as the first argument to `fit`:

```julia
my_optimizer = SemOptimizerOptim(algorithm = BFGS())

sem_fit(my_optimizer, model)
fit(my_optimizer, model)
```

You may also optionally specify [Starting values](@ref).

# API - model fitting

```@docs
sem_fit
fit
```
19 changes: 10 additions & 9 deletions docs/src/tutorials/inspection/inspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ model = Sem(
data = data
)

model_fit = sem_fit(model)
model_fit = fit(model)
```

After you fitted a model,

```julia
model_fit = sem_fit(model)
model_fit = fit(model)
```

you end up with an object of type [`SemFit`](@ref).
Expand Down Expand Up @@ -87,8 +87,8 @@ We can also update the `ParameterTable` object with other information via [`upda
se_bs = se_bootstrap(model_fit; n_boot = 20)
se_he = se_hessian(model_fit)

update_partable!(partable, :se_hessian, params(model_fit), se_he)
update_partable!(partable, :se_bootstrap, params(model_fit), se_bs)
update_partable!(partable, :se_hessian, param_labels(model_fit), se_he)
update_partable!(partable, :se_bootstrap, param_labels(model_fit), se_bs)

details(partable)
```
Expand Down Expand Up @@ -117,6 +117,11 @@ Additional functions that can be used to extract information from a `SemFit` obj

```@docs
SemFit
params
param_labels
nparams
nsamples
nobserved_vars
```

## Fit measures
Expand All @@ -126,12 +131,8 @@ fit_measures
AIC
BIC
χ²
df
dof
minus2ll
nobserved_vars
nsamples
params
nparams
p_value
RMSEA
```
4 changes: 2 additions & 2 deletions docs/src/tutorials/meanstructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ model = Sem(
meanstructure = true
)

sem_fit(model)
fit(model)
```

If we build the model by parts, we have to pass the `meanstructure = true` argument to every part that requires it (when in doubt, simply consult the documentation for the respective part).
Expand All @@ -112,5 +112,5 @@ ml = SemML(observed = observed, meanstructure = true)

model = Sem(observed, implied_ram, SemLoss(ml))

sem_fit(model)
fit(model)
```
16 changes: 8 additions & 8 deletions docs/src/tutorials/regularization/regularization.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,25 @@ Let's fit the regularized model

```@example reg

fit_lasso = sem_fit(optimizer_lasso, model_lasso)
fit_lasso = fit(optimizer_lasso, model_lasso)
```

and compare the solution to unregularizted estimates:

```@example reg
fit = sem_fit(model)
sem_fit = fit(model)

update_estimate!(partable, fit)
update_estimate!(partable, sem_fit)

update_partable!(partable, :estimate_lasso, params(fit_lasso), solution(fit_lasso))
update_partable!(partable, :estimate_lasso, param_labels(fit_lasso), solution(fit_lasso))

details(partable)
```

Instead of explicitely defining a `SemOptimizerProximal` object, you can also pass `engine = :Proximal` and additional keyword arguments to `sem_fit`:
Instead of explicitely defining a `SemOptimizerProximal` object, you can also pass `engine = :Proximal` and additional keyword arguments to `fit`:

```@example reg
fit = sem_fit(model; engine = :Proximal, operator_g = NormL1(λ))
sem_fit = fit(model; engine = :Proximal, operator_g = NormL1(λ))
```

## Second example - mixed l1 and l0 regularization
Expand All @@ -162,13 +162,13 @@ model_mixed = Sem(
data = data,
)

fit_mixed = sem_fit(model_mixed; engine = :Proximal, operator_g = prox_operator)
fit_mixed = fit(model_mixed; engine = :Proximal, operator_g = prox_operator)
```

Let's again compare the different results:

```@example reg
update_partable!(partable, :estimate_mixed, params(fit_mixed), solution(fit_mixed))
update_partable!(partable, :estimate_mixed, param_labels(fit_mixed), solution(fit_mixed))

details(partable)
```
4 changes: 2 additions & 2 deletions docs/src/tutorials/specification/ram_matrices.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec = RAMMatrices(;
A = A,
S = S,
F = F,
params = θ,
param_labels = θ,
vars = [:x1, :x2, :x3, :y1, :y2, :y3, :y4, :y5, :y6, :y7, :y8, :ind60, :dem60, :dem65]
)

Expand Down Expand Up @@ -90,7 +90,7 @@ spec = RAMMatrices(;
A = A,
S = S,
F = F,
params = θ,
param_labels = θ,
vars = [:x1, :x2, :x3, :y1, :y2, :y3, :y4, :y5, :y6, :y7, :y8, :ind60, :dem60, :dem65]
)
```
Expand Down
4 changes: 2 additions & 2 deletions ext/SEMNLOptExt/NLopt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ function SemFit_NLopt(optimization_result, model::AbstractSem, start_val, opt)
)
end

# sem_fit method
function SEM.sem_fit(
# fit method
function SEM.fit(
optim::SemOptimizerNLopt,
model::AbstractSem,
start_params::AbstractVector;
Expand Down
Loading
Loading