Coder Social home page Coder Social logo

Comments (4)

wiheto avatar wiheto commented on May 25, 2024

Nice catch! This is just an outdated tutorial. Thanks for flagging this.

The issue here is that modifications were made to only use pandas arrays when the network/connections are sparse (I think if less than 25% of the connections are non-zero). This random network fills that criteria so it makes it a numpy array.

So I am creating a little to do list for myself here:

  • Update the tutorial.
  • Add code in tutorial to tests that are performed so this doesn't happen again

from teneto.

maximelucas avatar maximelucas commented on May 25, 2024

That makes sense! Setting prob=0.2 yields a Pandas DataFrame. Thanks for the explanation.

I'm guessing you made that choice to optimise the code in some way.
I'm just thinking, if I write some general code, and then run it on some different datasets, some might be a bit more or a bit less sparse than your threshold. Then, the same code might run or not run, or just yield different results, because of this. Does this not have the potential to create some trouble? Of course I guess I could just check the data and adapt the code every time.

from teneto.

wiheto avatar wiheto commented on May 25, 2024

Does this not have the potential to create some trouble?

It is a good point.

  1. All teneto functions are agnostic to whether TemporalNetwork.network is a dataframe or numpy array (and most functions can take HDF dataframes as well (some parts of this are still being optimized though)).

  2. If the user want's to always have dataframe there is an argument when defining TemporalNetwork: forcesparse, which, if True, will make sure the TemporalNetwork.network be a dataframe. I have planned to make this "force_df" and "force_array" but that has been low down on the priority list (or representation=['auto','df','array'])

This behaviour is the an unfortunate trade-off I've had to make for wanting to be quick on small datasets and be able to cope with very large datasets. Trying to find one representation that is (1) familiar for a user to interact with (np or pd), (2) efficient for quick processing, (3) efficient for large networks, is something I hope to implement at one point. But for now, this was the best solution I could think of..

from teneto.

maximelucas avatar maximelucas commented on May 25, 2024

I sensed it would be something like this, it makes sense, thanks. Your point 1. should make it quite safe. In any case I don't have a better solution either, I jut got surprised because I even prob=0.3 yielded sometimes sparse and sometimes dense nets!

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.