-
Notifications
You must be signed in to change notification settings - Fork 6
Multiple Refactorings #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
for resolving the scope
* both columns and vars * remove _vars suffix from variable categories ("variables" is already a field name)
* destructure lambda function args * don't use zip(): mapreduce support multi-arg functions
to match julia naming convention
avoids full evalulation when the end result is known
* simplify parameters() function to return just a vector of params * RAMMatrices ctor: warn on duplicate params
* introduce ArrayParamsMap type for clarity * annotate types of the corresp. RAMMatrices fields * rename get_parameter_indices() into array_parameters_map[_linear()] (two distinct functions without kwarg for type stability) and remove cartesian2linear() (not needed) * use the single pass over the array for performance
RAMMatrices depend on RAMConstant type
* declare RAMConstant field types * refactor constants collection to avoid code duplication
* this method is not RAMMatrices ctor, it is Dict{K, RAMMatrices} convert * use comprehension to construct dict
convert() is a proper method to call to avoid unnecessary construction, ctor semantics requires that a new object is constructed
* use named tuples * reduce code duplication
* use graph as a main parameter * simplify rows processing * don't reallocate table.columns
so EM MVN could be done when SemObsMissing is constructed
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #181 +/- ##
==========================================
- Coverage 67.22% 62.57% -4.66%
==========================================
Files 51 59 +8
Lines 2490 2322 -168
==========================================
- Hits 1674 1453 -221
- Misses 816 869 +53 ☔ View full report in Codecov by Sentry. |
to make tests pass
I have benchmarked one of my models (~120 observed variables, generic imply, ML) 2 weeks ago.
With this PR (earlier version):
The number of iterations is different, because the input data is slightly different due to imputation. |
These changes look amazing, thanks a lot for feeding them back. I will take a look at them and try to figure out what the smartest way of merging is. |
I tried to wrap my head around how to format first and then merge, but everything I tried lead to quite large merge conflicts... So I guess it's easier to merge this first and format after... |
This would require a bit of scripting, but I think it's doable. |
Cool, if you would like to do that of course we can^^ I thought about using the default formatter style with some minor tweaks: https://github.com/StructuralEquationModels/StructuralEquationModels.jl/blob/feature/formatter/.JuliaFormatter.toml |
I like |
This branch is formatted accordingly: https://github.com/StructuralEquationModels/StructuralEquationModels.jl/tree/feature/formatter Yes, One minor thing is that formatter changes spaces between |
Thank you! I like this style, even the condensing of formulas within the indices. :) |
I added |
Thank you, I like these updates. It's good to go from my side.
but it's not critical to do that immediately, it could be gradually fixed over time. |
Okay, (W.r.t. the |
Thanks! Later today I will try to implement per-commit formatting I suggested. |
This is a draft PR that contains multiple assorted tweaks and refactorings that I have implemented for a SEM.jl package over a last few weeks.
The goal of these changes was to
I realize that there's a lot of changes, so it is hard to review all that is going on in this PR, but I thought it still would be nice to submit it as a preview of all the potential changes that I have implemented.
In particular, these are the bigger pieces implemented:
It simplifies the code, reduces code duplication and allows easy switching between dense/sparse matrices of substituted model parameters.
evaluate!()
call (instead of upto 7 methods in the current version).That greatly improves the maintenance and tweaking this code, and also maps better onto optimization packages (Optim.jl).
predict_latent_vars()
for predicting factor scores per observation. At the moment regression and Bartlett methods are implemented.identifier()
is renamed intoparam()
for clarity,param_type
intorelation
, consistently added support forvars
,observed_vars
,latent_vars
methods to ParameterTable, RAMMatrices and other typesmul!()
to avoid unnecessary allocationsLet me know what you think about this PR and how you would like these changes to be incorporated into the main tree (of course, if you are interested in that :) )
I have tried to make commits as granular as possible to allow selecting subset of commits around a particular feature into a smaller PRs.