Spaces:
Running
Running
A newer version of the Streamlit SDK is available:
1.47.1
FinGPT Sentiment Analysis
Motivations:
- Classify financial statements to help traders aggregate and digest financial news
Methods:
- FinGPT fine-tuning
- Retrieval-Augmented Generation
Setup
- Set up your .env file, can refer to /FinGPT_sentiment/.env.example
- Visit FinGPT_RAG/requirements.txt for the environment setup
python news_scraper.py
I. Data Preparation
Task 1: GPT-based News Classification
- On UI, select csv file to load
- Creates "classification" column for each financial statement
- Using "default_classification_prompt" to ask GPT to classify the news
- Saves .csv
Task 2: Context Retrieval
- On UI, select csv file to load
- Creates "contextualized_sentence" for each financial statement
- Using Google and various news sources to retrieve the context
- Add relevant news paragraphs to form "contextualized_sentence" for each financial statement
- Saves .csv
Experiment:compare non-RAG vs. RAG sentiment classification using gpt:
- utils/sentiment_classification_by_external_LLMs.py: Call openAI APIs to classify RAG-based and non-RAG-based statements
- utils/classification_accuracy_verification.py: Calculate the accuracy of sentiment classification between RAG-based and non-RAG-based statements
- Results: 0.7876588021778584 vs. 0.8130671506352088
python utils/sentiment_classification_by_external_LLMs.py
python utils/classification_accuracy_verification.py