-
Clone the Repository: Pull this project to your local machine using Git.
-
Set Up Environment:
-
Mac Users: In the directory where
environment.ymlis located, create the environment using:conda env create -f environment.yml
Note: Mac users cannot run the Training sentiment analysis for ABSA (Aspect-Based Sentiment Analysis) because it requires CUDA for GPU acceleration, which is not supported on macOS. However, the pre-processed sentiment analysis output file is available in UIUC Box and is automatically used by the script
-
Windows Users: Manually create a Conda environment and install the required packages:
conda create -n cs410_project python=3.11 conda activate cs410_project conda install pandas tqdm numpy=1.26 conda install -c conda-forge spacy conda install -c conda-forge nltk conda install -c conda-forge textblob conda install -c conda-forge statsmodels conda install -c conda-forge scikit-learn pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 pip3 install spacy-langdetect transformers[sentencepiece] tiktoken protobuf
Note: Windows users must have the CUDA toolkit installed to run the Training sentiment analysis for ABSA, as the model requires GPU acceleration. However, the pre-processed sentiment analysis output file is available in UIUC Box and is automatically used by the script.
-
-
For Train Tweet Data: a. Navigate to the
code/process/trainfolder:- Run
python process_data.pyto initialize the 'DataProcessor' class. - Run
python script.pyto clean and label the data using the 'DataProcessor' class.- Note: This step may take approximately 5 hours. You should see a
processed_data.csvfile after successful completion of this step. b. Navigate to thecode/pipelinefolder:
- Note: This step may take approximately 5 hours. You should see a
- Run
python TrainPipeline.pyto configure sentiment analysis, process sentiment data, and generate predictions using the defined pipeline.
- Run
-
For Test News Data: a. Navigate to the
code/process/testfolder:- Run
python news_process_data.pyto initialize the 'NewsDataProcessor' class. - Run
python script.pyto clean and label the data using the 'NewsDataProcessor' class.- Note: You should see a
processed_data.csvfile after successful completion of this step. b. Navigate to thecode/pipelinefolder:
- Note: You should see a
- Run
python TestPipeline.pyto configure sentiment analysis, process sentiment data, and generate predictions using the defined pipeline.
- Run
Flow:
process_data.py→script.py→sentiment_analysis.pyornews_sentiment_analysis.py→process_layer2_data.pyornews_process_layer2_data.py→model.py
(The last three files were combined together inTrainPipeline.py/TestPipeline.py)
Note: Some scripts (e.g., process_data.py) in the Training flow take hours to run. Instead of requiring users to run those scripts, pre-processed outputs are stored in the cloud (UIUC Box) to use as data sources.