Package: quoter-model
Quoter ModelThis repository is a packaged version of code using thequoter modelas a model for social information flow [1]. The model was further explored and this code was further developed by Tyson Pond [2,3].The quoter model offers an idealistic mechanism for how people communicate written information in online social contexts (i.e. tweets on Twitter or posts on Facebook). The model runs on a social network, where each node (user) takes turns generating a sequence of words by one of two mechanisms:(i) copying a segment of a random neighbor's past text with probability $q$(ii) randomly generating new text according to a vocabulary distribution.We can then apply thecross-entropy(an information-theoretic measure which satisfies temporal precedence, referred to ashxin the code) to quantify information flow between each pair of users text.Installation and usagepip install quoter-modelThis will appear in your list of installed packages asquoter-model, but included in a python script byimport quoter.The most relevant usage of this package, as shown in the examples, would be to run something likefrom quoter.quoter_model import quoter_model_simand then run that function with relevant arguments.Currently the simulation is dependent on theProcessEntropypackage which can have C-related install issues; a workaround for this (as detailed at that repo) is to first runpip install --no-dependencies ProcessEntropy
pip install numba numpy nltkAlternatively you can modify the source code insidequoter/quoter_modelto use the local version ofCrossEntropy.See the examples for ideas on experiments to run, parameters to vary in simulations, etc.Example networksInsidesrc/quoter/real_networksare many examples of real networks, along with a module for parsing them into an appropriate format, that can be used to run simulations on.These have been compiled from different sources and are intended only as a starting point; other networks could be found, for example, at the onlinenetwork repositoryorICON.An example usage of the real networks is calculating their so-callededge clustering coefficientinexamples/edge_clustering.py. Example simulations for different parameters of ER, BA, WS, SBM networks are also found in theexamples directory, which is initialised as a module and can therefore be called in scripts.Note also that the simulation currently only works with uniformly weighted networks. An extension would be to use edge weights either as non-uniform quoting probabilites, or once an ego has "decided" to quote, to choose from its predecessors preferentially based on the connecting weights.DocumentationThere are autogenerated html docs indocs/_build/html/index.html, produced by runningmake htmlinsidedocs/(the makefile itself being auto-generate by aftersphinx-quickstart).Many of the docstrings are produced using docify so may need double checking. The docs are also now available atreadthedocs, and this is configured to re-build every time the github repo is pushed to, however it does not seem to be hosting the same html as I get locally! If anyone knows how to solve this please let me know:)Common abbreviationsER = Erdős–Rényi random graphBA = Barabási–Albert random graphWS = Watts–Strogatz (small-world) graphSBM = Stochastic Block ModelRequirementsWorks withPython 3.6+[Networkx 1.11] Initially ran on this; now on 3.1 but in case you have any issues this would be whySee therequirements.txtfile for further dependencies. Note that for some advanced use of thenetworkxpackage, which may be included withinquoter, it may be helpful to runpip install networkx[default]TODOMake sure all docstrings are in reST/sphinx formatAdd more helpful commentsMake documentation better and available online [crude version available online at quoter-model.readthedocs.io]Add more typing to function argsAdd verbose output to quoter_model_sim() [done, needs testing/improving]Better syncing between simulation and processing scripts in the examples [done]get_modularity is currently defined in multiple different files, giving redundanciesRepository structuredist/contains the distribution archives generated usingpython3 -m build, and are an alternative way of installing the package for local usedocs/contains the auto-generated docs, as previously mentionedsrc/contains the actual package. I'm not too sure why it needs to be two levels down, but seems to work in any casetests/contains future tests for the package. As you can see, it is currently emptyAll the files in the base directory (this one) are fairly self explanatory (except maybepyproject.toml- at least it wasn't to me before I compiled this package - it is wherepipgets its package metadata from).References[1] Bagrow, J. P., & Mitchell, L. (2018). The quoter model: A paradigmatic model of the social flow of written information.Chaos: An Interdisciplinary Journal of Nonlinear Science, 28(7), 075304.[2] Pond, T. C. (2020). Measuring and Modeling Information Flow on Social Networks (Doctoral dissertation, The University of Vermont and State Agricultural College).[3] Pond, T., Magsarjav, S., South, T., Mitchell, L., & Bagrow, J. P. (2020). Complex contagion features without social reinforcement in a model of social information flow.Entropy, 22(3), 265.