Giter Club home page Giter Club logo

Comments (18)

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024 2

I'm reopening this issue, because I think I finally have a fix for it. Today, I read the R Internals manual, concerning S4 classes (plus another document to which the manual links). Based on what it said, I began to suspect that this issue is caused by MxRAMModels never being initialize()d as instances of that class. Instead, they are only ever initialize()d as instances of the base class, "MxModel". Then, what happens to turn them into MxRAMModels is that a function called by mxModel() uses class()<- to change their class to "MxRAMModel" per the value of mxModel() argument type. That does not suffice to give them the "package" attribute, set to "OpenMx"; that's because S4 classes are defined within the context of a package, whereas the end user's R script can use class()<- to change an object's class arbitrarily (even to an undefined class!).

As a proof of concept, I attach summary.MxRAMModel.diff.txt, which is a git diff relative to 7ebcc10 . If I rebuild OpenMx after making the changes reflected in the diff, I can run loadtest--181129.R, save R's workspace, restart R, and load the saved workspace, and OpenMx is automatically loaded into R's workspace with it. That is the current behavior for objects of class "MxModel", but that is new behavior for objects of class "MxRAMModel". I'm running R in RStudio, FYI.

For reference, this is the forums thread about this issue: https://openmx.ssri.psu.edu/thread/4199 .

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024 2

The changes reflected in that diff are just proof-of-concept. The actual implementation of the bug-fix will have to be less crude. We should probably discuss it at a meeting. And we should implement analogous changes for MxLISRELModels, too.

from openmx.

jpritikin avatar jpritikin commented on June 20, 2024 1

Wow, Rob, accolades to your tenacity on solving this one!

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024 1

I'm going to close this issue. We can reopen it if it turns out my fix doesn't work.

from openmx.

tbates avatar tbates commented on June 20, 2024

FYI, teaching a class, about 5/50 people had this error last week. It seemed to have something to do with package order. Went away with reinstall package, restart R.

from openmx.

jpritikin avatar jpritikin commented on June 20, 2024

No idea how to reproduce this or whether it's even an OpenMx problem. Closing until we receive a better bug report.

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024

I wonder if this issue is worth revisiting in light of thread 4311?

from openmx.

mcneale avatar mcneale commented on June 20, 2024

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024

But upgrading didn't resolve the issue. What did was krzysiek re-running his MxModels anew, instead of loading them from a saved workspace.

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024

Should we revisit this issue? It's still tripping users up.

from openmx.

mcneale avatar mcneale commented on June 20, 2024

from openmx.

tbates avatar tbates commented on June 20, 2024

from openmx.

mcneale avatar mcneale commented on June 20, 2024

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024

N.B. that we DO warn the user if s/he is running an MxModel that was created with a version of OpenMx different from the one currently loaded. See line 72 in R/MxModel.R and line 21 in R/MxRun.R .

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024

@jpritikin Thanks!

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024

Oh, ba80a3f , for Pete's sake! Can it be that the bug-fix that has eluded us all this time IS A SINGLE LINE OF CODE?!

Fingers crossed that travis and the nightly run both pass.

Edit: well, travis failed, but that wasn't my fault.

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024

If class() is allowed to change the class identifier of an object to an arbitrary string, then it's allowed to change the class identifier of an object into a string with an arbitrary attribute: https://openmx.ssri.psu.edu/comment/8122#comment-8122

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on June 20, 2024

Well, it looks like the fix for this issue was much simpler than I thought. Contrary to my initial suspicion, it's not actually necessary for objects of class "MxRAMModel" to be initialize()d as such, and unlike the diff I posted upthread, implementing the repair required only one line of code.

The nightly run passed all tests. Could someone please independently verify that it works? You should be able to build R from the head of the master branch, run loadtest--181129.R, let it save R's workspace, restart R, load the saved workspace, and see OpenMx get automatically loaded into R's workspace with it.

Once someone confirms that it works, this issue can be closed.

from openmx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.