OpenAI Embedding – Part 3

Jika Anda ingin membuat visualisasi dari embedding pada modul sebelumnya, untuk memudahkan kita gunakan library nomic.

Untuk instalasi gunakan perintah berikut pada terminal:

$ pip install nomic

Masih didalam terminal gunakan perintah berikut untuk mendapatkan key authorization

$ nomic login

Nomic akan menampilkan link untuk mendapatkan authorization key. Gunakan key tersebut:

	
$ nomic login your_authorization key

Berikut code untuk menampilkan visual embedding

from nomic import atlas

data = movies[["Title", "Genre"]].to_dict("records")

project = atlas.map_embeddings(
    embeddings=np.array(plot_embeddings),
    data=data
)

Nomic akan menampilkan link untuk mengakses visualisasi embedding.

2023-06-11 16:29:42.015 | INFO     | nomic.project:_create_project:1100 - Creating project `alleged-cowbell` in organization `rangga.yeung`
2023-06-11 16:29:44.028 | INFO     | nomic.atlas:map_embeddings:100 - Uploading embeddings to Atlas.
2it [00:05,  2.57s/it]                       
2023-06-11 16:29:49.572 | INFO     | nomic.project:_add_data:1722 - Upload succeeded.
2023-06-11 16:29:49.595 | INFO     | nomic.atlas:map_embeddings:119 - Embedding upload succeeded.
2023-06-11 16:29:51.440 | INFO     | nomic.project:create_index:1427 - Created map `alleged-cowbell` in project `alleged-cowbell`: https://atlas.nomic.ai/map/65f8a563-b3ab-481b-9f38-69443f9bb1fe/fd43ef58-c7c3-4599-aa05-9125255f5582
2023-06-11 16:29:51.443 | INFO     | nomic.atlas:map_embeddings:132 - alleged-cowbell: https://atlas.nomic.ai/map/65f8a563-b3ab-481b-9f38-69443f9bb1fe/fd43ef58-c7c3-4599-aa05-9125255f5582

Buka link tersebut, berikut tampilan visualisasi menggunakan Nomic.

Sharing is caring: