vankesteren / tensorsem

Structural Equation Modeling using Torch
GNU General Public License v3.0
51 stars 10 forks source link

not an issue more a question #8

Closed MichelNivard closed 1 year ago

MichelNivard commented 4 years ago

Why did you move from tensorflow to pytorch?

vankesteren commented 4 years ago

Thank you for your question!

In the previous (tensorflow) version, it was practically impossible for the user to specify additional penalties / change the loss function to their desired loss function. When I presented the work, I got feedback from listeners that they would like to be able to "build" their own SEM extension!

TensorFlow is built with a "static" computation graph in mind. In the package, I premade the computation graph upon creating a tensorsem object. This graph already needed to have all the possible penalties / adjustments in there, and then a user-defined parameter can turn these penalties off and on.

Torch, in contrast, has "dynamic" computation graphs. I just build up the basic structure of SEM (see here), and in the training loop you can adjust the loss function to your heart's desire (see, for example, here).

This functionality is necessary for what we hope to achieve with this: flexible extensions to SEM using computation graphs.