Giter VIP home page Giter VIP logo

Comments (4)

AjayTalati avatar AjayTalati commented on August 23, 2024

Update, I think this is due to the way pyphi catches things, (but I don't know how to turn this on and off yet)?

I generated and stored 100, random tpms and states, and then ran the above on them, and got much more common sense times,

>>> compute_big_mip()
33.894142627716064
>>> compute_big_mip_and_a_random_cut()
31.76900362968445

So I'll close this, as it seems like it's really use case confusion, rather than problem with pyphi

from pyphi.

AjayTalati avatar AjayTalati commented on August 23, 2024

Oh dear maybe I spoke too soon? Now if I calculate the random cut only, it still seems very slow,

>>> def compute_a_random_cut_only():
...     start = time()
...     for t in range (0,100): 
...         network = pyphi.Network(tpms[t], connectivity_matrix=cms[t])
...         subsystem = pyphi.Subsystem(network, states[t], range(network.size)) 
...         #mip = pyphi.compute.big_mip(subsystem) 
...         i = randint(0, num_all_directed_bipartitions-1)
...         rand_bipartition = all_bipartitions[ i : i+1 ] # random directed bipartition
...         random_cut = [ pyphi.models.cuts.Cut ( bipartition[0], bipartition[1] ) for bipartition in rand_bipartition ] # random_cut
...         unpartitioned_constellation = pyphi.compute.constellation(subsystem)
...         mip_of_rand_cut = evaluate_cut(subsystem, random_cut[0], unpartitioned_constellation) # pyphi/compute/big_phi.py#L27           
...     print(time()-start)
... 
>>> compute_a_random_cut_only()
30.439067840576172

I would have expected it to be much faster if it's only got to calculate one random cut, and not the full subsystem's big_mip. Any ideas where all the computation time is going?

from pyphi.

wmayner avatar wmayner commented on August 23, 2024

Hi Ajay,

I finally had a chance to look into this, and I can't seem to reproduce it. I wrote a similar script, and I see results more in line with what we'd expect:

Timing functions (4 nodes, 100 iterations)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
big_mip: done.
  Mean time: 0.6552s
naive_big_mip: done.
  Mean time: 0.7885s
unpartitioned_constellation: done.
  Mean time: 0.0965s
random_cut: done.
  Mean time: 0.0680s

When the script is run with 5 nodes rather than 4, I get similar results:

Timing functions (4 nodes, 100 iterations)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
big_mip: done.
  Mean time: 31.5975s
naive_big_mip: done.
  Mean time: 32.6524s
unpartitioned_constellation: done.
  Mean time: 2.0442s
random_cut: done.
  Mean time: 0.9371s

from pyphi.

AjayTalati avatar AjayTalati commented on August 23, 2024

Hi Will, @wmayner,

sorry for the late reply - I'm not ignoring you - I got caught up in something else. I'm looking into this now, and going to reply to your email soon.

It's great that you've got the pyphi-users forum rolling - maybe you want to put a link to it on the front page here to let new users know it exists?

Best,

Aj

from pyphi.

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.