Skip to content

FallPrediction/evaluate_embedding_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

評估 embedding model

讀取 data 資料夾下的餐點 json 資料(範例資料來源:Foodpanda )
測試以下兩個 model 的 embedding:

  1. intfloat/multilingual-e5-small
  2. Qwen/Qwen3-Embedding-0.6B

將向量資料寫入 Chroma,然後向量查詢 4 筆資料,計算精確率 precision、召回率 recall
寫入和查詢向量的方法都是按照該 model 在 Huggingface 頁面上寫明的方法,因為有點不同,所以各自有一個 class 都實作 get_embedding()、query_embedding(),用簡單工廠依照 model 名稱產生對應的 object

範例資料評估結果

model intfloat/multilingual-e5-small 評估結果:

{
 "好吃便當": {
  "P_5": 0.6,
  "recall_5": 0.6
 },
 "吃素": {
  "P_5": 0.2,
  "recall_5": 0.25
 },
 "鹹的但不吃雞肉": {
  "P_5": 0.2,
  "recall_5": 0.25
 },
 "下午茶": {
  "P_5": 0.4,
  "recall_5": 0.6666666666666666
 },
 "早餐": {
  "P_5": 0.4,
  "recall_5": 0.6666666666666666
 },
 "宵夜": {
  "P_5": 0.2,
  "recall_5": 0.5
 },
 "酸辣": {
  "P_5": 0.4,
  "recall_5": 1.0
 }
}

model Qwen/Qwen3-Embedding-0.6B 評估結果:

{
 "好吃便當": {
  "P_5": 0.4,
  "recall_5": 0.4
 },
 "吃素": {
  "P_5": 0.4,
  "recall_5": 0.5
 },
 "鹹的但不吃雞肉": {
  "P_5": 0.0,
  "recall_5": 0.0
 },
 "下午茶": {
  "P_5": 0.4,
  "recall_5": 0.6666666666666666
 },
 "早餐": {
  "P_5": 0.0,
  "recall_5": 0.0
 },
 "宵夜": {
  "P_5": 0.2,
  "recall_5": 0.5
 },
 "酸辣": {
  "P_5": 0.4,
  "recall_5": 1.0
 }
}

參考資料

About

Evaluate the precision and recall of two embedding models using the same data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages