🚀 金融情感微調版FinBERT(金融短語庫 + GitHub數據集)
本模型是基於金融情感分類任務對FinBERT進行微調的版本,能夠有效處理金融文本情感分析問題,為金融領域的決策和研究提供有力支持。
🚀 快速開始
你可以通過Hugging Face Transformers庫使用該模型:
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model_name = "Driisa/finbert-finetuned-github"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
text = "The company's stock has seen significant growth this quarter."
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
outputs = model(**inputs)
predicted_class = outputs.logits.argmax().item()
print(f"Predicted Sentiment: {['Negative', 'Neutral', 'Positive'][predicted_class]}")
✨ 主要特性
- 該模型是FinBERT (
ProsusAI/finbert
) 的微調版本,專門用於金融情感分類。
- 能夠將金融文本分為三類:
📦 安裝指南
文檔未提及安裝步驟,故跳過該章節。
💻 使用示例
基礎用法
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model_name = "Driisa/finbert-finetuned-github"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
text = "The company's stock has seen significant growth this quarter."
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
outputs = model(**inputs)
predicted_class = outputs.logits.argmax().item()
print(f"Predicted Sentiment: {['Negative', 'Neutral', 'Positive'][predicted_class]}")
📚 詳細文檔
📂 使用的數據集
該模型在以下數據集上進行訓練:
✅ 金融短語庫 - 一個廣泛使用的金融情感數據集。
✅ GitHub生成的情感數據集 - 用於測試模型的額外數據集。
⚙️ 訓練參數
參數 |
值 |
模型架構 |
FinBERT(基於BERT) |
批量大小 |
8 |
學習率 |
2e - 5 |
訓練輪數 |
3 |
優化器 |
AdamW |
評估指標 |
F1分數、準確率 |
📊 模型性能
數據集 |
準確率 |
F1(加權) |
精確率 |
召回率 |
金融短語庫(訓練集) |
95.21% |
95.23% |
95.32% |
95.21% |
GitHub測試集 |
64.42% |
64.34% |
70.52% |
64.42% |
🚀 預期用途
該模型適用於:
✅ 金融分析師和投資者,用於評估報告、新聞和股票討論等金融語句的情感。
✅ 金融機構,用於自動化交易中基於自然語言處理的情感分析。
✅ 人工智能研究人員,探索金融自然語言處理模型。
⚠️ 侷限性
⚠️ 重要提示
該模型可能無法很好地泛化到金融語言差異較大的數據集。
可能需要針對特定金融領域(加密貨幣、銀行業、初創企業)進行微調。
🔧 技術細節
文檔未提供具體技術實現細節,故跳過該章節。
📄 許可證
本模型使用的許可證為MIT許可證。