# Framework Based on Simulation of Real-World Message Streams to Evaluate Classification Solutions
## 2 Proposed Framework
### Message Stream Simulation
To select the \(q\) messages, an integer uniform random number with an interval \([0,v]\) is generated, first to select the set of messages to be obfuscated, and second to select the \(q\) messages to be obfuscated (the last time with an interval \([1,v]\) without repetitions). The \(mc\) form a message corpus about the profile class, which can receive messages from the public corpus or from personal sources (e.g., emails from a mailbox). A message corpus is defined as \(mc=\{m_{1},m_{2},\ldots,m_{n}\}\), where \(m_{i}\) is the \(i\)-th message in the corpus. \(S_{p_{n}}\) is defined as:\[S_{p_{n}}=\left( \begin{array}{cccc}m_{1,1},&m_{1,2},&\cdots&m_{1,r_{1}};\\ m_{2,1},&m_{2,2},&\cdots&m_{2,r_{2}};\\ \cdots;&\\ m_{n,1},&m_{n,2},&\cdots&m_{n,r_{n}};\\ \cdots;&\end{array} \right)\]  
Here, \(m_{ij}\) represents the \(j\)-th text at the \(i\)-th time. The union of the message streams generated by each profile instance forms the message stream, so it is defined as \(S=\cup_{p=1}^{l}S_{p}\mid p\in P\), where \(S_{p}=\cup_{n=1}^{l}S_{p_{n}}\). The general modelling of profile behaviour is based on simulation concepts [20] and the M/M/1 queueing model (Poisson input, exponential service times and single server) [21]. To summarise the physical operation of the system, incoming messages enter the queue, are eventually served, and then leave. It is therefore necessary for the simulation model to describe and synchronise the arrival of messages and the serving of messages. The general behaviour of the profile instance is shown in Figure 2.  
Starting at time 0, the simulation clock records the (simulated) time \(t\) that has elapsed during the simulation run so far. The information about the queueing system that defines its current status, i.e., the state of the system, is \(N(t)=\) number of messages in the system at time \(t\). The events that change the state of the system are the arrival of messages or a service completion for the messages currently in service (if any). The values of mean arrival rate \(\lambda\) and mean service rate \(\mu\) are \(t_{ms}/h*r\) and \(t_{ms}\), respectively. Each profile instance has independent \(t_{ms}\), \(r\) and \(h\) values. The state transition formula is:  
\[\text{Reset }N(t)=\left\{ \begin{array}{ll}N(t)+n&\text{if the arrival of $n$ texts occurs at time $t$}\\ N(t)-n&\text{if service completion of $n$ messages occurs at time $t$}\end{array} \right.\]  
The event generation method consists in forming a message batch \(mb=\{m_{1},m_{2},\ldots,m_{r}\}\), where \(m_{i}\) represents the \(i\)-th message in the batch, selecting from \(n\) messages of the input source by generating an integer uniform random number for each message and sending it to the queue. The random numbers have an interval of \([1,n]\). This method of event generation allows us to assume that the input source is infinite, since \(n\) messages can be selected from each element of \(mb\), generating \(n^{r}\) batches, which tend to be infinite. In the queue system, the queue discipline is first-come-first-served. The service mechanism consists in sending a message batch \(mb=\{m_{1},m_{2},\ldots,m_{r}\}\) in a \(\mu\). The training examples profile will have a single instance that generates a message stream by selecting message examples and their real classes from the messages sent by the created profile instances. The examples in this stream can be used by the evaluated solutions in the learning process. The latency \(lat\) is the time between the prediction of an unlabelled instance by a classifier and the availability of its real label by the environment, and is classified as either null, intermediate or extreme latency.