This repository contains Python files for generating synthetic social media post data and analyzing the dataset.
- Data Generation: Generate synthetic data to perform analysis on.
- Data Analysis:
- Generate summary of the data.
- Plot data in many different ways.
- Analyze how data visualization can be misleading when focused on one subset of the data.
- Prediction using Linear Regression
- Use sklearn's Linear Regression to predict future sentiments on historical data.
1. Install the required libraries. You can install the necessary libraries by running the following command:
pip install -r requirements.txt
2. Generate the dataset The dataset can be generated by running the generate.py file. A generated dataset "posts.db" comes included with 10000 observations.
database_sizeNumber of observations in the generated database.percent_twitternegativePercentage of posts to generate with "Negative" sentiment on "Twitter" platform.percent_instanegativePercentage of posts to generate with "Negative" sentiment on "Instagram" platform.percent_facebooknegativePercentage of posts to generate with "Negative" sentiment on "Facebook" platform.start_yearStarting year for dataset.end_yearEnding year for dataset.pos_increaseHow intense the number of positive posts increases per year. Higher = bigger increase. Number between 0 and 1, can be negative as well.
3. Generate data summary
To gain a general overview of the data, run the summary() function in main.py. This will create a .txt file called "summary.txt" which contains general information about the data. A summary.txt file comes already included on the generated dataset.
4. Generate plots
To better understand the generated data, run the plot_data() function in main.py.
5. Run predictions using Linear Regression with sklearn
To see how social media sentiments might change in the future based on historical data, run the predict_future() function in main.py.