TensorFlow로 간단한 linear regression을 구현¶ (1) Build graph using TensorFlow operations¶ (2) feed data and run graph (operation) :¶ sess.run(op, feed_dict={x:x_data})¶ (3) update variables in the graph (and return values)¶ In [30]: from PIL import Image Image.open('mechanics.png') Out[30]: (1) Build graph using TensorFlow operations¶ H(x) = Wx + b¶ In [1]: import tensorflow as tf In [4]: # X and Y da..
In [11]: from PIL import Image Image.open('1번.png') Out[11]: TensorFlow Hello World¶ In [2]: import tensorflow as tf In [3]: tf.__version__ Out[3]: '1.13.1' In [4]: # Create a constant op # This op is added as a node to the defalt graph hello = tf.constant('Hello, TensorFlow!') # seart a TF session sess = tf.Session() # run the op and get result print(sess.run(hello)) b'Hello, TensorFlow!' 어떤 그래..
클래스란?¶ 객체지향은 프로그래밍의 꽃이다. 클래스는 객체지향을 구현함에 있어 중요한 부분이다. 클래스는 비슷한 속성을 가진 객체를 묶는 큰 틀이라고 생각하면 된다. 클래스 변수¶ In [1]: class Customer: welcome = '반갑습니다' 클래스 Customer는 '반갑습니다'라는 값을 가진 welcome 라는 변수를 가지고 있다. 이를 호출하려고 하면 해당 클래스의 인스턴트를 통해서만 가능하다. In [2]: Customer.welcome Out[2]: '반갑습니다' 클래스 함수¶ In [5]: class Customer: def info(self, id): print("id : %d" % id) new_Customer = Customer() new_Cust..
In [1]: import pandas as pd df=pd.read_csv('finally_beer_1.csv') df Out[1]: user beer_name brewery beer_style score date 월 일 년 0 2 Worthington's White Shield Molson Coors UK (Molson Coors) Premium Bitter/ESB 4.4 2000-04-16 4 16 2000 1 2 Rogue Dry Hopped St. Rogue Red Ale Rogue Ales Amber Ale 4.3 2000-04-23 4 23 2000 2 2 Maclay Oat Malt Stout Clockwork (Maclay) Stout 2.4 2000-04-28 4 28 2..
In [1]: import pandas as pd import numpy as np In [2]: df=pd.read_csv('finally_beer.csv',encoding='utf-8-sig', names=['user', 'beer_name', 'brewery','beer_style','score','date']) df.head() Out[2]: user beer_name brewery beer_style score date 0 3355 King Two Fisted Old Ale King Brewing Company Old Ale 1.2 4/26/2006 1 3355 Flying Dog ..
지난번에 했던 캐글 타이타닉 데이터 분석 - 1 https://jfun.tistory.com/136 에 이어 블로깅하려고 한다. 타이타닉 데이터를 다시 불러오자 In [2]: import pandas as pd train = pd.read_csv('titanic/train.csv') test = pd.read_csv('titanic/test.csv') 오늘 하려는 주제는 지난번 데이터를 feature engineering 하는 것인데 이 과정은 상당히 중요하다. 이 부분을 제대로 하지 못하면 어떤 classifier를 사용하더라도 좋은 예측을 할 수 없다. 4. Feature engineering¶ Feature Engineering은 데이터에 대한 도메인 지식을 사용하여 기..
타이타닉 데이터에 대해서 분석을 해보고자 한다. 이 데이터는 데이터 사이언스나 머신러닝을 공부한 사람들은 많이 들어봤을만한 데이터분석 경연 사이트인 캐글(Kaggle)에서 입문자용으로 가장 많이 사용하는 예제이다. 가장 많이 사용되는 데이터이므로 다양한 사람들이 다양한 방법으로 다양한 관점에서 데이터를 분석 하고 있기 때문에 이 데이터를 가지고 공부를 해보면 데이터 분석의 전반적인 과정을 습득하는데 도움이 되겠다 싶어 다뤄본다. 데이터는 kaggle사이트에 들어가면 얻을 수 있다. https://www.kaggle.com/ 캐글 타이타닉 데이터 분석 - 1부터 3까지 3단계에 걸쳐 다룰것이다. 먼저 캐글 타이타닉 데이터 분석 - 1에서는 데이터를 불러오고 탐색적 자료 분석(EDA)을 적용해 시각화까지 해..