Binary Human Model

Han has been discussing with me about building human dynamics by making analogy to neural systems.

The idea is to treat every human as an activation function which is connected to each other to form a large network. The trouble was how to deal with information input and output from outside of the group which is similar to external stimulation in neural systems.

A Simplified Model

Here we develop a model for wechat groups instead of general human dynamics. We assume everyone share all the information in the group.

There are several aspects to be defined.

  1. One way to simplify the model is to set up a external pool of information and opinions which we denote as

    System Message: WARNING/2 (\mathscr P)

    latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2016/02/01> Babel <3.9q> and hyphenation patterns for 81 language(s) loaded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Undefined control sequence. <recently read> \mathscr l.13 \fontsize{12}{14}\selectfont $\mathscr P$ [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 204 bytes). Transcript written on math.log.
    .
  2. An opinion is plugged into the pool

    System Message: WARNING/2 (\mathscr P)

    latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2016/02/01> Babel <3.9q> and hyphenation patterns for 81 language(s) loaded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Undefined control sequence. <recently read> \mathscr l.13 \fontsize{12}{14}\selectfont $\mathscr P$ [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 204 bytes). Transcript written on math.log.
    initially.
  3. Everyone will take information and output information to this poll

    System Message: WARNING/2 (\mathscr P)

    latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2016/02/01> Babel <3.9q> and hyphenation patterns for 81 language(s) loaded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?’ option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Undefined control sequence. <recently read> \mathscr l.13 \fontsize{12}{14}\selectfont $\mathscr P$ [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 204 bytes). Transcript written on math.log.
    .
  4. Each human would either output null (being silent) or 1 (agreement) or 0 (disagreement). Each of the outputs in the pool is denoted as P_i.
  5. The output of each human depends on the pool, the nature of the human, and the relation with other people. We approximate each human using a binary input/output function.

Such a general model seems to be good enough. However, we have to define all different types of human first.

  1. Being average: takes in all the opinions of other participants and work out an average.

    \Theta(\frac{\sum_{1}^N P_i}{N}-0.5),

    where \Theta is the step function or Heaviside function.

  2. Being extreme: exaggerates whatever is obtained from average。

    \Theta(\alpha\frac{\sum_{1}^N P_i}{N}-0.5),

    where \alpha is the extreme factor. For linear summations (euclidean metric), this is effectively pessimism (\alpha<1) or optimism (\alpha>1).

  3. Synchronized to other people. The simplest case is to synchronize to one of the members in the group.

Numerical Model

We need to build a program to calculate an example and see if it makes sense.

import numpy as np
# Define Heaviside function; returns 0 if x<0.5, otherwise returns 1

def hsh(x):
    #return (0.5 * (np.sign(x-0.5) + 1))
    return int(np.piecewise(x, [x < 0.5, x >= 0.5], [0, 1]) )
# Test of functions

print hsh(0.1), hsh(0.5), hsh(0.6)
0 1 1

In this example, we simulate the opinion stream of each person as well as the whole system which is determined by the pool.

For convinience we establish a group of 4 person.

# Define the pool

pool = np.random.randint(2, size=4).tolist();
print pool
[1, 0, 0, 1]
# Define four characters of the group

## First character is an averagist

def avgist(x):

    return hsh( np.sum(x)/len(x) )

## The second character is pessimist

def pesist(x,alpha=0.6):

    return hsh( alpha * np.sum(x)/len(x) )


## The third character is a optimist
def optist(x,alpha=2):

    return hsh( alpha * np.sum(x)/len(x) )

## The fourth synchronizes with the first character, i.e., averagist

def synist(x):

    return x[0]
# Test characters

print avgist(pool), pesist(pool), optist(pool), synist(pool)
print np.array([avgist(pool), pesist(pool), optist(pool), synist(pool) ])
0 0 1 1
[0 0 1 1]
# Define iterator

def iter(initpool,n): # initpool: the inital pool; n: number of iterations

    poolM = np.array(initpool);
    stateM = np.array([poolM]);


    for i in range(n):
        poolM = np.array( [ avgist(poolM), pesist(poolM), optist(poolM), synist(poolM) ] )
        stateM = np.append( stateM, np.array([poolM]) ,axis=0 )

    return stateM
print(iter([1,1,0,1],10), \
    iter([1,1,0,1],10), \
      iter([1,0,1,1],10)
     )
(array([[1, 1, 0, 1],
       [0, 0, 1, 1],
       [0, 0, 1, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]]), array([[1, 1, 0, 1],
       [0, 0, 1, 1],
       [0, 0, 1, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]]), array([[1, 0, 1, 1],
       [0, 0, 1, 1],
       [0, 0, 1, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]]))

© 2017, Lei Ma| GitHub| Statistical Mechanics Notebook | Index | Page Source| changelog| Created with Sphinx