Coder Social home page Coder Social logo

Comments (6)

maximelucas avatar maximelucas commented on May 24, 2024

I believe the problem comes from the _calc_netshape() function in the teneto/classes/network.py file. When the network is not sparse (branch else of the conditional statement) T is assigned the value
T = self.network['t'].max()+1
which only takes the end time into account, not the start time. Solve by replacing with
T = len(set(self.network['t']))
which yields 4. It also deals with missing time points in the following way: if in netin dictionary there is
't': [100,100,102,103]
with the 101 time point "missing", the new line yields 3.

from teneto.

wiheto avatar wiheto commented on May 24, 2024

Sorry for taking over a month top get back to you on this.

Nice catch. And the fix would work quite well. But I think the following would be a slightly better solution:

T = self.network['t'].max() - self.network['t'].min() + 1

Because, so in the case if there is [100, 100, 102, 102, 103], I think it would be better to display T=4, instead of T=3. Mainly because T would be 4 if this was converted into a numpy array.

Feel free to submit a PR if you want to. Otherwise I'll add this in the next version I release.

from teneto.

maximelucas avatar maximelucas commented on May 24, 2024

It took me way longer to reply, oops.
Thanks, I saw you replaced the line in the file.

One more question, though: this does not work for decimal times, e.g. [100, 100.2, 100.3], which would yield T=1.3.
Actually I checked and teneto returns T=1, which does not seem very natural in any case.
Are decimal times not allowed in teneto so far?
I've not seen them forbidden or checked for, but maybe functions assume integers.

Related: as far as I understand it, teneto assumes a constant time step. So if I data that corresponds to times non uniformly distributed, there is no natural way to deal with them in teneto, si that right? For example times like [10, 11, 20, 30, 100], teneto would enforce a timestep of 1 and add lots of unexisting timepoints. If this is the case I can raise an issue for an enhancement for example, but I wanted to make sure.

from teneto.

wiheto avatar wiheto commented on May 24, 2024

Are decimal times not allowed in teneto so far?

I've never got round to making non-discrete temporal networks. some functions may break if you include decimals in the time stamps (i have not tested this though)

timelabels is a possible option for you - this will just be a list (e.g. [100, 100.1, 100.2, 100.3]) that then map to the timepoints [0, 1, 2, 3] in figure functions.

In some functions there is the option of adding the sampling frequency. But that has not been included in TemporalNetwork class yet as other functions got prioritized.

from teneto.

wiheto avatar wiheto commented on May 24, 2024

Related: as far as I understand it, teneto assumes a constant time step. So if I data that corresponds to times non uniformly distributed, there is no natural way to deal with them in teneto, si that right? For example times like [10, 11, 20, 30, 100], teneto would enforce a timestep of 1 and add lots of unexisting timepoints. If this is the case I can raise an issue for an enhancement for example, but I wanted to make sure.

It's generally designed to use uniform timepoints in many functions. But it is fine if the time-stamps are non-uniform as well. If something breaks, let me know. However, it will be better than to ensure that the network is sparse (forcesparse) otherwise the numpy arrays will be unnecessarily large.

I think all this functionality would be wonderful! It's all about time to implement it all.

from teneto.

maximelucas avatar maximelucas commented on May 24, 2024

Thanks for the clarifications!
Of course, it all takes time to build!

from teneto.

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.