Notice
Recent Posts
Recent Comments
Today
Total
04-28 10:01
Archives
관리 메뉴

Jeongchul Kim

Machine Learning with the tools IPython Notebook Usage 본문

MachineLearning

Machine Learning with the tools IPython Notebook Usage

김 정출 2017. 2. 4. 23:29


Machine Learning with the tools IPython Notebook Usage


출처 : Coursera / Emily Fox & Carlos Guestrin / Machine Learning Specialization / University of Washington



Machine Learning Introduction

Machine Learning with the tools IPython Notebook & GraphLab
Create

Machine Learning with the tools IPython Notebook & GraphLab Create on AWS



IPython Notebook 사용법에 대해서 알아봅시다.


New 버튼에서 Folder를 클릭합니다.


Untitled Folder의 체크박스를 클릭합니다. 상단부에 Rename 버튼을 클릭하여 이름을 변경합니다.


WorkSpace로 변경하고 Coursera 폴더를 생성합니다.


다음의 파일을 다운받습니다.


Getting started with iPython Notebook.ipynb

Getting Started with SFrames.ipynb

people-example.csv


업로드 버튼을 클릭합니다.


열기를 하고 Upload 버튼을 클릭합니다.


열어 보시기 바랍니다

New 버튼을 클릭하고 Python 2를 선택합니다.


새로운 Notebook 이 생성됩니다.

이름을 변경합니다. notebook-usage


메뉴에서 Cell 버튼을 클릭하고 Cell Type에서 Markdown을 선택합니다.


Markdown 문법을 사용할 수 있습니다.

https://daringfireball.net/projects/markdown/syntax


# Getting Started with Python

* Create Variable

* Advanced python variable types

* Advanced printing

* Conditional statements in python

* Loop - for, while

* function

* lamda


입력을 마치고 shift+Enter 하면 Cell을 마칩니다.


Markdown

## Create Variable


Cell

print ‘Hello World!’


Cell

i = 1 # int
print type(i)

f = 0.9 # float
print type(f)

b = True # Boolean
print type(b)

s = "KimJeongchul" # str
print type(s)


Markdown

## Advanced python types


Cell

l = [0,1,2,3]
print l



Cell

d = {'name':'KimJeongChul','age':27, 'height':183.5}
print d

print d[‘age’]


Markdown

##Advanced printing


Cell

print "My name is %s and age is %s." % (d['name'],d['age'])


Markdown

## Conditional statements in python


Cell

if "JeongChul" in d['name']:

   print "Id is Correct"


if d['age'] > 19:

   print "Your is Adult"

else:

   print "Sorry"


Markdown

## Conditional loops


Cell

for element in d:

   print element+" : "+str(d[element])


Cell

counter = 1

while counter < 5:

   print counter

   counter += 1


Markdown

## Function


Cell

def add(x, y):

   return x+y

num1 = 1

num2 = 2

print str(add(num1,num2))


Markdown

## Lambda


Cell

square = lambda x : x*x

square(3)





Comments