Content uploaded by Seyed Sahand Mohammadi Ziabari
Author content
All content in this area was uploaded by Seyed Sahand Mohammadi Ziabari on Dec 03, 2019
Content may be subject to copyright.
Content uploaded by Seyed Sahand Mohammadi Ziabari
Author content
All content in this area was uploaded by Seyed Sahand Mohammadi Ziabari on Feb 09, 2019
Content may be subject to copyright.
Content uploaded by Seyed Sahand Mohammadi Ziabari
Author content
All content in this area was uploaded by Seyed Sahand Mohammadi Ziabari on Jan 17, 2019
Content may be subject to copyright.
A Modeling Environment for Dynamic and Adaptive
Network Models Implemented in Matlab
S. Sahand Mohammadi Ziabari, Jan Treur
Behavioural Informatics Group, Vrije Universiteit Amsterdam
sahandmohammadiziabari@gmail.com j.treur@vu.nl
Abstract. In this paper a software environment to support NetworkOriented Modeling
is presented. The environment has been implemented in Matlab. This code covers the
principles of temporalcausal network models. The software environment has builtin
options for network adaptation principles such as the Hebbian Learning principle from
Neuroscience and the adaptation principle for bonding based on homophily from Social
Science. The implementation is illustrated for an adaptive temporalcausal network
model under acute stress for decision making.
Keywords: NetworkOriented Modeling, temporalcausal network, adaptive, software
environment, Hebbian learning, bonding by homophily, Matlab.
1 Introduction
In this paper a dedicated software environment to support NetworkOriented Modeling is
presented. The NetworkOriented Modeling approach addressed uses temporalcausal net
work models. This means that any scientific field in which causal relations are used to explain
hypotheses, findings and theories can be used in NetworkOriented Modeling [19]. Such do
mains vary from mental processes in individuals to social processes. For example, the inter
actions among individuals can be modelled as a network taking into account a network adap
tion principle like bonding based on homophily principle [8, 10]. Individual mental processes
can be modeled as interaction between mental states taking into account a network adaption
principle based on Hebbian learning [18]. The latter represents the notion of plasticity de
scribed in Neuroscience which means that the communications within the brain are often
adaptive and change over time.
There are two different representations of a temporalcausal network model named a con
ceptual representation (labeled graph or matrix representation) and a numerical representa
tion (representation by difference or differential equations). Using the software environment
presented here, a conceptual representation can be used as a basis. By the software it is auto
matically translated into a numerical representation which can be used for numerical simula
tion, mathematical analysis, validation by comparing to empirical data or properties, tuning
of parameters to characteristics of domain, person or social context.
The example model presented in [1] has been used as illustration. This model incorporates
adaptation principles based on Hebbian learning and on suppression of connections due to
acute stress. There are other implementations for other types of networkoriented modeling,
some of which can be found in [46, 21, 22].
The sections of paper are as follows. In Section 2 the NetworkOriented Modeling ap
proach based on temporalcausal networks is briefly described. In Section 3 an overview of
the Matlab software is introduced and in Section 4, more details of the Matlab code has been
described. In Section 5 the simulation results of the example model are discussed. Finally,
Section 6 is the discussion section.
2
2 The NetworkOriented Modeling Approach Addressed
This software environment covers the principles of NetworkOriented Modeling based on
temporalcausal networks discussed in the book [2]. The NetworkOriented Modeling format
used is based on a dynamic and adaptive variant of modeling, reasoning and simulation in a
causal way which is a topic with a long history in Artificial Intelligence [17]. In this respect,
any scientific field of study in which causal relations are applied can be addressed on the
basis of this NetworkOriented Modeling approach. Among the wide variety of application
areas there are two types of applications that in a sense are dominant: describing individual
mental processes specifically and describing how individuals interact with each other [19].
Table 1 shows the overview of some combination functions. The following three notions are
central in the NetworkOriented Modeling approach, and define a temporalcausal network
model, and therefore are part of a conceptual representation of a temporalcausal network
model:
• Connections strength
w
X,Y
The connection strength between a state X to a state Y is called weight value wX,Y which
is normally between 0 and 1.
• Aggregation of impacts of states cY(..)
Each state needs a combination function cY(..) to aggregate the impacts of other states on
state Y.
• Speed of change of a state ηY
There is a speed factor ηY shows how fast a state changes over a period of time based on
the impact.
Table 1. Overview of some combination functions c(V1, …, Vk)
Name
Description
Formula c(V1, …, Vk) =
sum (…)
Sum
V1! …! Vk
ssum
l
(…)
Scaled sum
function
"#$%&$%"'
l with l > 0
min (…)
max (…)
Minimal Value
Maximal Value
Min(V1
(
…
(
Vk)
Max(V1
(
…
(
Vk)
slogistic
st
(…)
Simple
logistic sum function
#
#$)*s+"#$%,,%%$"'%*%t% with s, t ³ 0
alogistic
s
,
t
(…)
Advanced
logistic sum function
[
#
#$)*
s
+"#$
%
,,
%%
$".
%
*
%t

% 
#
#$)
st% ] (1+est)
with s, t ³ 0
A conceptual representation of a temporalcausal network model can be transformed in a
systematic or automated manner into a numerical representation of the model as follows [2,
19]:
• Y(t) represents the value of Y at time point t in the model which is in the interval [0, 1].
• impactX,Y(t) = wX,Y X(t) shows the influence of a state X connected to a state Y at time
point t where wX,Y represents the weight of the connection.
• The aggregated impact of some states Xi on Y at t is calculated using a combination
function cY(..):
aggimpactY(t) = cY(impactX1,Y(t), …, impactXk,Y(t))
= cY(wX1,YX1(t), …, wXk,YXk(t))
3
• The impact of aggimpactY(t) on Y is applied over time gently, based on speed factor hY:
Y(t+Dt) = Y(t) + hY [aggimpactY(t)  Y(t)] Dt
or dY(t)/dt = hY [aggimpactY(t)  Y(t)]
• Therefore, the difference and differential equation for Y are achieved:
Y(t+Dt) = Y(t) + hY [cY(wX1,YX1(t), …, wXk,YXk(t))  Y(t)] Dt
dY(t)/dt = hY [cY(wX1,YX1(t), …, wXk,YXk(t))  Y(t)]
Adaptation principles covered
The following adaptation principles are covered.
Hebbian learning
For Hebbian learning of a connection from state Xi to state Xj the following model is used
w(t+Dt) = w(t) + hw [cw(Xi(t), Xj(t), w(t))  w(t)] Dt
with
cw(V1, V2, W) = hebbµ(V1, V2, W) = V1V2 (1 – W) + µ W
where µ is the persistence factor with 1 as full persistence.
Stateconnection modulation
For the adaptation principle for stateconnection modulation with control state cs the follow
ing model is used:
w(t+Dt) = w(t) + hw [cw(cs2(t), w(t))  w(t)] Dt
with cw(V, W) = scma(V, W) = W + a V W (1 – W)
where a is the adjustment parameter for w from cs. In combination these two adaptive com
bination functions can be used as a weighted average with 0£ q £1as follows:
cw(V1, V2, V, W) = q hebbµ(V1, V2, W) + (1q) scma(V, W)
w(t+Dt) = w(t) + hw [cw(Xi(t), Xj(t), cs(t), w(t))  w(t)] Dt
All these difference equations can be used for simulation.
This stateconnection adaptation principle can also by applied in a social context. The
hypothesis is based on that whenever a more intensive interplay between two persons occurs,
the connection will become solid; e.g., [12].
Bonding based on homophily
Bonding based on homophily shows that the more look like the states of two connected states,
the stronger their connection will become: ‘the more you are alike, the more you like (each
other)’ [2]; see, for example, [7, 8, 9]. When also the states are assumed dynamic, this prin
ciple can be combined with contagion of states into a circular causal relation [11]: Stat e «
Link. See also, for example [1316]. The homophily principle can be as represented numeri
cally by a combination function cA,B (V1 , V2 , W) as follows :
wA,B(t+Dt) = wA,B(t) + hA,B [cA,B(XA(t), XB(t), wA,B(t))  wA,B(t)] Dt
dY(t)/dt = hA,B [cA,B(XA(t), XB(t), wA,B)  wA,B]
Three variants of models for the homophily axiom are the linear, quadratic and logistic vari
ants:
Linear
c(V1 , V2 , W) = slhomo(V1 , V2 , W) = W + W(1 W)( t   V1 – V2 )
Quadratic
c(V1 , V2 , W) = sqhomo(V1 , V2 , W) = W + W(1 W)( t2 – (V1 – V2)2 )
Logistic
c(V1 , V2 , W) = sloghomo(V1 , V2 , W)
4
= W + W (1 W)(0.5 – 1/(1 +
/*
s
+0"1*%230*
t
%
))
Based on these options that can be chosen the following numerical differential and difference
equations are generated
dwC,D /dt = hC,D wC,D (1 wC,D)( tC,D  XC – XD )
wC,D(t+Dt) = wC,D + hC,D wC,D (t) (tC,D  XC – XD)Dt
dwC,D /dt = hC,D wC,D (1 w C,D)(t2 C,D  XC – XD)2)
wC,D (t+Dt) = wC,D + hC,D wC,D (t)(1  wC,D)(t2C,D – (XA(t) – XB(t))2) Dt
dwC,D /dt = hC,D wC,D (1 wC,D)(0.5 – 1/(1 +
/*
s
+024*%250*%
t
4(5
))
wC,D (t+Dt) = wC,D + hA,B wC,D (t)(1  wC,D)(0.5 – 1/(1 +
/*
s
+024*%250*%
t
4(5
)) Dt
Here XC, XD are the states of person C and D, wC,D is the connection weight from person C
to person D, hC,D the update speed factor for the connection from person C to person D, and
tC,D the threshold or tipping point for connection adaption
3 Modeling a TemporalCausal Network in Matlab
The advantage of using Matlab for simulation is that (as the abbreviation of that says) ‘Matrix
laboratory’ can easily work with matrices. The format is defined in Table 2, if there is a
connection between X1 and X2 as states, the connection weight assigned to the matrix repre
sentation (w) of states between aforementioned states. Due to simplicity of Matlab and also
providing many functions, the Matlab software became one of the often used software envi
ronments for engineers and computer science developers. It has been used in different aspects
of sciences from image processing, due to providing many toolboxes, and also machine learn
ing, analyse and simulate behavioral dynamics of agents in cognitive science, social science,
and in artificial Intelligence.
The initialization of the matrices for doing actions, calculating based on the combination
functions (Identity, Advance logistic, Advance advanced logistic, scaled sum, …), Matlab
representation of functions based on notations of states, relations and all principles are shown
in the Table in the appendix.
In Figure 1 the functional view of the Matlab code is shown. The process starts with the
inputs named number of states (nodes), connection weights, speed factors, initial values. In
the next step all parameters are allocated in matrices with 1´ N dimensions, where N is the
number of the states in the model.
Table 2. Notions and Matlab representations
Notions
Matlab representations
Number of nodes (States)
N
The notion of states (X1, X2, …) & weights
w among states
W
The speed factors
Sp_f
Initial values
STDX
Combination function (Identity)
First row of Matr ix ‘O’
id=O(1,:);
Combination function (Sum)
Second row of Matrix ‘O’
sum function
Combination function (Scaled sum)
3rd and fourth rows of Matrix ‘O’
Scaled sum,
Scaling factor
5
Combination function (Normalised sum)
5th and 6th rows of Matrix ‘O’
normalised sum, normalizing factor
Combination function (Adaptive normal
ized)
7th row of Matrix ‘O’
adnorsum
Combination function (Simple Logistic)
8th, 10th and 11th rows of Matrix ‘O’
slogistic(...)
Combination function (Advance Logistic)
9th and 10th and 11th rows of Matri x ‘O’
Alogistic, steepness, threshold
Combination function (Adaptive Advanced
Logistic)
12th and 13th and 14th rows of Matrix ‘O’
adaptive advanced logistic, steepness,
steepness
Speed factor for connection weight adapta
tion (used for Hebbian learning, Homoph
ily and Stateconnection modulation)
eta
Hebbian Learning Principle
hebb, mu
Homophily Principle (Simple linear Ho
mophily)
slhomo, htau
Homophily Principle (Advanced linear
Homophily)
alhomo, htau
Homophily Principle (Simple Quadrtic
Homophily)
sqhomo, htau
Homophily Principle (Advanced Quadratic
Homophily)
aqhomo, htau
Stateconnection modulation
Adcon, amp
Length of time for simulation
time=0:dt:398;
L=length(time);
Dt
dt
Plotting (Figures)
plot(time(1:230),STDX(1:230,i),'lineWi
dth',3)
RMS (Root Mean Square)
RMS = sqrt (nansum ((Output 
emp_data) .^2 )) / (col * row)
The next phase is allocating the primitive values of the states in the first row of the matrix
(STDX) and then specifying the time period for having simulation. If there is a Hebbian
learning in the model, then parameters of Hebbian learning, h, hebb, and µ are allocated in
three different matrices, similarly for the Homophily principle, simple homophily (slhom),
advanced homophily (alhom) simple quadratic homophily (sqhom) and advanced quadratic
homophily (qhom), threshold (hthau), and finally for stateconnection modulation (scma) and
the number of the states which have modulation ability. Figure 1 illustrates functional view
of written Matlab code.
6
Inputs
Number of state s
Connection weights
Speed factors,
initial values
Mixing
Is there any
Hebbian
Learning
principle
Multiplying
Is there any
Homophily Multiplying
principle
Is there any Multiplying
state
connection
modulation
Add Add Ad d
Figure 1. Functional view of the Matlab process
Allocating each row
of combi nati on func 
tion and also all other
parameters with ma
trices 1*N dimension
in order to save time
in Matlab
Allocating ini
tial values of
states in the first
row of Matrix
STDX (1,N)
Specifying period
of time for simu
lation (L)
Making a ma
trix with
(time, number
of states)
STDX(L,
N)
Allocating etha,
hebb, mu with
matrices as the pa
rameters of
Hebbian learn ing
Allocating slhom,
alhom, sqhom,
qhom, hthau as a
threshold of ho
mophily in Matlab
Allocating state
connection am
plification (sca),
scaampl , and the
name of the state
for modulat ion
Allocating condy matrix with
the weights of states in col
umnwise way. (for 10 states,
100 columns, condy(1,100))
Showing relationship a mong
states
Making condy(i,k) if there is a homoph
ily, suppression, Hebbian learning
Allocating le gends for showing each state
Allocating time for condy to make a graph if there is
any stateconnection suppression
Making final STDX for simulating graph
Allocating le gends for showing each conn ection
Simulating the graph of each connection if there is stateconnec
tion modulation
Simulating the graph of each states
7
Then in the next step, if there is any abovementioned principle in the model they will
multiply by the STDX matrix formed already with time. Meanwhile, the matrix called condy
with the weights of states formed in a columnwise order and then make a new row based on
any principle existed and then add the influence of them in the matrix. Finally, all matrices
with STDX and condy (if there was any stateconnection modulation) results in generating
the simulation.
The Human Interaction flowchart is depicted in Figure 2. As it can be seen, a first step is
initialization as providing inputs, for instance number of states, weights among states, speed
factors, and combination functions. In the second step it is needed to be decide in which
system the user want to work. In this phase, there are two systems, MultiAgent system and
SingleAgent system. The former offers Simple linear, Advanced Linear, Simple Quadratic,
Advanced Quadratic Homophily principles and for latter there are Hebbian learning and
stateconnection suppression and finally the plotting of simulation occurs.
Figure 2. Human Interaction flowchart
And for more specification, the flowchart of the code is presented in Figure 3
Initialization
(Inputs)
States – Weights  Speed factors 
Combination Functions
MultiAgent
System
SingleAgent
System
Simple linear Homophily
Advanced Linear Homop hily
Simple Quadratic Homophily
Advanced Quadratic Homophily
Hebbian Learning Principle
StateConnection Modulat ion Principl e
Plotting
8
Figure 3. Structural view of the code
To enable easy use, one can also use a user interface between Excel and Matlab. As Matlab
works with Matrices it might be easier to use an Excel interface of matrices and just read the
matrices from the Excel file and then do the execution in Matlab. Such a matrix expresses
the parameters, combination functions, Identity function, sum function, scaled sum with scale
factor, Normalized with normalizing factor, adaptive normalized sum, simple logistic, ad
vanced logistic, advanced logistic and adaptive advanced logistic function with steepness and
threshold and other principles. As can be seen from Figure 4 and 5 the Matlab code reads
the matrices based on the matrix representation in Excel; for instance in these figures it would
be from column C1 to L32 to read matrix for all weights of states, speed factors, deltaT, maxt,
combination functions and finally initial values from the first sheet and if there is any princi
ple combined with the model using the second sheet to read from Excel for Hebbain Learning
principle and Homophily for their principles. Figs 4 and 5 show this option in Excel sheets.
Variables Initializations in matrices
(STDX (X))
Number of
States (N)
Weights of
Connections
(W)
Combination
Functions
(O)
Simple
Logistic
(C12)
Advanced
Logistic
(C13)
Adaptive
Normalized
Sum (C7)
Normalized
Sum (C5)
Sum (C2)
Identity (C1)
Adaptive
Advanced
logistic
(C14)
Scaled Sum
(C3)
Scaling Factor
Normalizing
Factor
Steepness
Threshold
Steepness
Threshold
Steepness
Threshold
Homophily Principles
(Condy (i,k))
Speed Factors
(Sp_f)
9
Figure 4. Excel interface to read for Matlab programming (Parameters, Speed factor, combination
function and initial values)
Figure 5. Excel interface to read for Matlab programming (Hebbian, Homophily and suppression
principles)
10
Parameter tuning using the Sum of Squared residuals and Root Mean Square
For comparison between empirical data and simulation results and optimisation of parame
ters Matlab components are available; the sum of squared residuals (SSR) have been imple
mented to calculate the difference.
667 8++9
+
:#

;<
+
:#

=!>!%
+
9
+
:?

;<
+
:?

=

7@6% 8
A
BBC
?
%
8
A
+2
+
D1

*E
+
D1

3%$>$%+2
+
DF

*E
+
DF

3
?
%
% loading empirical data
load('Data1.mat', 'Data1');
[row, col]=size(Data1);
% Calculating Root Mean Square
RMS = sqrt (nansum ((Output  emp_data) .^2 )) / (col * row)
4 Illustration for an Example Network Model
It is shown how the model presented in [1] can be executed in Matlab. The conceptual rep
resentation of temporal causal network of the model used in [1] is illustrated in Figure 5 and
the explanation of states has been shown in Table 3. As can been seen from Figure 5 here
both the Hebbian learning principle and stateconnection modulation was used. The Hebbian
learning principle used between states srss and (psa1 and psa2) and also Stateconnection sup
pression between state cs2 and the connections with Hebbian Learning principle. The number
of states considered to be 10. Figure 7 shows simulation result of weights of states and Figure
8 shows stateconnection suppression.
In Fig. 6 shows temporalcausal network model. An overview of explanation of the states
is illustrated in Table 3.
Table 3. States explanations in the model [1]
X1
Sensory representation of stimulus s
X2
Sensory representation of context c
X3
Sensory representation of action effect e1
X4
Sensory representation of action effect e2
X5
Feeling state for extreme emotion ee
X6
Preparation state for action a1
X7
Preparation state for action a2
X8
Preparation state for response of extre me emotion ee
X9
Control state for timing of suppression of connections
X10
Control state for suppression of connections
11
Figure 6. Adaptive temporalcausal network model’s conceptual representation [1]
% SRSs SRSc SRSe1 SRSe2 FSee PSa1 PSa2 PSee CS1 CS2
% X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
W=[ 0 0 0 0 0 0.9 0.4 0 0 0 %X1 SRSs
0 1 0.1 0.3 0 0 0 1 0 0 %X2 SRSc
0 0 0 0 0 0.7 0 0 0 0 %X3 SRSe1
0 0 0 0 0 0 0.7 0 0 0 %X4 SRSe2
0 0 0 0 0 0 0 1 0 0 %X5 FSee
0 0 0.7 0 0 0 0.2 0 0 0 %X6 PSa1
0 0 0 0.7 0 0.2 0 0 0 0 %X7 PSa2
0 0 0 0 1 0 0 0 0 0 %X8 PSee
0 0 0 0 0 0 0 0 0 0 %X9 CS1
0 0 0 0 0 0 0 0 0 0.9 %X10 CS2
];
Sp_f=[ 0 0.05 0.5 0.5 0.5 0.5 0.5 0.4 0.02 0.6];
O=[ 0 0 0 0 1 0 0 0 1 0 % identity function id(.)
0 0 0 0 0 0 0 0 0 0 % sum function sum (...)
0 0 1 1 0 1 1 1 0 1 % Scaled sum sum (...)
0 0 0.7 1 0 2 2 2 0 1 % Scaling factor
0 0 0 0 0 0 0 0 0 0 % normalised sun norsum(...)
12
0 0 0 0 0 0 0 0 0 0 % normalizing factor
0 0 0 0 0 0 0 0 0 0 % adnorsum
0 0 0 0 0 0 0 0 0 0 % slogistic(...)
0 0 0 0 0 0 0 0 0 0 % alogistic(...)
0 0 0 0 0 0 0 0 0 0 % steepness
0 0 0 0 0 0 0 0 0 0 % threshold
0 1 0 0 0 0 0 0 0 0 % adaptive advanced logistic (...)
0 18 0 0 0 0 0 0 0 0 % steepness
0 0.2 0 0 0 0 0 0 0 0 % threshold factor
% Suppression amo ng connections in Hebbian learning
adcon(13,6)=0.15;
adcon(13,7)=0.15;
adcon(14,6)=0.5;
adcon(14,7)=0.5;
adcon(24,6)=0.7;
adcon(24,7)=0.7;
% Hebbian learnin g among stat es 1,6
eta(1,6)=0.5;
eta(1,7)=0.8;
hebb(1,6)=0.85;
hebb(1,7)=0.85;
mu(1,6)=0.8;
mu(1,7)=0.8;
% Assign time for plotting
dt=0.25;
time=0:dt:398;
L=length(time);
STDX=zeros(L,N);
% Assign the init ialization f or states 1 and 2 (can be fo r any stat es)
STDX(1,1)=1;
STDX(1,2)=0.1;
Figure 7. Simulation outcome of presented model: states
13
Figure 8. Simulation outcome for suppression and Hebbian learning for w1 (connection X1X6) and
w2 (connection X1X7)
Figure 9. shows a difference between simulation result and empirical data provided.
Figure 9. Simulation result for empirical data (X1) and simulation result (X2).
And the result is 0.01309.
5 Discussion
The implementation of a dedicated Matlabbased software environment for NetworkOri
ented Modeling has been described. The modeling approach covered can be found in [2]; see
also [19]. This implementation has been used in dynamic and adaptive networkoriented
modelling. The environment was illustrated for the example model described in [1] for which
previously only an Excelbased model was available.
An important advantage of the software environment is that modeling can take place at
the level of conceptual representations expressed as labeled graphs or matrices. Therefore, it
is suitable in a multidisciplinary context where different disciplines play a role, also disci
plines where technical knowledge from computer science or AI is minimal. The more tech
nical numerical representations and the actual execution are taken care of by the software
environment and therefore for users no programming skills are needed.
14
Acknowledgement
We would like to thank our colleague Fakhra Jabeen, Ph.D. candidate at Vrije Universiteit
Amsterdam, for her assistance with making possible to have an Excel interface with current
Matlab code.
References
1. Treur, J., Ziabari, S.S.M: An adaptive temporalcausal network model for decision making undera
cute stress. In: Nguyen, N.T. (ed.). Proceedings of the 10th international conference on computa
tional collective intelligence, ICCCI’18, vol. 2. Lecture Notes in Computer Science; vol. 11056,
pp. 1325. Springer Publishers, Berlin (2018).
2. Treur, J.: NetworkOriented Modeling: Addressing Complexity of Cognitive, Affective and Social
Interactions. Springer Publishers (2016).
3. Treur, J.: Verification of temporalcausal network models by mathematical analysis. Vietnam Jour
nal of Computational Science 3, 207221 (2016).
4. Ziabari, S.S.M, Treur, J.: Cognitive Modelling of Mindfulness Therapy by Autogenic Training.
Proceedings of the 5th International Conference on Information System Design and Intelligent
Applications, INDIA'18. Advances in Intelligent Systems and Computing. Springer Publishers,
Berlin (2018).
5. Ziabari, S.S.M, Treur, J.: Integrative Biological, Cognitive and affective modeling of a drugther
apy for a posttraumatic stress disorder. Proceedings of the 7th International Conference on theory
and practice of natural computing, TPNC’18, Springer, Berlin, (2018).
6. Ziabari, S.S.M, Treur, J.: Computational analysis of gender differences in coping with extreme
stressful emotions. Proceedings of the 9th International Conference on Biologically Inspired Cog
nitive Architecture (BICA2018), Elsevier, Czech Republic (2018).
7. Byrne, D.: The attraction hypothesis: do similar attitudes affect anything? Journal of personality
and social psychology 51(6), 11671170 (1986).
8. McPherson, M., SmithLovin, L., Cook, J.M.: Birds of a feather homophily in social networks.
Annual Review of Sociology (27), 415444 (2001).
9. Mislove , A. , Viswanath, B., Gummadi, K. P. , Druschel, P.: You are who you know: inferring
user profiles in online social networks, in proceedings of the WSDM’10, February 46, 2010, New
York City, New York, USA, pp. 251260 (2010).
10. Barabási, A.L., Albert, R.: Emergence of scaling in random networks. Science 286, 509512
(1999).
11. Newman, M.E.J.: The structure and function of complex networks. SIAM Rev. 45, 167–256
(2003).
12. Pearce, E., Launay, J., Dunbar, R.I.M.: The icebreaker effect: singing together mediates fast social
bonding. R. Soc. Open Sci. (2015). doi:10.1098/rsos.150221.
13. Aral, S., Muchnik, L., Sundararajan, A.: Distinguishing influencebased contagion from Homoph
ily driven diffusion in dynamic networks. Proceedings of national academy of sciences of the
United States of America106(2), 1544–1549 (2009).
14. Shalizi, C.R., Thomas, A.C.: Homophily and contagion are generically confounded in observa
tional social network studies. Sociological methods and research 40 (2), 211239 (2011).
15. Steglich, C.E.G., Snijders, Pearson, T.A.B., M.: Dynamic networks and behavior: separating se
lection from influence. Sociological methodology 40, 329–393 (2010).
16. Mundt, M.P., Mercken, L., Zakletskaia, L.I.: Peer selection and influence effects on adolescent
alchohol use: a stochastic actorbased model. BMC Pediatrics 12, 115 (2012).
17. Kuipers, B.J., Kassier, J.P.: How to discover a knowledge representation for causal reasoning by
studying an expert physician, in ed. By F.R.G. Karlsruhe, proceedings English International joint
conference on Artificial Intelligence, IJCAI’83 (William Kaufman, Los Altos, CA, 1983).
18. Hebb, D.: The organization of behavior, Wiley, 1949.
15
19. Treur, J.: The Ins and Outs of NetworkOriented Modeling: from biological networks and mental
networks to social networks and beyond. Transactions on Computational Collective Intelligence.
Paper for keynote lecture at ICCCI’18, 2018.
20. Ziabari, S.S.M, Treur, J.: An adaptive cognitive temporalcausal network model of a mindfulness
therapy based on music. Proceedings of the 10th International Conference on Intelligent Human
Computer Interaction (IHCI2018), Springer, India (2018).
21. Ziabari, S.S.M.: Integrative cognitive and affective modeling of deep Brain stimulation. Proceed
ings of the 32nd International conference on industrial, engineering and other applications of ap
plied intelligent systems (IEA/AIE 2019), submitted.
22. Ziabari, S.S.M, Treur, J.: An adaptive cognitive temporalcausal network model of a mindfulness
therapy based on humor. International Conference on Computational Science (ICCS 2019), sub
mitted.
Appendix: Inputs Description of the Matlab Code
% Initializing th e matrices w ith zeroes in or der to get less time in operating the main codes
id=zeros(1,N);
sum=zeros(1,N);
ssum=zeros(1,N);
lambda=zeros(1,N) ;
norsum=zeros(1,N) ;
norlambda=zeros(1 ,N);
adnorsum=zeros(1, N);
slog=zeros(1,N);
alog=zeros(1,N);
s=zeros(1,N);
t=zeros(1,N);
adalog=zeros(1,N) ;
adas=zeros(1,N);
adat=zeros(1,N);
id=O(1,:);
sum=O(2,:);
ssum=O(3,:);
lambda=O(4,:);
norsum=O(5,:);
norlambda=O(6,:);
adnorsum=O(7,:);
slog=O(8,:);
alog=O(9,:);
s=O(10,:);
t=O(11,:);
adalog=O(12,:);
adas=O(13,:);
adat=O(14,:);
eta=zeros(N);
hebb=zeros(N);
16
mu=zeros(N);
slhomo=zeros(N);
alhomo=zeros(N);
sqhomo=zeros(N);
aqhomo=zeros(N);
htau=zeros(N);
amp=zeros(N);
adcon=zeros(14+N, N^2);
clc
clear
close all
format long
N=10; % Number of states
% Weights of states (Connection among states)
% X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 . . .
W=[ 0 0 0 0 0 0 0 0 0 0 %X1
0 0 0 0 0 0 0 0 0 0 %X2
0 0 0 0 0 0 0 0 0 0 %X3
0 0 0 0 0 0 0 0 0 0 %X4
0 0 0 0 0 0 0 0 0 0 %X5
0 0 0 0 0 0 0 0 0 0 %X6
0 0 0 0 0 0 0 0 0 0 %X7
0 0 0 0 0 0 0 0 0 0 %X8
0 0 0 0 0 0 0 0 0 0 %X9
0 0 0 0 0 0 0 0 0 0 %X10
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
];
% Speed factor connections
Sp_f=[ 0 0 0 0 0 0 0 0 0 0 . . .];
% Combination functions
O=[ 0 0 0 0 0 0 0 0 0 0 . . . % identity function id(.)
0 0 0 0 0 0 0 0 0 0 . . . % sum function sum (...)
0 0 0 0 0 0 0 0 0 0 . . . % Scaled sum sum (...)
0 0 0 0 0 0 0 0 0 0 . . . % Scaling factor
0 0 0 0 0 0 0 0 0 0 . . . % normalized sum norsum(...)
0 0 0 0 0 0 0 0 0 0 . . . % normalizing factor
0 0 0 0 0 0 0 0 0 0 . . . % adaptive normalized sum adnorsum
(...)
0 0 0 0 0 0 0 0 0 0 . . . % simple logistic slogistic
0 0 0 0 0 0 0 0 0 0 . . . % advanced logistic alogistic
17
0 0 0 0 0 0 0 0 0 0 . . . % steepness
0 0 0 0 0 0 0 0 0 0 . . . % threshold
0 0 0 0 0 0 0 0 0 0 . . . % adaptive advanced logistic
0 0 0 0 0 0 0 0 0 0 . . . % steepness
0 0 0 0 0 0 0 0 0 0 . . . % threshold factor
k=0;
for i=1:N
for j=1:N
k=k+1;
condy(1,k)=W(i,j);
end
end
for i=2:L
for j=1:N
k=0;
for ii=1:N
for jj=1:N
k=k+1;
CC=0;
for iii=15:14+N
jjj=iii14;
CC=CC+adcon(iii,k)*STDX(i1,jjj);
End
% identity functi on id
C2=1condy(i1,k);
C1=con dy(i1,k);
% Scaled sum sum
C3=htau( ii,jj)abs(STDX(i1,ii)STDX(i1,jj));
% Scalin g factor
C4=abs(C 3);
% normal ized sum norsum
C5=htau( ii,jj)^2abs (STDX(i1,ii)STDX(i 1,jj))^2;
C6=abs(C 5);
% Homophily princ iples
condy(i,k)= condy(i1,k)+eta(ii,jj)*(hebb(ii,jj)*(...
STDX(i1,ii)*STDX(i1,jj)*C2+mu(ii,jj)*C1)+...
adcon(13,k)*(C1+adcon(14,k)*(CC)*(C2)*...
C1)+slhomo(ii,jj)*(C1+amp(ii,jj)*C1*C2*...
C3)+al homo(ii,jj)* (C1+amp(ii,j j)*C2*((C4+C3)/2 )+C1*...
((C4C3)/2))+sqhomo(ii,jj)*(C1+amp(ii,jj)*C1*C2*C5)+...
aqhomo (ii,jj)*(C1* amp(ii,jj)*C 2*((C6+C5)/2)+C1 *((C6C5)/ 2))...
C1)*dt ;
end
C7=0;
18
% adapt ive normalized s um adnorsum
for jj=1:N
C7=C7+condy(i1,(jj1)*N+j)*STDX(i1,jj);
end
wxsum(i1,j)=C7;
C11=0;
for jj=1:N
C11=C11+condy(i1,(jj1)*N+j);
end
landa(i1,j)=C11;
if ssum(j)>0
C8=ssum(j)*C7/lambda(j);
else
C8=0;
end
if norsum(j)> 0
C9=norsum(j)*C7/norlambda;
else
C9=0;
end
if adnorsum(j )>0
C10=adnorsum(j)*C7/C11;
else
C10=0;
End
% s imple logist ic slogistic
C12=slog(j)*(1/(1+exp(s(j)*(C7t(j)))));
% advanced log istic alogis tic
C13=alog(j)*(((1/(1+exp(s(j)*(C7t(j))))).. .
(1/(1+exp(s(j)*t(j)))))*(1+exp(s(j)*t(j))));
% adaptive adv anced logistic
C14=adalog(j)*(((1/(1+exp(adas(j)*(C7adat(j)*C1 1))))...
(1/(1+exp(adas(j)*adat(j)))))*(1+exp(adas(j)*adat(j))) );
aggimpact(i1,j)=id(j)*C7+sum(j)*C7+C8+C9+C10+C12+C13+C14;
STDX(i,j)=STDX(i1,j)+Sp_f(j) *(aggimpact(i1, j)STDX(i1,j))*dt;
end
end
end
% plotting Sectio n
for i=1:N
plot(time(1:230), STDX(1:230,i ),'lineWidth ',3)
hold on
end
19
for i=1:N
if i<10
ch(i,1:3)=['X',num2str(i) ,' '];
else
ch(i,1:4 )=['X',num2str(i),' '];
end
end
legend(ch)
grid on
figure(2)
for i=1:N
plot(time,STDX(:, i),'lineWidth',3)
hold on
end
for i=1:N
if i<10
ch(i,1:3)=['X',num2str(i) ,' '];
else
ch(i,1:4 )=['X',num2str(i),' '];
end
end
legend(ch)
grid on
% Plotting figure of suppression of conne ctions
figure(3)
plot(time,condy,'lineWidth',3)
hold on
legend('X1 _ 6','X1 _ 7')
grid on
Table 4. Notions of states and Matlab representations of functions
Notions of states
Matlab representations
Combination function (identity)
C1=condy(i1,k);
Combination function (Sum)
C3=htau(ii,jj)ab s(STDX(i1,i i)STDX(i1,jj));
Combination function (Scaled sum)
C8=ssum(j)*C7/lam bda(j);
Combination function (Normalised sum)
C9=norsum(j)*C7/n orlambda
Combination function (Adaptive normal
ized)
C7=C7+condy(i1,( jj1)*N+j)*STDX(i1,jj);
Combination function (Simple Logistic)
C12=slog(j)*(1/(1 +exp(s(j)*( C7t(j)))));
Combination function (Advance Logistic)
C13=alog(j)*(((1/ (1+exp(s(j)*(C7 t(j)))))
(1/(1+exp(s(j)*t( j)))))*(1+ex p(s(j)*t(j))));
Combination function (Adaptive advance
logistic)
C14=adalog(j)*((( 1/(1+exp(ad as(j)*(C7
adat(j)*C11))))
Hebbian Learning Principle
condy(i1,k)+eta(ii,jj)*(hebb(ii,jj)*(STDX(i
1,ii)*STDX(i1,jj)*C2 +mu(ii,jj)*C 1)
20
Homophily Principles (Simple linear Ho
mophily)
slhomo(ii,jj)*(C1+amp(ii,jj)*C1*C2*C3)
Homophily Principles (Advanced linear
Homophily)
alhmo(ii,jj)*(C1+ amp(ii,jj)*C 2*((C4+C3)/2 )+C1*
((C4C3)/2))
Homophily Principles (Simple Quadrtic
Homophily)
sqhomo(ii,jj)*(C1 +amp(ii,jj)* C1*C2*C5)
Homophily Principles (advanced Quadrtic
Homophily)
aqhmo(ii,jj)*(C1* amp(ii,jj)*C 2*((C6+C5)/2 )+C1*
((C6C5)/2))C1)*dt;
Stateconnection suppression
adcon(13,k)*(C1+a dcon(14,k)*( CC)*(C2)* C1 )
All values for States
STDX(i,j)=STDX(i1,j) +Sp_f(j)*(ag gimpact(i
1,j)STDX(i1,j))*dt;
All values for connection weights
condy(i,k)=condy( i
1,k)+eta(ii,jj)*( hebb(ii,jj)* (...
STDX(i1,ii)*STDX(i
1,jj)*C2+mu(ii,jj )*C1)+...
adcon(13,k)*(C1+ad
con(14,k)*(CC)*(C 2)*...
C1)+slhomo(ii,jj) *(C1+amp(ii, jj)*C1*C2*.. .
C3)+alhomo(ii,jj) *(C1+amp(ii, jj)*C2*((C4+ C3)/2
)+C1*...
((C4
C3)/2))+sqhomo(ii ,jj)*(C1+amp (ii,jj)*C1*C 2*C5)
+...
aqhomo(ii,jj)*(C1 *amp(ii,jj)* C2*((C6+C5)/ 2)+C1
*((C6C5)/2))...
C1)*dt;
RMS (Root Mean Square)
% loading empirical data
load('Data1.mat', 'Data1');
[row, col]=size(Data1);
% Calculating Root Mean Square
RMS = sqrt (nansum ((Output  emp_data)
.^2 )) / (col * row)