AutoML ๋™์˜์ƒ ๋ถ„๋ฅ˜ ๋ชจ๋ธ ํ‰๊ฐ€ ๋ฐ ๋ฐ˜๋ณต

์ด ํŽ˜์ด์ง€์—์„œ๋Š” ๋ชจ๋ธ์„ ๋ฐ˜๋ณตํ•  ์ˆ˜ ์žˆ๋„๋ก AutoML ๋™์˜์ƒ ๋ถ„๋ฅ˜ ๋ชจ๋ธ์„ ํ‰๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

Vertex AI๋Š” ์ •๋ฐ€๋„์™€ ์žฌํ˜„์œจ ์ธก์ •ํ•ญ๋ชฉ๊ณผ ๊ฐ™์€ ๋ชจ๋ธ์˜ ์„ฑ๋Šฅ์„ ๊ฒฐ์ •ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋˜๋Š” ๋ชจ๋ธ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. Vertex AI๋Š” ํ…Œ์ŠคํŠธ ์„ธํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.

๋ชจ๋ธ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•

๋ชจ๋ธ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์€ ํ…Œ์ŠคํŠธ ์„ธํŠธ์—์„œ ๋ชจ๋ธ์˜ ์„ฑ๋Šฅ์„ ์ •๋Ÿ‰์ ์œผ๋กœ ์ธก์ •ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ธก์ •ํ•ญ๋ชฉ์„ ํ•ด์„ํ•˜๊ณ  ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋น„์ฆˆ๋‹ˆ์Šค ๋‹ˆ์ฆˆ์™€ ๋ชจ๋ธ์ด ํ•ด๊ฒฐํ•˜๋„๋ก ํ•™์Šตํ•œ ๋ฌธ์ œ์— ๋”ฐ๋ผ ๋‹ฌ๋ผ์ง‘๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ๊ฑฐ์ง“์Œ์„ฑ๋ณด๋‹ค ๊ฑฐ์ง“์–‘์„ฑ์˜ ํ†จ๋Ÿฌ๋ ˆ์ด์…˜(toleration)์ด ๋” ๋‚ฎ์„ ์ˆ˜๋„ ์žˆ๊ณ  ๊ทธ ๋ฐ˜๋Œ€์ผ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์œ ํ˜•์˜ ์งˆ๋ฌธ์€ ์ง‘์ค‘ํ•ด์•ผ ํ•  ์ธก์ •ํ•ญ๋ชฉ์— ์˜ํ–ฅ์„ ์ค๋‹ˆ๋‹ค.

๋ชจ๋ธ์˜ ๋ฐ˜๋ณต์„ ํ†ตํ•ด ์„ฑ๋Šฅ์„ ๊ฐœ์„ ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋ชจ๋ธ์˜ ๋ฐ˜๋ณต์„ ์ฐธ์กฐํ•˜์„ธ์š”.

Vertex AI์—์„œ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ

Vertex AI๋Š” ์ •๋ฐ€๋„, ์žฌํ˜„์œจ, ์‹ ๋ขฐ๋„ ๊ธฐ์ค€์ ๊ณผ ๊ฐ™์€ ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. Vertex AI๊ฐ€ ๋ฐ˜ํ™˜ํ•˜๋Š” ์ธก์ •ํ•ญ๋ชฉ์€ ๋ชจ๋ธ์˜ ๋ชฉํ‘œ์— ๋”ฐ๋ผ ๋‹ค๋ฆ…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด Vertex AI๋Š” ์ด๋ฏธ์ง€ ๊ฐ์ฒด ๊ฐ์ง€ ๋ชจ๋ธ๊ณผ ๋น„๊ตํ•ด์„œ ์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜ ๋ชจ๋ธ์— ๋Œ€ํ•œ ๋‹ค์–‘ํ•œ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

Cloud Storage ์œ„์น˜์—์„œ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋Š” ์Šคํ‚ค๋งˆ ํŒŒ์ผ์€ Vertex AI๊ฐ€ ๊ฐ ๋ชฉํ‘œ์— ์ œ๊ณตํ•˜๋Š” ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ ์Šคํ‚ค๋งˆ ํŒŒ์ผ์€ ๋™์˜์ƒ ๋ถ„๋ฅ˜๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ Cloud Storage ์œ„์น˜์—์„œ ์Šคํ‚ค๋งˆ ํŒŒ์ผ์„ ๋ณด๊ณ  ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
gs://google-cloud-aiplatform/schema/modelevaluation/

  • AuPRC: ํ‰๊ท  ์ •๋ฐ€๋„๋ผ๊ณ ๋„ ํ•˜๋Š” ์ •๋ฐ€๋„-์žฌํ˜„์œจ(PR) ๊ณก์„  ์•„๋ž˜์˜ ๋ฉด์ ์ž…๋‹ˆ๋‹ค. ์ด ๊ฐ’์˜ ๋ฒ”์œ„๋Š” 0๋ถ€ํ„ฐ 1๊นŒ์ง€์ด๋ฉฐ ๊ฐ’์ด ํด์ˆ˜๋ก ๋ชจ๋ธ์˜ ํ’ˆ์งˆ์ด ๋†’์Šต๋‹ˆ๋‹ค.
  • ์‹ ๋ขฐ๋„ ๊ธฐ์ค€์ : ๋ฐ˜ํ™˜ํ•  ์˜ˆ์ธก์„ ๊ฒฐ์ •ํ•˜๋Š” ์‹ ๋ขฐ๋„ ์ ์ˆ˜์ž…๋‹ˆ๋‹ค. ๋ชจ๋ธ์ด ์ด ๊ฐ’ ์ด์ƒ์ธ ์˜ˆ์ธก์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์‹ ๋ขฐ๋„ ๊ธฐ์ค€์ ์ด ๋†’์„์ˆ˜๋ก ์ •๋ฐ€๋„๋Š” ๋†’์•„์ง€์ง€๋งŒ ์žฌํ˜„์œจ์ด ๋‚ฎ์•„์ง‘๋‹ˆ๋‹ค. Vertex AI๋Š” ๋‹ค์–‘ํ•œ ๊ธฐ์ค€์ ์œผ๋กœ ์‹ ๋ขฐ๋„ ์ธก์ •ํ•ญ๋ชฉ์„ ๋ฐ˜ํ™˜ํ•˜์—ฌ ๊ธฐ์ค€์ ์ด ์ •๋ฐ€๋„์™€ ์žฌํ˜„์œจ์— ๋ฏธ์น˜๋Š” ์˜ํ–ฅ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
  • ์žฌํ˜„์œจ: ๋ชจ๋ธ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์˜ˆ์ธกํ•œ ์ด ํด๋ž˜์Šค์˜ ์˜ˆ์ธก ๋น„์œจ์ž…๋‹ˆ๋‹ค. ์ฐธ์–‘์„ฑ๋ฅ ์ด๋ผ๊ณ ๋„ ํ•ฉ๋‹ˆ๋‹ค.
  • Precision: ๋ชจ๋ธ์ด ์ƒ์„ฑํ•œ ์˜ฌ๋ฐ”๋ฅธ ๋ถ„๋ฅ˜ ์˜ˆ์ธก์˜ ๋น„์œจ์ž…๋‹ˆ๋‹ค.
  • F1 ์ ์ˆ˜: ์ •๋ฐ€๋„์™€ ์žฌํ˜„์œจ์˜ ์กฐํ™” ํ‰๊ท ์ž…๋‹ˆ๋‹ค. F1์€ ์ •๋ฐ€๋„์™€ ์žฌํ˜„์œจ ์‚ฌ์ด์˜ ๊ท ํ˜•์„ ์ฐพ๊ณ  ์žˆ๊ณ  ํด๋ž˜์Šค ๋ถ„ํฌ๊ฐ€ ๊ท ๋“ฑํ•˜์ง€ ์•Š์„ ๋•Œ ์œ ์šฉํ•œ ์ธก์ •ํ•ญ๋ชฉ์ž…๋‹ˆ๋‹ค.
  • ํ˜ผ๋™ ํ–‰๋ ฌ: ํ˜ผ๋™ ํ–‰๋ ฌ์€ ๋ชจ๋ธ์ด ๊ฒฐ๊ณผ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์˜ˆ์ธกํ•œ ๋นˆ๋„๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค. ์ž˜๋ชป ์˜ˆ์ธก๋œ ๊ฒฐ๊ณผ์˜ ๊ฒฝ์šฐ ํ–‰๋ ฌ์—๋Š” ๋ชจ๋ธ์ด ๋Œ€์‹  ์˜ˆ์ธกํ•œ ํ•ญ๋ชฉ์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. ํ˜ผ๋™ ํ–‰๋ ฌ์„ ํ†ตํ•ด ๋ชจ๋ธ์˜ ๋‘ ๊ฒฐ๊ณผ๊ฐ€ 'ํ˜ผ๋™'๋˜๋Š” ์œ„์น˜๋ฅผ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ ๊ฐ€์ ธ์˜ค๊ธฐ

๋ชจ๋ธ์˜ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ ์ง‘๊ณ„ ์ง‘ํ•ฉ๊ณผ ์ผ๋ถ€ ๋ชฉํ‘œ์˜ ๊ฒฝ์šฐ ํŠน์ • ํด๋ž˜์Šค ๋˜๋Š” ๋ผ๋ฒจ์˜ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํŠน์ • ํด๋ž˜์Šค ๋˜๋Š” ๋ผ๋ฒจ์˜ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค๋ผ๊ณ ๋„ ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ ์ฝ˜ํ…์ธ ๋Š” Google Cloud ์ฝ˜์†” ๋˜๋Š” API๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ง‘๊ณ„ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ๊ณผ ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

Google Cloud ์ฝ˜์†”

  1. Google Cloud ์ฝ˜์†”์˜ Vertex AI ์„น์…˜์—์„œ ๋ชจ๋ธ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

    ๋ชจ๋ธ ํŽ˜์ด์ง€๋กœ ์ด๋™

  2. ๋ฆฌ์ „ ๋“œ๋กญ๋‹ค์šด์—์„œ ๋ชจ๋ธ์ด ์žˆ๋Š” ๋ฆฌ์ „์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  3. ๋ชจ๋ธ ๋ชฉ๋ก์—์„œ ๋ชจ๋ธ์„ ํด๋ฆญํ•˜์—ฌ ๋ชจ๋ธ์˜ ํ‰๊ฐ€ ํƒญ์„ ์—ฝ๋‹ˆ๋‹ค.

    ํ‰๊ฐ€ ํƒญ์—์„œ ํ‰๊ท  ์ •๋ฐ€๋„ ๋ฐ ์žฌํ˜„์œจ๊ณผ ๊ฐ™์€ ๋ชจ๋ธ์˜ ์ง‘๊ณ„ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ๋ชจ๋ธ ๋ชฉํ‘œ์— ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค๊ฐ€ ์žˆ์œผ๋ฉด ์ฝ˜์†”์— ๋ผ๋ฒจ ๋ชฉ๋ก์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ ์˜ˆ์‹œ์™€ ๊ฐ™์ด ๋ผ๋ฒจ์„ ํด๋ฆญํ•˜์—ฌ ํ•ด๋‹น ๋ผ๋ฒจ์˜ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ์ฝ˜์†”์—์„œ ๋ผ๋ฒจ ์„ ํƒ

API

ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•œ API ์š”์ฒญ์€ ๊ฐ ๋ฐ์ดํ„ฐ ์œ ํ˜• ๋ฐ ๋ชฉํ‘œ๋งˆ๋‹ค ๋™์ผํ•˜์ง€๋งŒ ์ถœ๋ ฅ์€ ์„œ๋กœ ๋‹ค๋ฆ…๋‹ˆ๋‹ค. ๋‹ค์Œ ์ƒ˜ํ”Œ์€ ๋™์ผํ•œ ์š”์ฒญ์„ ํ‘œ์‹œํ•˜์ง€๋งŒ ์‘๋‹ต์€ ๋‹ค๋ฆ…๋‹ˆ๋‹ค.

์ง‘๊ณ„ ๋ชจ๋ธ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ ๊ฐ€์ ธ์˜ค๊ธฐ

์ง‘๊ณ„ ๋ชจ๋ธ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์€ ๋ชจ๋ธ ์ „์ฒด์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ํŠน์ • ์Šฌ๋ผ์ด์Šค์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ๋ชจ๋ธ ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค๋ฅผ ๋‚˜์—ดํ•ฉ๋‹ˆ๋‹ค.

์ง‘๊ณ„ ๋ชจ๋ธ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๋ณด๋ ค๋ฉด projects.locations.models.evaluations.get ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

Vertex AI๋Š” ์‹ ๋ขฐ๋„ ์ธก์ •ํ•ญ๋ชฉ์˜ ๋ฐฐ์—ด์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ ์š”์†Œ๋Š” ๋‹ค๋ฅธ confidenceThreshold ๊ฐ’(0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜์—ฌ 1๊นŒ์ง€)์˜ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ๋‹ค๋ฅธ ๊ธฐ์ค€์ ์„ ๋ณด๋ฉด ํ•ด๋‹น ๊ธฐ์ค€์ ์ด ์ •๋ฐ€๋„์™€ ์žฌํ˜„์œจ๊ณผ ๊ฐ™์€ ๋‹ค๋ฅธ ์ธก์ •ํ•ญ๋ชฉ์— ๋ฏธ์น˜๋Š” ์˜ํ–ฅ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์–ธ์–ด ๋˜๋Š” ํ™˜๊ฒฝ์— ๋Œ€ํ•œ ํƒญ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

REST

์š”์ฒญ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์ „์— ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

  • LOCATION: ๋ชจ๋ธ์ด ์ €์žฅ๋œ ๋ฆฌ์ „
  • PROJECT: ํ”„๋กœ์ ํŠธ ID
  • MODEL_ID: ๋ชจ๋ธ ๋ฆฌ์†Œ์Šค์˜ ID
  • PROJECT_NUMBER: ํ”„๋กœ์ ํŠธ์˜ ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋œ ํ”„๋กœ์ ํŠธ ๋ฒˆํ˜ธ
  • EVALUATION_ID: ๋ชจ๋ธ ํ‰๊ฐ€์˜ ID(์‘๋‹ต์— ํ‘œ์‹œ๋จ)

HTTP ๋ฉ”์„œ๋“œ ๋ฐ URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations

์š”์ฒญ์„ ๋ณด๋‚ด๋ ค๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

curl

๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations"

PowerShell

๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations" | Select-Object -Expand Content

๋‹ค์Œ๊ณผ ๋น„์Šทํ•œ JSON ์‘๋‹ต์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

Java

์ด ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ ์ „์— Vertex AI ๋น ๋ฅธ ์‹œ์ž‘: ํด๋ผ์ด์–ธํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์‚ฌ์šฉ์˜ Java ์„ค์ • ์•ˆ๋‚ด๋ฅผ ๋”ฐ๋ฅด์„ธ์š”. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Vertex AI Java API ์ฐธ๊ณ  ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

Vertex AI์— ์ธ์ฆํ•˜๋ ค๋ฉด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์˜ ์ธ์ฆ ์„ค์ •์„ ์ฐธ์กฐํ•˜์„ธ์š”.


import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationVideoClassificationSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    getModelEvaluationVideoClassification(project, modelId, evaluationId);
  }

  static void getModelEvaluationVideoClassification(
      String project, String modelId, String evaluationId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      ModelEvaluation modelEvaluation = modelServiceClient.getModelEvaluation(modelEvaluationName);

      System.out.println("Get Model Evaluation Video Classification Response");
      System.out.format("Name: %s\n", modelEvaluation.getName());
      System.out.format("Metrics Schema Uri: %s\n", modelEvaluation.getMetricsSchemaUri());
      System.out.format("Metrics: %s\n", modelEvaluation.getMetrics());
      System.out.format("Create Time: %s\n", modelEvaluation.getCreateTime());
      System.out.format("Slice Dimensions: %s\n", modelEvaluation.getSliceDimensionsList());
    }
  }
}

Node.js

์ด ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ ์ „์— Vertex AI ๋น ๋ฅธ ์‹œ์ž‘: ํด๋ผ์ด์–ธํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์‚ฌ์šฉ์˜ Node.js ์„ค์ • ์•ˆ๋‚ด๋ฅผ ๋”ฐ๋ฅด์„ธ์š”. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Vertex AI Node.js API ์ฐธ๊ณ  ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

Vertex AI์— ์ธ์ฆํ•˜๋ ค๋ฉด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์˜ ์ธ์ฆ ์„ค์ •์„ ์ฐธ์กฐํ•˜์„ธ์š”.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationVideoClassification() {
  // Configure the parent resources
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    name,
  };

  // Create get model evaluation request
  const [response] = await modelServiceClient.getModelEvaluation(request);

  console.log('Get model evaluation video classification response');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics schema uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
  console.log(`\tSlice dimensions : ${response.sliceDimensions}`);
}
getModelEvaluationVideoClassification();

Python์šฉ Vertex AI SDK

Python์šฉ Vertex AI SDK๋ฅผ ์„ค์น˜ํ•˜๊ฑฐ๋‚˜ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐฉ๋ฒ•์€ Python์šฉ Vertex AI SDK ์„ค์น˜๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Python์šฉ Vertex AI SDK API ์ฐธ์กฐ ๋ฌธ์„œ๋ฅผ ํ™•์ธํ•˜์„ธ์š”.

from google.cloud import aiplatform


def get_model_evaluation_video_classification_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.get_model_evaluation(name=name)
    print("response:", response)

๋ชจ๋“  ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค ๋‚˜์—ด

projects.locations.models.evaluations.slices.list ๋ฉ”์„œ๋“œ๋Š” ๋ชจ๋ธ์˜ ๋ชจ๋“  ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค๋ฅผ ๋‚˜์—ดํ•ฉ๋‹ˆ๋‹ค. ์ง‘๊ณ„ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ํ™•์ธํ•  ๋•Œ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋Š” ๋ชจ๋ธ์˜ ํ‰๊ฐ€ ID๊ฐ€ ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

๋ชจ๋ธ ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠน์ • ๋ผ๋ฒจ์—์„œ ๋ชจ๋ธ์˜ ์„ฑ๋Šฅ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. value ํ•„๋“œ๋Š” ์ธก์ •ํ•ญ๋ชฉ์˜ ๋ผ๋ฒจ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.

Vertex AI๋Š” ์‹ ๋ขฐ๋„ ์ธก์ •ํ•ญ๋ชฉ์˜ ๋ฐฐ์—ด์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ ์š”์†Œ๋Š” ๋‹ค๋ฅธ confidenceThreshold ๊ฐ’(0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜์—ฌ 1๊นŒ์ง€)์˜ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ๋‹ค๋ฅธ ๊ธฐ์ค€์ ์„ ๋ณด๋ฉด ํ•ด๋‹น ๊ธฐ์ค€์ ์ด ์ •๋ฐ€๋„์™€ ์žฌํ˜„์œจ๊ณผ ๊ฐ™์€ ๋‹ค๋ฅธ ์ธก์ •ํ•ญ๋ชฉ์— ๋ฏธ์น˜๋Š” ์˜ํ–ฅ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

REST

์š”์ฒญ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์ „์— ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

  • LOCATION: ๋ชจ๋ธ์ด ์žˆ๋Š” ๋ฆฌ์ „. ์˜ˆ๋ฅผ ๋“ค๋ฉด us-central1์ž…๋‹ˆ๋‹ค.
  • PROJECT: ํ”„๋กœ์ ํŠธ ID
  • MODEL_ID: ๋ชจ๋ธ์˜ ID
  • EVALUATION_ID: ๋‚˜์—ดํ•  ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค๊ฐ€ ํฌํ•จ๋œ ๋ชจ๋ธ ํ‰๊ฐ€์˜ ID

HTTP ๋ฉ”์„œ๋“œ ๋ฐ URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices

์š”์ฒญ์„ ๋ณด๋‚ด๋ ค๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

curl

๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices"

PowerShell

๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices" | Select-Object -Expand Content

๋‹ค์Œ๊ณผ ๋น„์Šทํ•œ JSON ์‘๋‹ต์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

Java

์ด ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ ์ „์— Vertex AI ๋น ๋ฅธ ์‹œ์ž‘: ํด๋ผ์ด์–ธํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์‚ฌ์šฉ์˜ Java ์„ค์ • ์•ˆ๋‚ด๋ฅผ ๋”ฐ๋ฅด์„ธ์š”. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Vertex AI Java API ์ฐธ๊ณ  ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

Vertex AI์— ์ธ์ฆํ•˜๋ ค๋ฉด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์˜ ์ธ์ฆ ์„ค์ •์„ ์ฐธ์กฐํ•˜์„ธ์š”.


import com.google.cloud.aiplatform.v1.ModelEvaluationName;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class ListModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    listModelEvaluationSliceSample(project, modelId, evaluationId);
  }

  static void listModelEvaluationSliceSample(String project, String modelId, String evaluationId)
      throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationName modelEvaluationName =
          ModelEvaluationName.of(project, location, modelId, evaluationId);

      for (ModelEvaluationSlice modelEvaluationSlice :
          modelServiceClient.listModelEvaluationSlices(modelEvaluationName).iterateAll()) {
        System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
        System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
        System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
        System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

        Slice slice = modelEvaluationSlice.getSlice();
        System.out.format("Slice Dimensions: %s\n", slice.getDimension());
        System.out.format("Slice Value: %s\n\n", slice.getValue());
      }
    }
  }
}

Node.js

์ด ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ ์ „์— Vertex AI ๋น ๋ฅธ ์‹œ์ž‘: ํด๋ผ์ด์–ธํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์‚ฌ์šฉ์˜ Node.js ์„ค์ • ์•ˆ๋‚ด๋ฅผ ๋”ฐ๋ฅด์„ธ์š”. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Vertex AI Node.js API ์ฐธ๊ณ  ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

Vertex AI์— ์ธ์ฆํ•˜๋ ค๋ฉด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์˜ ์ธ์ฆ ์„ค์ •์„ ์ฐธ์กฐํ•˜์„ธ์š”.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service Client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};

// Instantiates a client
const modelServiceClient = new ModelServiceClient(clientOptions);

async function listModelEvaluationSlices() {
  // Configure the parent resources
  const parent = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}`;
  const request = {
    parent,
  };

  // Get and print out a list of all the evaluation slices for this resource
  const [response] =
    await modelServiceClient.listModelEvaluationSlices(request);
  console.log('List model evaluation response', response);
  console.log(response);
}
listModelEvaluationSlices();

Python์šฉ Vertex AI SDK

Python์šฉ Vertex AI SDK๋ฅผ ์„ค์น˜ํ•˜๊ฑฐ๋‚˜ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐฉ๋ฒ•์€ Python์šฉ Vertex AI SDK ์„ค์น˜๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Python์šฉ Vertex AI SDK API ์ฐธ์กฐ ๋ฌธ์„œ๋ฅผ ํ™•์ธํ•˜์„ธ์š”.

from google.cloud import aiplatform


def list_model_evaluation_slices_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    parent = client.model_evaluation_path(
        project=project, location=location, model=model_id, evaluation=evaluation_id
    )
    response = client.list_model_evaluation_slices(parent=parent)
    for model_evaluation_slice in response:
        print("model_evaluation_slice:", model_evaluation_slice)

๋‹จ์ผ ์Šฌ๋ผ์ด์Šค์˜ ์ธก์ •ํ•ญ๋ชฉ ๊ฐ€์ ธ์˜ค๊ธฐ

๋‹จ์ผ ์Šฌ๋ผ์ด์Šค์˜ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๋ณด๋ ค๋ฉด projects.locations.models.evaluations.slices.get ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ์Šฌ๋ผ์ด์Šค๋ฅผ ๋‚˜์—ดํ•  ๋•Œ ์ œ๊ณต๋˜๋Š” ์Šฌ๋ผ์ด์Šค ID๊ฐ€ ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ ์ƒ˜ํ”Œ์€ ๋ชจ๋“  ๋ฐ์ดํ„ฐ ์œ ํ˜• ๋ฐ ๋ชฉํ‘œ์— ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

REST

์š”์ฒญ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์ „์— ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

  • LOCATION: ๋ชจ๋ธ์ด ์žˆ๋Š” ๋ฆฌ์ „. ์˜ˆ๋ฅผ ๋“ค๋ฉด us-central1์ž…๋‹ˆ๋‹ค.
  • PROJECT: ํ”„๋กœ์ ํŠธ ID
  • MODEL_ID: ๋ชจ๋ธ์˜ ID
  • EVALUATION_ID: ๊ฒ€์ƒ‰ํ•  ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค๊ฐ€ ํฌํ•จ๋œ ๋ชจ๋ธ ํ‰๊ฐ€์˜ ID
  • SLICE_ID: ๊ฐ€์ ธ์˜ฌ ํ‰๊ฐ€ ์Šฌ๋ผ์ด์Šค์˜ ID
  • PROJECT_NUMBER: ํ”„๋กœ์ ํŠธ์˜ ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋œ ํ”„๋กœ์ ํŠธ ๋ฒˆํ˜ธ
  • EVALUATION_METRIC_SCHEMA_FILE_NAME: classification_metrics_1.0.0๊ณผ ๊ฐ™์ด ๋ฐ˜ํ™˜ํ•  ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ์ •์˜ํ•˜๋Š” ์Šคํ‚ค๋งˆ ํŒŒ์ผ์˜ ์ด๋ฆ„

HTTP ๋ฉ”์„œ๋“œ ๋ฐ URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices/SLICE_ID

์š”์ฒญ์„ ๋ณด๋‚ด๋ ค๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

curl

๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices/SLICE_ID"

PowerShell

๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/models/MODEL_ID/evaluations/EVALUATION_ID/slices/SLICE_ID" | Select-Object -Expand Content

๋‹ค์Œ๊ณผ ๋น„์Šทํ•œ JSON ์‘๋‹ต์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

Java

์ด ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ ์ „์— Vertex AI ๋น ๋ฅธ ์‹œ์ž‘: ํด๋ผ์ด์–ธํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์‚ฌ์šฉ์˜ Java ์„ค์ • ์•ˆ๋‚ด๋ฅผ ๋”ฐ๋ฅด์„ธ์š”. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Vertex AI Java API ์ฐธ๊ณ  ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

Vertex AI์— ์ธ์ฆํ•˜๋ ค๋ฉด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์˜ ์ธ์ฆ ์„ค์ •์„ ์ฐธ์กฐํ•˜์„ธ์š”.


import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice;
import com.google.cloud.aiplatform.v1.ModelEvaluationSliceName;
import com.google.cloud.aiplatform.v1.ModelServiceClient;
import com.google.cloud.aiplatform.v1.ModelServiceSettings;
import java.io.IOException;

public class GetModelEvaluationSliceSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // To obtain evaluationId run the code block below after setting modelServiceSettings.
    //
    // try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings))
    // {
    //   String location = "us-central1";
    //   ModelName modelFullId = ModelName.of(project, location, modelId);
    //   ListModelEvaluationsRequest modelEvaluationsrequest =
    //   ListModelEvaluationsRequest.newBuilder().setParent(modelFullId.toString()).build();
    //   for (ModelEvaluation modelEvaluation :
    //     modelServiceClient.listModelEvaluations(modelEvaluationsrequest).iterateAll()) {
    //       System.out.format("Model Evaluation Name: %s%n", modelEvaluation.getName());
    //   }
    // }
    String project = "YOUR_PROJECT_ID";
    String modelId = "YOUR_MODEL_ID";
    String evaluationId = "YOUR_EVALUATION_ID";
    String sliceId = "YOUR_SLICE_ID";
    getModelEvaluationSliceSample(project, modelId, evaluationId, sliceId);
  }

  static void getModelEvaluationSliceSample(
      String project, String modelId, String evaluationId, String sliceId) throws IOException {
    ModelServiceSettings modelServiceSettings =
        ModelServiceSettings.newBuilder()
            .setEndpoint("us-central1-aiplatform.googleapis.com:443")
            .build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings)) {
      String location = "us-central1";
      ModelEvaluationSliceName modelEvaluationSliceName =
          ModelEvaluationSliceName.of(project, location, modelId, evaluationId, sliceId);

      ModelEvaluationSlice modelEvaluationSlice =
          modelServiceClient.getModelEvaluationSlice(modelEvaluationSliceName);

      System.out.println("Get Model Evaluation Slice Response");
      System.out.format("Model Evaluation Slice Name: %s\n", modelEvaluationSlice.getName());
      System.out.format("Metrics Schema Uri: %s\n", modelEvaluationSlice.getMetricsSchemaUri());
      System.out.format("Metrics: %s\n", modelEvaluationSlice.getMetrics());
      System.out.format("Create Time: %s\n", modelEvaluationSlice.getCreateTime());

      Slice slice = modelEvaluationSlice.getSlice();
      System.out.format("Slice Dimensions: %s\n", slice.getDimension());
      System.out.format("Slice Value: %s\n", slice.getValue());
    }
  }
}

Node.js

์ด ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ ์ „์— Vertex AI ๋น ๋ฅธ ์‹œ์ž‘: ํด๋ผ์ด์–ธํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์‚ฌ์šฉ์˜ Node.js ์„ค์ • ์•ˆ๋‚ด๋ฅผ ๋”ฐ๋ฅด์„ธ์š”. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Vertex AI Node.js API ์ฐธ๊ณ  ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

Vertex AI์— ์ธ์ฆํ•˜๋ ค๋ฉด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์˜ ์ธ์ฆ ์„ค์ •์„ ์ฐธ์กฐํ•˜์„ธ์š”.

/**
 * TODO(developer): Uncomment these variables before running the sample
 * (not necessary if passing values as arguments). To obtain evaluationId,
 * instantiate the client and run the following the commands.
 */
// const parentName = `projects/${project}/locations/${location}/models/${modelId}`;
// const evalRequest = {
//   parent: parentName
// };
// const [evalResponse] = await modelServiceClient.listModelEvaluations(evalRequest);
// console.log(evalResponse);

// const modelId = 'YOUR_MODEL_ID';
// const evaluationId = 'YOUR_EVALUATION_ID';
// const sliceId = 'YOUR_SLICE_ID';
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';

// Imports the Google Cloud Model Service client library
const {ModelServiceClient} = require('@google-cloud/aiplatform');
// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: 'us-central1-aiplatform.googleapis.com',
};
// Specifies the location of the api endpoint
const modelServiceClient = new ModelServiceClient(clientOptions);

async function getModelEvaluationSlice() {
  // Configure the parent resource
  const name = `projects/${project}/locations/${location}/models/${modelId}/evaluations/${evaluationId}/slices/${sliceId}`;
  const request = {
    name,
  };

  // Get and print out a list of all the endpoints for this resource
  const [response] =
    await modelServiceClient.getModelEvaluationSlice(request);

  console.log('Get model evaluation slice');
  console.log(`\tName : ${response.name}`);
  console.log(`\tMetrics_Schema_Uri : ${response.metricsSchemaUri}`);
  console.log(`\tMetrics : ${JSON.stringify(response.metrics)}`);
  console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);

  console.log('Slice');
  const slice = response.slice;
  console.log(`\tDimension :${slice.dimension}`);
  console.log(`\tValue :${slice.value}`);
}
getModelEvaluationSlice();

Python์šฉ Vertex AI SDK

Python์šฉ Vertex AI SDK๋ฅผ ์„ค์น˜ํ•˜๊ฑฐ๋‚˜ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐฉ๋ฒ•์€ Python์šฉ Vertex AI SDK ์„ค์น˜๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Python์šฉ Vertex AI SDK API ์ฐธ์กฐ ๋ฌธ์„œ๋ฅผ ํ™•์ธํ•˜์„ธ์š”.

from google.cloud import aiplatform


def get_model_evaluation_slice_sample(
    project: str,
    model_id: str,
    evaluation_id: str,
    slice_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
    """
    To obtain evaluation_id run the following commands where LOCATION
    is the region where the model is stored, PROJECT is the project ID,
    and MODEL_ID is the ID of your model.

    model_client = aiplatform.gapic.ModelServiceClient(
        client_options={
            'api_endpoint':'LOCATION-aiplatform.googleapis.com'
            }
        )
    evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID')
    print("evaluations:", evaluations)
    """
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
    name = client.model_evaluation_slice_path(
        project=project,
        location=location,
        model=model_id,
        evaluation=evaluation_id,
        slice=slice_id,
    )
    response = client.get_model_evaluation_slice(name=name)
    print("response:", response)

๋ชจ๋ธ ๋ฐ˜๋ณต ํ•™์Šต

๋ชจ๋ธ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์€ ๋ชจ๋ธ์ด ๊ธฐ๋Œ€์— ๋ฏธ์น˜์ง€ ๋ชปํ•˜๋Š” ๊ฒฝ์šฐ ๋ชจ๋ธ์„ ๋””๋ฒ„๊น…ํ•˜๊ธฐ ์œ„ํ•œ ์‹œ์ž‘์ ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ์ •๋ฐ€๋„/์žฌํ˜„์œจ ์ ์ˆ˜๊ฐ€ ๋‚ฎ๋‹ค๋ฉด ๋ชจ๋ธ์— ํ•™์Šต ๋ฐ์ดํ„ฐ๊ฐ€ ๋” ๋งŽ์ด ํ•„์š”ํ•˜๊ฑฐ๋‚˜ ๋ผ๋ฒจ์ด ์ผ๊ด€๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ •๋ฐ€๋„์™€ ์žฌํ˜„์œจ์ด ์™„๋ฒฝํ•˜๋‹ค๋ฉด ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ๊ฐ€ ๋„ˆ๋ฌด ์‰ฌ์›Œ์„œ ์˜ˆ์ธกํ•  ์ˆ˜ ์—†๊ณ  ์ผ๋ฐ˜ํ™”๊ฐ€ ์ž˜ ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ•™์Šต ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ˜๋ณตํ•˜๊ณ  ์ƒˆ ๋ชจ๋ธ์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ƒˆ ๋ชจ๋ธ์„ ๋งŒ๋“  ํ›„์—๋Š” ๊ธฐ์กด ๋ชจ๋ธ๊ณผ ์ƒˆ ๋ชจ๋ธ ๊ฐ„์— ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์„ ๋น„๊ตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ ๊ถŒ์žฅ์‚ฌํ•ญ์€ ๋ถ„๋ฅ˜ ๋˜๋Š” ๊ฐ์ง€ ๋ชจ๋ธ๊ณผ ๊ฐ™์€ ํ•ญ๋ชฉ์— ๋ผ๋ฒจ์„ ์ง€์ •ํ•˜๋Š” ๋ชจ๋ธ์„ ๊ฐœ์„ ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.

  • ํ•™์Šต ๋ฐ์ดํ„ฐ์— ์˜ˆ์‹œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ๋”์šฑ ๊ด‘๋ฒ”์œ„ํ•œ ์˜ˆ์‹œ๋ฅผ ์ถ”๊ฐ€ํ•ด ๋ณด์„ธ์š”. ์ž์„ธํ•œ ์•ˆ๋‚ด๋Š” ๋ฐ์ดํ„ฐ ์ค€๋น„๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.
  • ์˜ˆ์‹œ๊ฐ€ ๋งŽ์ง€ ์•Š์€ ํด๋ž˜์Šค๋‚˜ ๋ผ๋ฒจ์€ ์‚ญ์ œํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ์˜ˆ์‹œ๊ฐ€ ์ถฉ๋ถ„ํ•˜์ง€ ์•Š์œผ๋ฉด ๋ชจ๋ธ์ด ์ด๋Ÿฌํ•œ ํด๋ž˜์Šค ๋˜๋Š” ๋ผ๋ฒจ์— ๋Œ€ํ•ด ์ผ๊ด€๋˜๊ณ  ํ™•์‹คํ•˜๊ฒŒ ์˜ˆ์ธกํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
  • ๋จธ์‹ ์€ ํด๋ž˜์Šค ๋˜๋Š” ๋ผ๋ฒจ์˜ ์ด๋ฆ„์„ ํ•ด์„ํ•  ์ˆ˜ ์—†์œผ๋ฉฐ ์˜ˆ๋ฅผ ๋“ค์–ด 'door' ๋ฐ 'door_with_knob' ์‚ฌ์ด์˜ ๋ฏธ๋ฌ˜ํ•œ ์ฐจ์ด๋ฅผ ์ดํ•ดํ•˜์ง€ ๋ชปํ•ฉ๋‹ˆ๋‹ค. ๋จธ์‹ ์ด ์ด๋Ÿฌํ•œ ๋ฏธ๋ฌ˜ํ•œ ์ฐจ์ด๋ฅผ ์ธ์‹ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ฐ์ดํ„ฐ๋ฅผ ์ œ๊ณตํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • ์ฐธ์–‘์„ฑ, ์ฐธ์Œ์„ฑ์˜ ์˜ˆ์‹œ๋ฅผ ๋” ๋งŽ์ด ์ถ”๊ฐ€ํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๊ฐ•ํ•ฉ๋‹ˆ๋‹ค. ํŠนํžˆ ๋ชจ๋ธ ํ˜ผ๋™ ์™„ํ™”๋ฅผ ์œ„ํ•ด ๊ฒฐ์ • ๊ฒฝ๊ณ„์— ๊ฐ€๊นŒ์šด ์˜ˆ์‹œ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
  • ์ž์ฒด ๋ฐ์ดํ„ฐ ๋ถ„ํ• (ํ•™์Šต, ๊ฒ€์ฆ, ํ…Œ์ŠคํŠธ)์„ ์ง€์ •ํ•˜์„ธ์š”. Vertex AI๋Š” ํ•ญ๋ชฉ์„ ๊ฐ ์„ธํŠธ์— ๋ฌด์ž‘์œ„๋กœ ํ• ๋‹นํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ํ•™์Šต ๋ฐ ๊ฒ€์ฆ ์„ธํŠธ์— ๊ฑฐ์˜ ๋น„์Šทํ•œ ํ•ญ๋ชฉ์„ ํ• ๋‹นํ•˜๊ฒŒ ๋˜๋ฉด ๊ณผ์ ํ•ฉ์ด ๋ฐœ์ƒํ•˜์—ฌ ํ…Œ์ŠคํŠธ ์„ธํŠธ์˜ ์„ฑ๋Šฅ์ด ์ €ํ•˜๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ž์ฒด ๋ฐ์ดํ„ฐ ๋ถ„ํ• ์„ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ AutoML ๋ชจ๋ธ์˜ ๋ฐ์ดํ„ฐ ๋ถ„ํ•  ์ •๋ณด๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.
  • ๋ชจ๋ธ์˜ ํ‰๊ฐ€ ์ธก์ •ํ•ญ๋ชฉ์— ํ˜ผ๋™ ํ–‰๋ ฌ์ด ํฌํ•จ๋œ ๊ฒฝ์šฐ ๋ชจ๋ธ์ด ๋‘ ๋ผ๋ฒจ์„ ํ˜ผ๋™ํ•˜๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ ๋ชจ๋ธ์ด ์‹ค์ œ ๋ผ๋ฒจ๋ณด๋‹ค ํŠน์ • ๋ผ๋ฒจ์„ ํ›จ์”ฌ ๋” ๋งŽ์ด ์˜ˆ์ธกํ•ฉ๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ๋ฅผ ๊ฒ€ํ† ํ•˜๊ณ  ์˜ˆ์‹œ์—์„œ ๋ผ๋ฒจ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ง€์ •๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
  • ํ•™์Šต ์‹œ๊ฐ„์ด ์งง์•˜๋‹ค๋ฉด(๋‚ฎ์€ ์ตœ๋Œ€ ๋…ธ๋“œ ์‹œ๊ฐ„ ์ˆ˜) ๋” ๊ธด ์‹œ๊ฐ„(๋†’์€ ์ตœ๋Œ€ ๋…ธ๋“œ ์‹œ๊ฐ„ ์ˆ˜) ๋™์•ˆ ํ•™์Šตํ•˜๋„๋ก ํ—ˆ์šฉํ•˜์—ฌ ๊ณ ํ’ˆ์งˆ ๋ชจ๋ธ์„ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.