본문 바로가기

전체 글59

[theano] The experiment for understanding about update of theano.function theano.function 에서 updates가 어떻게 돌아가는지 실험해보겠다. 일단 update를 할 때 기본적으로 theano.tensor.grad라는 함수를 알아야한다. grad함수를 이용하여 weight들을 update하게된다. 다음의 예제 소스를 참고하여 weight들이 어떻게 변하는지 살펴보자. Let me experiment how to update parameters in theano.function library. When you use 'updates' in theano.function, basically, you know the theano.tensor.grad library. Weight variable is updated by theano.tensor.grad lib. we ob.. 2016. 2. 2.
[DNN] Basic structure DNN using theano 기본적인 구조의 DNN을 만들어 보고자 한다. 기본적인 뼈대만 구축할 생각이다. 사실 MLP나 다름없다. MLP와 DNN의 가장 큰 차이는 hidden layer의 개수인데 사실 별 차이가 없긴하다. theano를 이용할 예정인데 theano를 이용하여 기본적인 DNN 사용법을 익혀보기 위함이다. 우선 train, test data가 필요한데 이것은 랩실 형이 만들어 주었다. matlab을 이용하여 가우시안 분포를 이루는 5개의 class로 이뤄진 data set이다. 이 데이터 set은 직접 만들기 바란다. 공유하고 싶지만 내가 짠 코드가 아니니까.. 힌트를 주자면 gaussian distribution에 대해 알면 쉽게 만들 수 있다. 우선 각 class의 1/5 정도는 test set으로 분류하고 .. 2016. 2. 1.
[theano] why dose theano.function use 'givens' in theano? 원문 그대로 들고옴. Theano, 헷갈리는 shared variable 및 updates, givens 개념 May 12, 2015 Theano를 처음 익힐 때 조금 헷갈리는 부분이 shared variable, 그리고 updates, givens 문법인데, 이런 문법이 굳이 왜 필요한지 의문이 들기 때문이다. 여기 링크에 설명이 잘 돼있긴 하지만 좀 더 정리해본다. 예제 설명을 위한 예제로 Ordinary Least Square 문제 (Linear Regression) 또는 Vector Form으로 나타내면 를 생각해보자. 사실 이 문제는 Analytic Solution이 존재하지만 여기서는 예시를 위해 Gradient Descent Learning을 하는 것으로 생각한다. 우선 Theano가 권장하.. 2016. 1. 25.
[python] How to get matlab data file '.mat' in python 우선 matlab 에서 .mat 데이터를 생성해보자. Frstly, we generate matlab data format file '.mat' in matlab 두번째로 python에서 이 데이터를 받는다. 이때, scipy.io 함수를 이용하여 .mat 파일을 받을 수 있다. Secondly, we get this data in python. At the point, we use 'scipy.io' library in python. 위의 코드를 실행하면 .mat data를 받아서 train_set_x 에 해당하는 data를 print하게 된다. train_set_x 데이터는 (3,10)행렬로 이뤄진 랜덤수 행렬이다. If thee top code implement in python, we get .m.. 2016. 1. 25.