This project simulates a dynamic social media environment to develop and evaluate reinforcement learning (RL) agents. The RL agent’s goal is to optimize its influence within the network by strategically deciding when to post, engage with other users, follow/unfollow, and maximize overall engagement.
The simulation incorporates realistic user behaviors and network dynamics, including posting activity, engagement patterns, and evolving follower relationships. This serves as a foundation for studying social media dynamics and testing agent strategies in controlled yet realistic environments.
- User Types: Simulated users with distinct behavioral patterns such as lurkers, casual users, active users, influencers, and bots.
- Dynamic Posting and Engagement: Users post content based on probability and engage with visible posts in their network.
- Follower Dynamics: Agents grow and manage their follower networks through follow-back, follow, and unfollow actions.
- Customizable Simulation: Adjust user distributions, posting probabilities, and engagement patterns to explore diverse scenarios.
- Data Collection and Analysis: Metrics such as post frequency, engagement levels, and follower growth rates are tracked to evaluate agent and network behaviors.
- Mesa: For agent-based modeling and simulation.
- NetworkX: For modeling the social media network graph.
- Plotly: For creating interactive visualizations of simulation results.
- Python Libraries: NumPy, pandas, matplotlib for data manipulation and plotting.
Key metrics include:
- Post Frequency and Engagement: Tracking posting and engagement trends over simulation steps.
- Follower Growth: Analyzing how users and agents grow their influence.
- Network Structure: Visualizing and analyzing the evolving network graph.
- RL Agent Performance: Evaluating the agent’s ability to optimize posting strategies and engagement actions.
- Reinforcement Learning: This simulation is designed to train RL agents on how to navigate complex social systems.
- Social Media Research: Analyze and simulate user behaviors in social networks to test new features or moderation policies.
- Marketing Strategy: Model and optimize content strategies for influencers and brands using AI.
- Clone the repository:
git clone https://github.com/your-username/social-media-simulation.git cd social-media-simulation
- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install dependencies:
pip install --pre "mesa[viz]" networkx matplotlib plotly pandas
4.Run the simulation notebook or script: python main.py
Visualizations from the simulation include:
- Post frequency and engagement trends over time.
- Follower dynamics by user type.
- Network graphs showing relationships and influence patterns.
- Implement multi-day RL strategies for agents.
- Add advanced network dynamics such as trending topics and hashtags.
- Incorporate time-based active hours for realistic posting schedules.
- Experiment with various RL algorithms for agent optimization.
Contributions are welcome! Feel free to submit a pull request or open an issue to suggest features or report bugs.
This project is licensed under the MIT License. See the LICENSE file for details.