# A Multi-Agent Architecture for Data Analysis
## 3 ActoDatA Overview
Figure 2: The ActoDatA (Actor Data Analysis) multi-agent architecture. A _preprocessor_ agent has the duty of performing the typical preprocessing operations (i.e., cleaning, instance selection, normalization, transformation, and feature extraction [9]) on the data coming from the acquirer agents, to which it registered its interest to receive the data. This agent can perform different tasks by encapsulating different preprocessing modules that can be implemented in two different languages, Java and Python. This agent performs iteratively the following activities:  
* Processes the data by using the embedded preprocessing module
* Sends the data to the registered engine agents. An _engine_ agent has the duty of performing the classification of the data coming the _preprocessor_ agents, to which it registered its interest to receive the data. This agent embeds a classifier (usually, a Weka [10] or a scikit-learn [11] classifier) that can be implemented either in Java or Python. Moreover, it must have access to a training and a test set and be able to update the training set by using the incoming data. After the reception of a fixed number of new instances, this agent performs the following activities:  
* Runs the embedded classifier on a sequence of data sets
* Sends the result sets to the controller and updates the training sets (optional)
* Usually, a new iteration starts when the engine agent receives a certain number of new data. A _controller_ agent has the duty of managing one or more engines working on the same data sets. This agent performs iteratively the following activities:  
* Compares their results and saves the results on the data storage
* Notifies the web/APP server about activities and results  
Finally, a _master_ agent has the duty of managing the applications of a specific multi-agent architecture. In particular, it performs the following activities:  
Figure 3: The code of a filter for Twitter messages selecting messages on the basis of the language and the presence of keywords. Interacts with the users through the specific console
* Monitors the execution of the applications, logging their relevant events
* Notifies those events to the web/APP server and to the user console. Users can view the analysis results through a web browser and a reporting APP. In particular, both of the interfaces show information about the analysis results and collected data and update the presentation of the data dynamically. In particular, such interfaces can show:  
* Pie and line charts presenting, for example, the data that have eventually been classified for each class during the observed period
* The total number of instances, repeated data, and discarded data
* The numeric results of classifiers for all the data
* The frequency of classifications of the latest data. As introduced above, ActoDaTA supports the analysis of email and Twitter data. This is done through a mailing and a Twitter service. The mailing service accepts requests from actors for registering their interest to receive the emails sent from a set of addresses, receives incoming messages into a specific mailbox, and forwards them to subscriber actors. The Twitter service allows actors to register their interest on some tweets from the widespread Twitter social platform. In particular, it allows actors to send the following kinds of requests:  
* User timeline, to obtain the recent tweets of a specified user and save them in a local storage system
* Content query, to obtain recent tweets published on Twitter and selected according to constraints specified by the actor
* Stream, to receive messages published on the platform during the execution. Tweets are obtained in the form of JSON objects. The development of an application mainly consists in the definition of a configuration file where the following are defined: (_i_) The agents involved in the application; (_ii_) the relationships among them; and (_iii_) for each agent the specific data analysis components used in their activities (e.g., filters, classifiers and training and test sets).