Comments (6)
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.
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.
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.
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.
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.
Thanks for the clarifications!
Of course, it all takes time to build!
from teneto.
Related Issues (20)
- Error TenetoBIDS numpy input does not save to json sidecar HOT 1
- Closeness centrality running without interruption HOT 9
- Remove dependencies on neural-specific modules but issue a warning if a function is trying to be used that requires it HOT 21
- [Question] shortest_temporal_path HOT 6
- MemoryError while loading graph HOT 14
- Control colormap of temporal graph nodes HOT 4
- Plotting slice_plot will fail if dataframe columns in wrong order HOT 4
- Improve shortest temporal paths (speed issues) HOT 1
- [ENH] Prewhiten prior to derive_temporalnetwork
- AttributeError: module 'sqlalchemy.util' has no attribute 'dependencies' after importing TemporalNetworks() HOT 3
- wrong number of nodes from TN.N and in netshape HOT 2
- Speed up the shortest path calculation speed HOT 1
- An error: The object 'TemporalNetwork' can't import dataframe data of weighted network HOT 3
- Label node on temporalnetwork ploting HOT 1
- Inconsistency when plotting slice plot a temporal network HOT 6
- How to make a community slice plot HOT 2
- Calculating consensus partition in teneto HOT 2
- Possible Typo in test_communitydetection.py
- Network Properties calculation speed problem HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from teneto.