colab_101

๊ตฌ๊ธ€ ํด๋ผ์šฐ๋“œ ์ฃผํ”ผํ„ฐ ๋…ธํŠธ๋ถ with free GPU

What is Colab ?

  • Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud

  • Free GPU support

  • Github Friendly

  • Easy Collaboration

How to upload files ?

๋‚ด๊ฐ€ ํƒํ•œ flow ๋Š”

  1. ๋ชจ๋“  ์ฅฌํ”ผํ„ฐํŒŒ์ผ๊ณผ data ๋Š” Github ์— ์ €์žฅ

  2. ์ฅฌํ”ผํ„ฐํŒŒ์ผ์„ ์ฝ”๋ ™์œผ๋กœ ๋ถˆ๋Ÿฌ์˜ด

    ๊นƒํ—™์—์„œ ์ฅฌํ”ผํ„ฐํŒŒ์ผ ์—ด๊ณ  path ๋ณต์‚ฌ: https://**github.com/**pyohamen/data-analysis/blob/master/chapter5/01-used-phone-price-prediction.ipynb

    ์ˆ˜์ •: https://**colab.research.google.com/github/**pyohamen/data-analysis/blob/master/chapter5/01-used-phone-price-prediction.ipynb

    [ํŒŒ์ผ] - [๋…ธํŠธ์—ด๊ธฐ] - [GitHub tab] ์— github ์—์„œ ๋ถˆ๋Ÿฌ์˜ค๊ณ ์ž ํ•˜๋Š” ์ฅฌํ”ผํ„ฐ ํŒŒ์ผ์„ ์—ฐ ํ›„ ํ•ด๋‹น์˜ ๊ฒฝ๋กœ ๋ฅผ ๊ฒ€์ƒ‰

  3. ์ฅฌํ”ผํ„ฐํŒŒ์ผ ํ…์ŠคํŠธ๋ธ”๋Ÿญ์— Open in Colab ๋ฒ„ํŠผ ์ƒ์„ฑ

    ์•„๋ž˜ ๋ณต์‚ฌ

    [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](์ˆ˜์ •์ฃผ์†Œ)

    ๊นƒํ—™์— ์ €์žฅํ•  ๋•Œ Open in Colab ๋งŒ๋“ค์–ด์คŒ

  4. ์ €์žฅ

    • colab ์—์„œ ์ž‘์—… ํ›„: [ํŒŒ์ผ] - [Github ์— ์‚ฌ๋ณธ์ €์žฅ]

      ์ €์žฅ ์‹œ Colaboratory ๋งํฌ ์ถ”์ž ์ฒดํฌ

    • ๋กœ์ปฌ ์ฅฌํ”ผํ„ฐ์—์„œ ์ž‘์—… ํ›„: git push

      colab ์—์„œ github ์œผ๋กœ ์ €์žฅํ•ด์คฌ์œผ๋‹ˆ, ๋กœ์ปฌ ์ž‘์—… ์ „ git pull ๊ผญ!

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด Github ์—์„œ๋‚˜, ๋กœ์ปฌ์˜ ์ฅฌํ”ผํ„ฐ์—์„œ๋‚˜ ์ฅฌํ”ผํ„ฐํŒŒ์ผ์„ colab ์—์„œ ์—ด์–ด๋ณผ ์ˆ˜ ์žˆ๋‹ค.

์ด๋Ÿฐ flow ๋ฅผ ์„ ํƒํ•œ ์ด์œ ๋Š” ๋ญ.. Drive ๋Š” ์šฉ๋Ÿ‰์ด ์ž‘์œผ๋‹ˆ๊นŒ..

๋˜ ๋จธ์‹ ๋Ÿฌ๋‹ ์ฅฌํ”ผํ„ฐ ๋…ธํŠธ๋ถ์€ github ์—์„œ ๋ณด๊ด€ํ•˜๊ณ  ์‹ถ๋‹ค !

  • ๋‹จ์ 

    • Github ์—์„œ ๋ถˆ๋Ÿฌ์™€์„œ ์ž‘์—…ํ•˜๋Š”๊ฑฐ๋ผ Autosave ๊ฐ€ ์•ˆ ๋œ๋‹ค ๐Ÿฅฒ ์žŠ์ง€ ๋ง๊ณ  [Github ์— ์‚ฌ๋ณธ์ €์žฅ] ํ•ด์ค˜์•ผ ํ•จ

How to read data ?

From Github (file < 25MB)

Github ์ €์žฅ์†Œ์—์„œ data ํŒŒ์ผ์„ ํด๋ฆญํ•œ ํ›„, Raw ๋ฅผ ํด๋ฆญ, ๋งํฌ๋ฅผ ๋ณต์‚ฌ

url = '๋ณต์‚ฌํ•œ raw_data_Github ๋งํฌ'
df = pd.read_csv(url)

From local

from google.colab import files
uploaded = files.upload()

์œ„ ๋ช…๋ น์„ ์น˜๋ฉด ํŒŒ์ผ์„ ์—…๋กœ๋“œํ•˜๋Š” ํ”„๋กฌํ”„ํŠธ๊ฐ€ ๋œฌ๋‹ค.

import io
df = pd.read_csv(io.BytesIO(uploaded['filename.csv']))

Last updated