태그

2015년 3월 23일 월요일

Python for Data Scientist

http://www.datacommunitydc.org/blog/2013/04/son-of-getting-started-with-python-for-data-scientists

http://www.datacommunitydc.org/blog/2013/03/getting-started-with-python-for-data-scientists

2015년 3월 11일 수요일

Python 을 시작 하면서..

어떻게 Python을 시작할까 고민하다가, 책을 사서 보는 건 경험상 큰 도움이 되지 않기에, Python 개념 및 사상을 배우기 위해 인터넷을 이리저리 뒤졌다.

실은 위키피데아 내용 만 보더라도, 어느 정도 파악 하는 데는 무리가 없었다.
http://en.wikipedia.org/wiki/Python_(programming_language)

코딩의 시작은 일단 웹 사이트를 통해 시작했다.
http://www.codecademy.com/

세상 참 좋아진 듯.. 내가 경력이 그리 긴건 아니지만, 2000년 초반에 Java를 배우기 위해서는 책보고 관심 있는 사람끼리 모여서 스터디 한 것 밖에 없었던 듯.. 요즘은 코딩 배우는 싸이트도 많고, 코세라나 edx 같이 세계의 유명한 교수들의 강의를 무료로 들을 수 도 있고, 크라우드 펀딩을 통해서 개발 하면서 경쟁 할 수 도 있고.. 소스가 너무나도 많다.

Python 기초 과정을 한 40% 진행하며서 느낀 점은..

일단 쉽다. 다들 이 점을 강조 하는데, 실제로 구현 해 보니 증말 쉽다.

어떤 언어든 개발 경험이 있다면, 코딩 문법을 익히는 데 몇 일 안 걸릴 듯..
개발자가 아니더라도 어렵지 않게 배울 수 있을 듯..

세미콜론이 없는 게 얼마나 편한지,
함수 정의문이나 if-else 문을 감싸는 중괄호(())가 없는 게 얼마나 편한지,
단순히 띄워쓰기를 지킴으로써 얻을 수 있는 가독성, 생산성은 가히 놀라울 듯 하다.

변수 정의 시 미리 타입, 크기 등을 정할 필요가 없어 개발시 편하지만, 디버깅은 어려울듯..

Node.js의 JavaScript와 너무나도 비슷하다. 비동기식 이벤트 기반 코딩이 가능 한 1급 함수라는 부분도 똑같다.

상속관련해서는 JavaScript는 prototype 객체를 통해 상속 및 오버라이트는 가능하나, 클래스를 정의하여 상속 받는 개념은 없는데, Python은 완전한 클래스 생성이 가능하고 다중상속등이 가능해 보인다.

기초과정 완료 되면, 더 추가 하겠다.

To be continued..

>_

내가 Python을 시작하게 된 이유

그 동안 SI회사에서 다양한 필드의 엔터프라이즈급 시스템 개발을 하다가, 중공업 회사의 SW개발팀으로 옮긴 뒤, 우여곡절이 많았다.

일단, 내가 가지고 있던 'IT(Information Technology)' 기술은 중공업 분야의 플랜트 산업에 적용되고 있는 'OT(Operational Technology)' 기술과는 거리가 멀었다.

기존에는 복잡한 알고리즘 보다는 얼마나 단순하게 비즈니스 요구사항을 충족시키는 아키텍처를 설계/구현을 하고, 성능이슈 등은 불특정 다수의 사용자의 트래픽을 어떻게 하면 분산시키면서 빠르고 안정적이고 신뢰성 높은 시스템을 만들 수 있을 까를 고민하였다.

하지만 플랜트 쪽은 예전에 내가 다루던 아키텍처보다 훨씬 단순했고, 현재 최신 기술 트랜드에는 훨씬 미치지 못 하고 있었으나, 주기적으로 발생하는 플랜트의 운전 데이터를 통해 과거 데이터 학습을 통해 앞으로의 일을 예측하고, 예상하지 않았던 장애를 미리 방지 하여 플랜트의 수명을 연장 시키는 것에 초점이 맞추어져 있다. 이렇다 보니, 예전에는 잘 다루지 않았던 인공지능, 머신러닝과 관계가 깊은 알고리즘 등에 대해 깊이 이해를 할 필요가 있다. 이러한 알고리즘 등은 요즘 흔히 얘기 하는 빅 데이터 분석에서도 쉽게 사용되어지는 기술이기도 하다. (실은 BI, 인공지능, 머신러닝, 데이터 마이닝 등은 서로 관계가 있으면서도 다른 영역이다.)

헌데, 이런 알고리즘에 대해 이해를 하려면 기존에 하지 않았던 선형 대수학, 통계학 등의 쉽지 않은 지식들을 선행 학습을 반드시 해야 한다. 물론, 예전에 한번쯤은 접해봤던 것들이고, 공부를 하는 거에 대해서 큰 거부감은 없으나, 과거에 내가 해오던 일과의 괴리 때문에 잘 하던 걸 더 발전 시킬 수 없는 건 가 하는 생각도 들고, 이 일을 정말 잘 할 수 있을 까 의문점이 들게 되었다.

이런 와중에 산 호세에서 Strata+Hadoop World 2015에 참여를 하게 되었고, 빅 데이터 관련 최신 트랜드를 확인 하는 과정에 Python이 굉장히 큰 비중을 차지하고 있는 것을 보고 무척 놀랐었다. 빅 데이터 관련 기술들이 대부분 Java로 이루어져 있어,  Java에만 신경을 쓰고 있었던 것은 나의 과오였었고, 웹 개발에는 Front-end, Back-end 포함한 Full-Stack JavaScript 쪽에 관심을 가지고 있었는데, 이쪽 분야를 보니 Python 커뮤니티가 굉장히 크고, Science 쪽에서는 가장 선호 하는 프로그래밍 랭귀지 라는 것을 알게 되었다.

실은 작년 말에 영국 자회사에 방문 했을 때도, 본인들이 필요한 툴들을 Python을 개발하여 업무에 활용하는 것을 보고서는 크게 감흥이 없었었다. 하지만, 지금 생각 해보니, Computer Science/Engineering 쪽에 백그라운드도 없고 경험도 없는 사람들이, 그저 본인들의 업무의 비효율성을 제거하고 생산성을 높이려는 목적으로 반복적으로 수행하던 업무를 본인들이 가장 쉽게 배울 수 있는 언어로 개선했다는 것에 조금 더 주목 했어야 하지 않았나 싶다.

해서, 개발자로서의 나의 경력을 이용하면서 수행하과 있는 과제를 진행하기 위해서는 알고리즘을 구현하는 엔지니어가 아니라, 잘 알려져 있는 알고리즘에 대한 특징, 장/단점을 파악 하고, 잘 알려져 있는 라이브러리들을 활용하여, 빠른 시간내에 구현해서 적용/테스트 하는 것이 지금 내가 할 수 있는 가장 가치 있는 일이라는 생각이 들었다.  또, 새로운 것을 배우고 싶어하는 목마름에 쉽게 다가갈 수 있는 Python은 수년전에 Node.js를 시작하면서 JavaScript 의 단순함과 자유도에 매력을 느꼈던 그때의 기분이 재현되게 해 줄 수 있을 거라는 생각이 들었다.

여기서 나는 Python 기반의 기계학습 구현이 가능한 엔지니어로 성장해보려고 한다. 그러다 보면 bottom-up으로 자연스럽게 알고리즘에 대한 이해와 필요한 기반 지식들을 익힐 수 있으리라 기대한다. 빅 데이터, 인공지능, 머신러닝, 딥러닝 등에 관심이 점점 많아지는 요즘, 나와 같이 전형적인 기업 IT 시스템을 개발 하던 많은 개발자들이 비슷한 고민을 하고 있다면, 훗날 좋은 경험담을 공유하고 싶다. :)

>_

2015년 3월 4일 수요일

Data Science with Python

출처 : "Ultimate Skills Checklist for Your First Data Analyst Job" by Udacity

Python programming language
: Python is a high level programming language with many useful packages written for it

[Python packages (“modules”)]
- NumPy
: an optimized python library for numerical analysis, specifically: large, multi-dimensional arrays and matrices. Found in Introduction to Data Science
http://www.numpy.org/
http://en.wikipedia.org/wiki/NumPy

- pandas
: an optimized python library for data analysis including dataframes inspired by R. Found in Introduction to Data Science
http://pandas.pydata.org/
http://en.wikipedia.org/wiki/Pandas_(software)

- matplotlib
: a 2D plotting library for python, includes the pyplot interface which provides a MATLAB-like interface (see ipython notebooks and seaborn below). Found in Introduction to Data Science
http://matplotlib.org/
http://en.wikipedia.org/wiki/Matplotlib

SciPy
: a library for scientific computing and technical computing. Found in Introduction to Data Science
http://www.scipy.org/
http://en.wikipedia.org/wiki/SciPy

scikit-learn
: machine learning library built on NumPy, SciPy, and matplotlib. Mentioned in Introduction to Machine Learning
http://scikit-learn.org/stable/
http://en.wikipedia.org/wiki/Scikit-learn

[optional]
iPython
: an improved interactive shell for python with introspection, rich media, additional shell syntax, tab completion, and richer history
http://ipython.org/
http://en.wikipedia.org/wiki/IPython

iPython notebooks
: a web-based interactive computational environment
http://ipython.org/notebook.html
http://en.wikipedia.org/wiki/IPython#Notebook
hosting: http://nbviewer.ipython.org/

anaconda
: a python package manager for science, math, engineering, data analysis with the intent of simplifying and maintaining compatibility between library versions. Also useful for getting started with ipython notebooks.
http://continuum.io/downloads

ggplot: and (in-progress) port of R’s ggplot2 which premised upon a grammar of graphics
http://ggplot.yhathq.com

seaborn: a Python visualization library based on matplotlib with a highlevel interface
http://web.stanford.edu/~mwaskom/software/seaborn/

Strata+Hadoop WORLD PyData 후기

http://strataconf.com/big-data-conference-ca-2015/public/schedule/full/public

PyData at Strata


  • 머신러닝 라이브러리는 scikit-learn 활용
  • 시계열성 시각화는 Bokeh
  • 성능상 이슈가 있다면 Numba
  • 데이터 로딩을 위해서는 Pandas
  • 모든 작업은 iPython Notebook 으로..
  • ipynb 공유를 위해서는 Jupyter로..

Description

PyData
Python has become an increasingly important part of the data engineer and analytic tool landscape. Pydata at Strata provides in-depth coverage of the tools and techniques gaining traction with the data audience, including iPython Notebook, NumPy/matplotlib for visualization, SciPy, scikit-learn, and how to scale Python performance, including how to handle large, distributed data sets. Come see how the leading lights in the Python data community are making Python ever more useful to data analysts and data engineers.
9:00am – 10:30am
Track 1 (room LL21 B):
  • Machine Learning with scikit-learn
    Andreas Mueller
scikit-learn has emerged as one of the most popular open source machine learning toolkits,
now widely used in academia and industry. scikit-learn provides easy-to-use interfaces to perform advanced analysis and build powerful predictive models. The tutorial will cover basic concepts of machine learning, such as supervised and unsupervised learning, cross validation and model selection. We will see how to prepare data for machine learning, and go from applying a single algorithm to building a machine learning pipeline.
11:00am – 12:30pm
Track 1 (room LL21 B):
  • Interactive Web Graphics with Bokeh
    Peter Wang
Bokeh is an open-source library for building web graphics, ranging from simple interactive plots to complex dashboards with streaming data sources.  This is tutorial will quickly introduce some of the basic concepts behind Bokeh and then dive into a step-by-step series of exercises which showcase how to embed interactive graphics in an IPython notebook and build more complex linked graphics.  Streaming and large datasets will also be demonstrated.
1:30pm – 3:00pm
Track 1 (room LL21 B):
  • Intro to Numba and Performance Python
    Travis Oliphant
Numba is a just-in-time compiler for Python that can translate a wide range
of Python functions into high performance machine code at runtime. This
tutorial will give an overview of the capabilities of the Numba compiler and
walk through several examples showing how to use Numba to generate fast 
implementations of numerical algorithms from pure Python. We will briefly
touch on more advanced features of Numba, such as compiling for the GPU, at
the end.
Materials:
A basic installation of Anaconda. Example IPython notebooks will be posted to
GitHub before the tutorial.
3:30pm – 5:00pm
Track 1 (room LL21 B):
  • Analytics Beyond the Basics with pandas and SQL
    Wes McKinney
In this tutorial, we’ll take a tour through a variety of useful, but sometimes tricky analytical tasks and show how they can be tackled with pandas or SQL. A part of the goal is to illustrate how SQL concepts map onto the pandas API and vice versa, and for the participant to learn more about advanced usage of each of the tools.
Materials will be posted at http://github.com/wesm/strata-sj-2015