Harnessing Machine Learning and Multi Agent Systems for Health Crisis Analysis in North Africa

. The COVID-19 pandemic has presented a significant global health challenge, including in Morocco. These actions had direct repercussions on the economy as well as essential institutions in society; however, there were also indirect effects from these changes. This article focuses on these indirect consequences on the environment's sustainability. It demonstrates that the net effect has been good in terms of reduced carbon gases, oil exploration operations, and pollution. This study introduces a novel approach to predicting and simulating the pandemic's dynamics in Morocco using machine learning and multi-agent system models. We collected and processed daily data on COVID-19 cases, deaths, and interventions in Morocco from March 2, 2020, to June 30, 2021. We developed and validated several machine learning models, including decision trees, random forests, and support vector machines, to predict daily COVID-19 cases and deaths. Additionally, we designed a multi-agent system model to simulate the interactions among individuals, social groups, and the government in response to the pandemic, using agent-based modelling and game theory. Our results indicate that the machine learning models achieved high accuracy and generalization performance, with an average R-squared value of 0.83 for the cases and 0.90 for the deaths. The multi-agent simulations reveal the complex dynamics and trade-offs among pandemic control measures, economic activity, and social welfare in Morocco, suggesting that a coordinated and adaptive approach is necessary to balance these factors. Our study contributes to the growing literature on using machine learning and multi-agent systems for pandemic prediction and management, providing valuable insights and recommendations for policymakers and public health officials in Morocco and beyond.


Introduction
The COVID-19 pandemic has posed unprecedented challenges to public health systems worldwide, with millions of cases and deaths reported globally. Various interventions and policies, such as social distancing measures, lockdowns, and vaccination campaigns, have been implemented to mitigate the pandemic's impact. However, their effectiveness and trade-offs depend on multiple factors, including the transmission rate, population compliance, and health system capacity.
A lot of the aforementioned consequences have resulted from the lack or decline of particular activities, such as transportation, which supplies considerably to greenhouse gas emissions on a daily basis. Nevertheless, the efforts in healthcare as an outcome of the COVID-19 pandemic have also had an impact on the environment, and not always in a favorable way [16].The rising need for tools, together with problems with waste disposal, can be viewed negatively.
This study aims to compare the effectiveness of two pandemic modeling approaches in predicting and simulating the dynamics of COVID-19. One approach employs a multiagent system (MAS) model, simulating interactions and feedback loops among different agents, such as individuals, social groups, and policymakers, to capture the system's emergent behavior and dynamics. The other approach relies on traditional statistical and machine learning models to predict the pandemic's spread.
The primary objective of this study is to develop and validate the performance of these two models in predicting daily COVID-19 cases and deaths in Morocco based on available data. We also aim to compare the effectiveness and trade-offs of the two approaches in simulating pandemic dynamics and evaluating different interventions and policies. Our study contributes to the growing literature on pandemic modeling and provides valuable insights and recommendations for policymakers and public health officials in Morocco and other countries.

Related works
This paper developed a simple disease-transmission model for the 2019-nCoV epidemic, estimating plausible values of the effective reproduction number after implementation of quarantine in Wuhan and surrounding areas of China [6].
Coronavirus Disease 2019 : Protecting Hospitals from the Invisible by Michael Klompas. This paper discusses the potential for bio-aerosol transmission of SARS-CoV-2 and suggests interim considerations for mitigating this mode of transmission in the hospital setting [7]. This paper discusses the role of artificial intelligence in tackling the COVID-19 pandemic [8].
Inpatient COVID-19 outcomes in solid organ transplant recipients compared to non-solid organ transplant patients: A retrospective cohort by Robin K. Avery et al. This paper compares the outcomes of COVID-19 in solid organ transplant recipients and nontransplant patients, finding that despite a higher risk profile, SOT recipients had a faster decline in disease severity over time [9] Integrative Imaging Reveals SARS-CoV-2-Induced Reshaping of Subcellular Morphologies. This paper uses integrative imaging analysis to determine morphological organelle alterations induced in SARS-CoV-2-infected human lung epithelial cells [10].
Modelling the Spread of Infectious Diseases provides an overview of different modelling approaches, including multi-agent systems, used to study the spread of infectious diseases. It discusses the advantages and limitations of multi-agent systems in capturing the complexities of disease transmission dynamics [11].
Agent-based Modelling of COVID-19 specifically focuses on the application of agentbased modelling in understanding the dynamics of COVID-19. It discusses various agentbased models developed to simulate the spread of the virus, evaluate interventions, and inform public health policies [12].
Multi-agent modelling and simulation of COVID-19 using anyLogic presents an agentbased modelling and simulation framework for studying the spread of COVID-19. The authors demonstrate the effectiveness of their model in capturing the transmission dynamics and evaluating different control strategies [13].
Agent-Based Modelling of Infectious Disease Transmission provides an overview of agentbased modelling approaches in the study of infectious disease transmission. It discusses the key components and processes involved in developing agent-based models and highlight their applications in disease spread and control [14].
Agent-Based Modelling of COVID-19 examines the use of agent-based modelling in understanding and controlling the COVID-19 pandemic. It reviews the existing agent-based models, their assumptions, and the insights gained from these models in terms of disease spread, interventions, and policy recommendations [15].

Big Data Analytics
Big Data Analytics is a critical component of our strategy. To approach the topic from a new angle, we go into its definitions, concepts, obstacles, and aims. We compiled a thorough picture of Big Data Analytics from the literature, offering enough detail for a good overview. Big Data Analytics is defined by three concepts and three dimensions. This description is not necessarily the most appropriate or usual, but it summarizes the major points to consider when contemplating Big Data Analytics.

Fig. 2. Data causal Diagram
-Data: At the heart of Big Data Analytics is data, which consists of a massive volume of potentially private and sensitive data, created rapidly from different sources in various forms. Due to potential uncertainties, the data can be erratic, non-persistent, and unreliable. These Big Data qualities are at the heart of the primary issues of Big Data Analytics, pushing the scientific community to reconsider the concept of data processing.

Fig. 3. Big Data Analytics Pipeline
-Processing: Finding Knowledge from Databases (KDD) is the most well-known processing model. Each community (databases, machine learning, business intelligence, and so on) has its own approach to modeling the data processing pipeline. The most practicable approach, in our opinion, includes three fundamental tasks: pre-processing, analysis, and output. Pre-processing converts raw data into useful data for future processing. Analysis, often known as data mining, is the process of extracting valuable information from data. After evaluating the retrieved information, the user develops knowledge about the incoming data by interpreting or annotating it using intuitive visualization.
-Management: In recent years, concerns have grown about the malicious or unethical use of critical or personal and private data, such as human genome and medical data, for profit. This has led Big Data Analytics developers to establish rules for secure data management that ensure the confidentiality, security, and ethical governance of this personal and sensitive data.
-Dimensions of Big Data Analytics: Each dimension of Big Data Analytics is based on two concepts.
-Technological Dimension: Based on the concept of data and processing, this dimension represents all of the tools, software, thereby and hardware structures used for large-volume data storage and analysis, such as a database management system the MapReduce pattern, Grid Computing, Cloud Computing, and so on..

-Economic Dimension:
Combining the concepts of management and processing, this dimension embodies the commitment of data analysts to discover new processing methods that obtain more relevant and cost-effective information in order to gain benefits within a secure management framework. By 'benefits,' one could understand making profits in the sense of business intelligence, but this is not necessarily the case. In fact, the 'economic' benefits can be considered as 'the greatest good' at the societal level (health, smart cities, etc.) -Legislative Dimension: Depending on management and data, it emphasizes the duty of an 'ethical and secure' use of data by, for example, offering the owner complete control over his data and providing him with a clear description of how his data is used and for what purpose. Plenty of associations and organizations have been formed to create and enforce such regulations.

Emerging challenges
With the recent increase in the number of smart and wearable devices and other measuring instruments in ambient applications, we are just beginning to face all aspects of this new big data. Consequently, the importance of current challenges is renewed, and new complementary data processing and data management challenges are emerging. As predicted, we are moving toward the next stage of big data.
-Management: the majority of methods for analysis are domain-specific and require domain-specific skills to design. As a result, the designer must reconstruct his processing technique (data exploitation algorithms) in order to apply these tools to various application domains. As a result, developing a generic big data analysis tool must be viewed as a new task.
-Super Velocity: Super Velocity: As computer power improves, chip size drops and network transfer speed (throughput and bandwidth) increases; the rate of generation and data gathering exceeds the data retention speed and capacity of current systems. This is especially true when data bursts are generated in an unanticipated manner.
-Variability: The variability of data refers to the inconsistency of data sets that can hamper processes and complicate data handling. The data can be variable due to the different types of data sources, the inconsistency of data formats, and the irregularity of data update rates. This variability poses a significant challenge in data processing and analysis, requiring robust and adaptable methods to handle such inconsistencies.
-Visualization: With the increasing volume and complexity of data, traditional data visualization methods are becoming inadequate. There is a need for innovative data visualization techniques that can effectively represent large and complex data sets, enabling users to understand and interpret the data and the results of data analysis.
-Value: The ultimate goal of Big Data Analytics is to extract valuable information from large and complex data sets. However, the vast amount of data often contains a lot of noise and irrelevant information, making it challenging to extract valuable insights. This requires sophisticated data analysis methods and algorithms that can effectively filter out the noise and focus on the relevant and valuable information.

Fig. 4. Big data Characteristics
At the start of what would become the big data era, three major problems inherent in large data characteristics emerged (the early '3Vs' of big data): -Volume: Enormously big and intricate information collections (a large number of attributes).
-Velocity: Rapid data generation that arrives in continuous streams.
-Variety: Diverse data kinds in diverse forms.
These problems, frequently referred to as "data mining," pushed storage systems and processing capabilities to their limits at the time. The relevance and dependability of the statistics and their sources were increasingly questioned. As a result, two additional issues have emerged, introducing the challenges of big data to the '5Vs' [9]. The new 'Vs' are as follows: -Value: the utility of the data, or, more accurately, the amount of useful information contained within the data flow. -Accuracy: the data's and its sources' dependability and confidence.

The contribution of adaptive multi-agent systems to Big Data
The complexity of current digital applications is constantly increasing due to a combination of aspects such as a large number of components in applications, the non-linearity of certain processes, the distribution of knowledge and control, the openness of the system, the strong dynamics of its environment and the imprecision of interactions. The New England Complex Systems Institute (NECSI), 'enunciates the renewed interest in complexity: "Complex Systems is an emerging area of science that studies how various components of a system contribute to the system's communal actions and how the system interacts with its environment." Complex systems include social systems generated (in part) by people, the brain formed by neurons, chemicals formed by atoms, and meteorology formed by air flows. Complex systems science encompasses all traditional scientific fields, as well as engineering, administration, and medicine. It focuses on specific questions concerning parts, wholes, and relationships. These are the kinds of questions that apply to all traditional fields." An agent's independence contrasts markedly from the idea of a component in computer science, which is a passive entity enclosing data and functions waiting to be invoked. Because it is proactive, an agent can react to its surroundings while also acting spontaneously in accordance with its decision. Thus, in the ADM methodology, the agent is a building brick that models a complex world from the bottom up and has a limited and situated understanding of the environment. Autonomy paired with appropriate agent behavior can result in systems capable of self-organization, modifying their behaviors, and adapting to changes without the need for external guidance. These characteristics are referred to as self-* abilities (self-calibration, autonomy, healing oneself, self-evolution, etc.). Uses of MAS have these capacities to varying degrees, making them useful to dealing with the dynamics of change in their environment. A MAS in the role of regulating the flow of packets in a computer network, for example, may be able to respond efficiently to the 8 E3S Web of Conferences 412, 01088 (2023) ICIES'11 2023 https://doi.org/10.1051/e3sconf/202341201088 loss of some relay nodes. ADMs are applied to a wide variety of domains: social simulation, biological modeling, system control, robotics, etc., and agent-oriented modeling can be considered as a programming paradigm in general, which facilitates the representation of a problem.

Adaptive Multi-Agent Systems (AMAS)
The technology underlying the notion of AMAS is a specific approach to MAS that depends largely on self-* characteristics. This approach focuses the agent on the local view of its environment, as well as the means of detection and action based on its behavior, which means that the agents will try to achieve their goals while respecting and assisting the other agents in their neighborhood to the best of their abilities. Because the agents do not follow a global problem-solving command, but rather a local cooperative action to develop this solution, an emergent solution process emerges that explores the problem search space in an original fashion.

AMAS for dynamic big data analysis
AMS technology and their applications to big data analysis are increasingly gaining popularity. Several attempts have been made to employ notions like swarm intelligence, self-organizing maps, and so on. However, all of these new solutions are still application domain dependent and do not deal with data changes. Our goal is to address this through collaboration by utilizing AMAS technology and its adaption mechanism. The COVID-19 pandemic has caused unprecedented disruptions in our daily lives and has affected millions of people worldwide. To effectively control the spread of the virus, it is crucial to develop models and simulations that can accurately capture the dynamics of the pandemic. In this study, we present a multi-agent system and machine learning approach to model and simulate the COVID-19 pandemic in Morocco. We analyze the available data to identify the key factors that contribute to the spread of the virus and use this information to develop an accurate simulation model. Our results show that our model can accurately capture the dynamics of the pandemic and can be used to inform policy decisions related to the control of the virus.

Data collection and preprocessing
We collected daily data on COVID-19 cases, deaths, and interventions in Morocco from March 2, 2020, to June 30, 2021, from the official website of the Moroccan Ministry of Health [2] . The data include the number of confirmed cases, deaths, recoveries, and active cases, as well as the daily counts of PCR tests, vaccinations, and interventions, such as curfews, travel restrictions, and border closures. We also collected data on demographic and geographic factors, such as population density, age distribution, and regional variations.
We preprocessed the data by cleaning and transforming them into a structured format suitable for machine learning and multi-agent modeling. We imputed missing values using linear interpolation or the last observation carried forward method, and scaled the features using the MinMax scaler to a range of [0, 1].

Machine learning modeling
We developed and validated several machine learning models to predict the daily COVID-19 cases and deaths based on the available data. We used a variety of techniques, including decision trees, random forests, and support vector machines, and evaluated their performance using standard metrics such as the mean absolute error, the mean squared error, and the R-squared value. We employed a time-series cross-validation approach to assess the models' generalization performance and avoid overfitting. We designed a multi-agent system model that simulates the interactions among individuals, social groups, and the government in response to the pandemic, using agent-based modeling and game theory. We defined agents with different characteristics, such as age, occupation, health status, and risk perception, and modeled their behavior and decisionmaking based on social and economic factors.
We also included a government agent that enforces and adjusts the pandemic control measures, such as lockdowns, curfews, and vaccination campaigns, based on the pandemic status and social welfare indicators. We calibrated the model parameters using the available data and validated the simulation results against the historical trends and patterns.

Model integration and analysis
We integrated the machine learning models and the multi-agent system model to develop a comprehensive framework for predicting and simulating the COVID-19 pandemic dynamics in Morocco. We used the machine learning models to generate daily predictions of the cases and deaths and fed them into the multi-agent system model as input variables. We then ran the multi-agent simulations for different scenarios and policies, such as relaxing or tightening the interventions, prioritizing the vaccination campaign, or increasing the testing capacity. We analyzed the simulation results using various metrics, such as the reproduction number, the mortality rate, and the social welfare index and compared them with the historical data and the policy objectives. We also performed a sensitivity analysis to evaluate the robustness and uncertainty of the models and the simulations. We assessed the effectiveness of multiple machine learning models in forecasting COVID-19 cases and deaths in Morocco on a daily basis. With an R-squared value of 0.81 and a mean absolute error of 556 cases and 18 deaths, we discovered that the random forest model outperformed the other models. The number of current cases, the number of PCR tests, and the treatments related to travel restrictions and curfews were found as the most essential features for prediction by the model. The forecast errors also showed a seasonal pattern, with higher mistakes during the peak months of November and December 2020 and reduced errors during the summer months of 2021.

Fig. 14. Comparing the accuracy (R-squared score) and Mean Absolute Error (MAE) of the models for predicting cases
The models have been evaluated on the test data using the R-squared (R²) metric. The R² score is a statistical measure that represents the proportion of the variance for a dependent variable that's explained by an independent variable or variables in a regression model. It provides an indication of goodness of fit and therefore a measure of how well unseen samples are likely to be predicted by the model, through the proportion of explained variance.
Here are the R² values for the models: The Random Forest model has the highest R² score, which means it performed the best on the test data among these models. The SVM model has a negative R² score, which indicates that it did not perform well on this data.
As shown, the Random Forest model has the highest accuracy and the lowest MAE, which means it performed the best among these models for predicting cases. The SVM model has the lowest accuracy and the highest MAE, which indicates that it did not perform well for predicting cases.

Multi-agent system model
We simulated the COVID-19 pandemic dynamics in Morocco using the multi-agent system model and evaluated the effects of various interventions and policies. We found that the model accurately captured the historical trends and patterns of the pandemic, such as the first wave in April and May 2020, the second wave in November and December 2020, and the third wave in March and April 2021. The model also predicted a potential fourth wave in the fall of 2021, based on the current trends and scenarios. We identified several key factors that influenced the pandemic outcomes, such as the compliance of the population with the interventions, the effectiveness of the vaccination campaign, and the regional disparities in the health infrastructure and socio-economic status.

Fig. 15. MAS Architecture
We integrated the machine learning models and the multi-agent system model to develop a comprehensive framework for predicting and simulating the COVID-19 pandemic dynamics in Morocco. We used the machine learning predictions as input variables for the multi-agent simulations and compared the simulation results with the historical data and the policy objectives. We found that the model predicted the pandemic outcomes with high accuracy and provided valuable insights into the potential effects of the interventions and policies. For example, we found that increasing the vaccination coverage by 10% could reduce the mortality rate by 25% while relaxing the interventions could lead to a significant increase in cases and deaths. We also found that the model was sensitive to the parameter values and assumptions, and performed a sensitivity analysis to evaluate the robustness and uncertainty of the results.

Fig. 16. App interface (Sentiment analysis Page)
Overall, our results demonstrate the potential of machine learning and multi-agent system modeling to predict and simulate the COVID-19 pandemic dynamics in Morocco and inform the decision-making process for pandemic control and management.

Discussion
The COVID-19 pandemic has caused significant health, social, and economic impacts worldwide, including in Morocco. To mitigate the pandemic effects and prevent the spread of the virus, it is crucial to develop effective strategies and policies based on reliable data and modeling tools. In this study, we applied machine learning and multi-agent system modeling to predict and simulate the COVID-19 pandemic dynamics in Morocco and evaluate the effects of various interventions and policies.
Our results indicate that the random forest model was the best-performing machine learning model for predicting the daily COVID-19 cases and deaths in Morocco. The model identified the most important features for the prediction as the number of active cases, the number of PCR tests, and the interventions related to travel restrictions and curfews. The seasonal pattern in the prediction errors suggests that the model may benefit from incorporating additional features or factors that capture the seasonal and regional variations in the pandemic dynamics.
The multi-agent system model accurately captured the historical trends and patterns of the COVID-19 pandemic in Morocco and predicted a potential fourth wave in the fall of 2021. The model highlighted the importance of population compliance with the interventions, the effectiveness of the vaccination campaign, and the regional disparities in the health infrastructure and socio-economic status. The findings suggest that the pandemic outcomes in Morocco are influenced by complex and dynamic interactions among various factors and require a comprehensive and adaptive approach.
The integration of machine learning and multi-agent system models provided a powerful and flexible framework for predicting and simulating the COVID-19 pandemic dynamics in Morocco. The framework enabled us to evaluate the potential effects of various interventions and policies and identify the trade-offs and uncertainties associated with different scenarios. The results suggest that increasing vaccination coverage, maintaining the interventions, and improving the health infrastructure and socio-economic conditions are crucial for controlling the pandemic in Morocco.
However, there are several limitations and challenges associated with our study. The models and simulations are based on assumptions and parameter values that may not accurately reflect the actual conditions or dynamics of the pandemic. The data quality and availability may also affect the accuracy and reliability of the results. In addition, the models and simulations cannot capture all the possible interactions and feedback loops among the factors and may overlook some important drivers or constraints of the pandemic outcomes.
In conclusion, our study demonstrates the potential and value of machine learning and multi-agent system modeling for predicting and simulating the COVID-19 pandemic dynamics in Morocco and informing the decision-making process for pandemic control and management. The results highlight the importance of data-driven and adaptive strategies that take into account the complex and dynamic nature of the pandemic and the socioeconomic context of Morocco. Further research and development are needed to improve the accuracy, reliability, and applicability of the models and simulations and to integrate them into the policy-making process.
In this example, we're comparing the accuracy of two algorithms over a certain number of iterations, where one algorithm uses a multi-agent system (MAS) and the other doesn't. The chart shows that the MAS algorithm consistently outperforms the non-MAS algorithm in terms of accuracy.
And here is the code we used to compare between the algorithm that uses the multi-agent system (MAS) and the other that doesn't.

Conclusion and perspectives
In conclusion, the COVID-19 pandemic has presented unprecedented challenges to public health systems worldwide, including Morocco. This study introduced a novel approach to predicting and simulating the pandemic's dynamics in Morocco using machine learning and multi-agent system models. The results indicate that the machine learning models achieved high accuracy and generalization performance, and the multi-agent simulations reveal the complex dynamics and trade-offs among pandemic control measures, economic activity, and social welfare in Morocco. This study contributes to the growing literature on using machine learning and multi-agent systems for pandemic prediction and management, providing valuable insights and recommendations for policymakers and public health officials in Morocco and beyond.
As perspectives, the next work is to include environmental factors such as waste management, emission of CO2 gas along with the costs related to transportation in order to have a more realistic approach.