Giter Site home page Giter Site logo

no safe multi-process/threads about edhsmm HOT 3 CLOSED

poypoyan avatar poypoyan commented on July 28, 2024
no safe multi-process/threads

from edhsmm.

Comments (3)

poypoyan avatar poypoyan commented on July 28, 2024

Hello. Apologies for a late response.

Honestly, I am not familiar with joblib and I am not doing machine learning right now. But parallelism would be a nice addition here, so I'll fix this.

Can you provide the exact error message? If you want, can you also provide a code snippet/sample (with data removed of course) on how you use my library with joblib?

Thanks!

from edhsmm.

poypoyan avatar poypoyan commented on July 28, 2024

@Tianxu-Jia Good day!

Finally had time for this. I think that only fit has the problem, because only fit modifies model parameters. For now, we can do something like:

from joblib import Parallel, delayed

models = [M0, M1, M2]
data = [data0, data1, data2]

Parallel(n_jobs=-1, require='sharedmem')(delayed(i.fit)(j) for i, j in zip(models, data))

The "sharedmem" allows mutation/editing of objects in the main program. See here: https://joblib.readthedocs.io/en/latest/parallel.html#shared-memory-semantics


Work is ongoing so that we can also do something like this (if one does not prefer sharedmem for some reason):

from joblib import Parallel, delayed

models = [M0, M1, M2]
data = [data0, data1, data2]

[M0, M1, M2] = Parallel(n_jobs=-1)(delayed(i.fit)(j) for i, j in zip(models, data))

And because of these changes, I'll also introduce model "names".

R1 = GaussianHSMM(n_states = 3, n_durations = 4, name = "Model 1")   # new parameter "name"

Names are showed in printed messages. This is helpful when models are run in parallel.

FIT: reestimation complete for loop 3.
FIT (Model 1): converged at loop 3.
FIT: reestimation complete for loop 4.

These changes will be released in the next version 0.2.2.

Thanks!

from edhsmm.

poypoyan avatar poypoyan commented on July 28, 2024

Update: 0.2.2 is now released which includes the features I presented above.

I think I can now close this issue, but feel free to re-open it if you have questions.

from edhsmm.

Related Issues (14)

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.