---
# System prepended metadata

title: 向量資料庫
tags: [DB]

---

# 向量資料庫

## 目錄
[TOC]

## 甚麼是向量?
![image](https://hackmd.io/_uploads/HJZ-rqGAA.png)
![image](https://hackmd.io/_uploads/S1wuBoz00.png)


## 甚麼是Embedding?
![image](https://hackmd.io/_uploads/B1Mprif00.png)
![image](https://hackmd.io/_uploads/rJ11UiM0C.png)
![image](https://hackmd.io/_uploads/HJ8xLozA0.png)
![image](https://hackmd.io/_uploads/B19vIszCA.png)
![image](https://hackmd.io/_uploads/HJtY8of0A.png)
![image](https://hackmd.io/_uploads/HyZcLiMCA.png)

## 向量資料庫跟傳統資料庫區別
![image](https://hackmd.io/_uploads/H1Ij16zAA.png)
![image](https://hackmd.io/_uploads/r1arPof0C.png)
![image](https://hackmd.io/_uploads/HkywwjMRA.png)
![image](https://hackmd.io/_uploads/HkcvwjfRC.png)
![image](https://hackmd.io/_uploads/ByDcwiz0A.png)

## 當前常用向量資料庫
![image](https://hackmd.io/_uploads/SJnag6GRC.png)

## 實際應用 
![image](https://hackmd.io/_uploads/BJQ9WafRR.png)
  

### 實作範例

#### 實作一
##### [faiss](https://colab.research.google.com/drive/1_4hhQgW3bWetfGtyHRh8_7gwezdPEV6x)

#### 實作二
##### [chroma db](https://github.com/princend/face_recognition_opencv/tree/vector-db)
## BONUS - HNSW 演算法
![image](https://hackmd.io/_uploads/Sy0hYCMR0.png)




## Reference
### 向量
- [高中向量介紹影片-均一教育平台](https://www.youtube.com/watch?v=dhwlNUDHC-4&list=PLp2Y5q36tB-Psi4jKfg-S73tbBvfOZWxc&ab_channel=均一教育平台JunyiAcademy)
### Embedding
- [word embedding](https://www.youtube.com/watch?v=X7PH3NuYW0Q&ab_channel=Hung-yiLee)
### 向量資料庫
- [基礎介紹](https://aws.amazon.com/tw/what-is/vector-databases/)
- [基礎介紹2](https://blog.darkthread.net/blog/vector-db-concept/)
- [基礎介紹3](https://tenten.co/learning/vector-database/)
- [基礎介紹-YT影片](https://www.youtube.com/watch?v=cv_x2hvbZrQ&list=PLuufbYGcg3p69q_OJoC6USZNf6dK4tXcf&ab_channel=ZOMI酱)
- [基礎介紹-YT影片的講義](https://github.com/chenzomi12/AISystem/tree/784404f22ab6d0b949e4583cab648f3c184ac8f6/06Foundation/05Dataset)
- [生成式AI(11) — 本地的向量資料庫Chroma + OpenAI](https://medium.com/@King610160/生成式ai-11-本地的向量資料庫chroma-openai-7882e54c1fb2)
- [pinecone範例](https://colab.research.google.com/github/pinecone-io/examples/blob/master/docs/semantic-search.ipynb#scrollTo=dJbjE-iq_yMr)
- [chroma db範例](https://github.com/billlin0904/AudioEmbeddingQuery)
### ANN演算法
- [ANN-algo](https://wanger-sjtu.github.io/ANN-algo/)
- [HNSW YT影片1](https://www.youtube.com/watch?v=QvKMwLjdK-s&ab_channel=JamesBriggs)
- [HNSW YT影片2](https://www.youtube.com/watch?v=77QH0Y2PYKg&ab_channel=DataMListic)
- [HNSW YT影片3](https://www.youtube.com/watch?v=_pewMGesffk&ab_channel=MahamMukaram)
- [connected graph](https://web.ntnu.edu.tw/~algo/ConnectedGraph.html)
- [NSW與HNSW差異](https://chatgpt.com/share/66f55b2e-edec-8003-a001-467416822fbf)
- [KD-Tree](https://blog.yucheng.me/post/kd-tree/)
- [BM25](https://myapollo.com.tw/blog/bm25-explanation/)
- [B-Tree](https://zh.wikipedia.org/zh-tw/B树)