This project performs sentiment analysis on financial news headlines related to rare elements using Natural Language Processing (NLP) techniques. The goal is to classify the sentiment (Positive, Negative, Neutral) of headlines and understand how news sentiment can affect the market performance of rare elements.
sentimentofrarelements.ipynb # Main Jupyter Notebook with full pipeline
requirements.txt # List of dependencies
README.md # Project overview and setup guide
-
Real-time scraping of financial news headlines using
newsapi
-
Text preprocessing and cleaning
-
Sentiment labeling using TextBlob
-
Model training using:
- Logistic Regression
- Random Forest
- Support Vector Machine
-
Model evaluation using accuracy and confusion matrix
-
Sentiment prediction for new/unseen headlines
- Clone the repository:
git clone https://github.com/Anshul-ydv/sentiment-analysis-of-rare-metals.git
cd sentimentofrarelements
- Install dependencies:
pip install -r requirements.txt
-
Run the notebook:
- Open
sentimentofrarelements.ipynb
in Jupyter Notebook or Google Colab. - Execute each cell sequentially.
- Open
-
To test new headlines:
- Replace the example headlines in the input cell with your own.
- Run the prediction cell to see the sentiment.
Headline | Predicted Sentiment |
---|---|
"Rare earth prices surge amid supply concerns" | Positive |
"Demand for rare metals declines in Q1" | Negative |
- Python
- Pandas, NumPy
- Scikit-learn
- TextBlob
- Matplotlib / Seaborn
- NewsAPI
- Use more advanced models like BERT or RoBERTa
- Integrate a live dashboard for sentiment tracking
- Analyze correlation with market prices of rare elements
This project is licensed under the MIT License.