[Deep learning] Gradient Descent Optimizer

이미지
https://icim.nims.re.kr/post/easyMath/70 알기 쉬운 산업수학 알기 쉬운 산업수학 Gradient Descent Optimizer 2017년 12월 13일(수) | 김민중 URL  (1) 주어진 목적함수  f f 의 최솟값(minimum)을 찾아가는 알고리즘으로 다음과 같은 방식으로 최솟값을 찾아간다. 초기값  x 0 x 0 을 임의로 설정, 적당한 Learning rate  α α  설정 n ≥ 0 n ≥ 0 인 정수에 대해서  x n + 1 x n + 1 은 다음과 같이 정의한다. x n + 1 : = x n − α ⋅ ∇ f ( x n ) x n + 1 := x n − α ⋅ ∇ f ( x n ) 주의사항 함수 f f 의 모양이 convex가 아닌 경우 global minimum이 아닌 local minimum으로  x n x n 이 수렴할 가능성이 있다. Learning rate  α α  값이 큰 경우 최솟값으로  x n x n 이 수렴하는 것이 아니라 발산할 수 있다. Learning rate  α α  값이 작은 경우 수렴하는 속도가 지나치게 느릴 수 있다. 방정식  2 ⋅ x = 10 2 ⋅ x = 10  의 근을 Gradient Descent를 이용해서 찾아보자. 목적함수  f ( x ) : = ( 10 − 2 x ) 2 f ( x ) := ( 10 − 2 x ) 2 으로 설정하겠다( f f 의 최솟값인 0이 되게 하는  x x 값이 우리가 원하는 방정식의 근이다). 초기값  x 0 = 0 x 0 = 0 , Learning rate  α = 0.05 α = 0.05 으로 설정 f ′ ( x ) = 4 ( 2 x − 10 ) f ′ ( x ) = 4 ( 2 x − 10 )...

[Python][Visual Studio] How to check python environment ?

이미지
<How to check python environment in visual studio> <Solution> To check which Python the project uses: From the  Tools  menu, select Python Tools, and then select Python Interactive. The keyboard shortcut is Alt+I: In the  Python Interactive  window, type  import   sys , and then press Enter. Type  sys.version , and then press Enter. If PTVS is using Anaconda, your Anaconda Python version is displayed. In the example below, it is Anaconda 1.5.0 (64-bit): If PTVS does not automatically discover Anaconda, see the  official PTVS documentation , especially the section on  Selecting and Installing Python Interpreters  and the  PTVS installation instructions . <Reference> https://docs.anaconda.com/anaconda/user-guide/tasks/integration/python-ptvs

[STL][Thread] unknown-type std::invoke(_Callable &&,_Types &&...)

<Problem> Severity Code Description Project File Line Suppression State Error C2893 Failed to specialize function template 'unknown-type std::invoke(_Callable &&,_Types &&...)' ,,, Severity Code Description Project File Line Suppression State Error C2672 'std::invoke': no matching overloaded function found ,,, <Solution> There are several reason is related with this error message. In my case, It was parameter problem. 1. The code of error position. std::thread* m_thVMSReport = new std::thread(&CWndOBJCenter::SetEventReportToServer, this, pMsg->wParam , len); 2. How to fix the error. Just pass a casted parameter to the function. SomeClass* pSomeClass = (SomeClass*)pMsg->wParam; std::thread(&CWndOBJCenter::SetEventReportToServer, this,   pSomeClass ,  len); That's all.

[Xcode][IOS][Swift] Twitter api

< About requestAccessToAccounts function > 1. Environment: Xcode 8.3.3 , swift3 , IOS 10.3 2. Not work   account. requestAccessToAccounts (with: accountType, options: [:]) {             (success: Bool , error: Error ?) -> Void in             if success {                 print ( "success" )             } else {                 print ( "not success" )                              }                       } 3. Work well         account. requestAccessToAccounts (with: accountType, options: nil , completion:                          {(success...

[Anaconda][Python][Visual Studio] How to add virtual environment to visual studio python project.

이미지
<How to add virtual environment to visual studio python project> 1. Create virtual env There are several way to make python virtual environment. 1-1. anaconda UI 1-2. anaconda command ( conda create -n 'name of virtualevn' python=x.x  ) $> conda create -n CNTK python=3.5 1-3. With pip, virtuanenv and virtualenvwrapper https://www.blogger.com/blogger.g?blogID=8309050393695147092#editor/target=post;postID=1046788766165476929;onPublishedMenu=allposts;onClosedMenu=allposts;postNum=0;src=postname 2. After creating a python project, View -> Other windows -> python environments 3. Apply a virtual environment from already exist ( in this example from anaconda ) 3-2. Follow like the sequence number on picture. ( 1 -> 2 -> 3 -> 4 -> 5 ) <For example in my case> -> + Custom...  -> fill in description -> click ... line of prefix pat...

[Python][Virtualenv][virtualenvwrapper] Create virtual envrionment ( pip , virtualenv, virtalenvwrapper )

1. Install pip, virtualenv , virtualenvwrapper for separate python environments $ wget https://bootstrap.pypa.io/get-pip.py $ sudo python get-pip.py $ sudo pip install virtualenv virtualenvwrapper $ sudo rm -rf get-pip.py ~/.cache/pip 2. Update .bashrc file # virtualenv and virtualenvwrapper export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh 3. Make workplace with virtual environment $ source ~/.bashrc $ mkvirtualenv deepLab ( deepLab is name , it means you can name it , after this command run prompt of terminal will change. )

[Xcode][IOS] CoreData -> Code Generate -> Error : ,,,,used twice......

이미지
< Problem > Working with coredata in XCode. After generate relation code there is an error message. <unknown>:0: error: filename "Pattern+CoreDataProperties.swift" used twice: '/Volumes/Seagate Backup Plus Drive/Data/Projects/IPhone/Project/Patterns/Pattern+CoreDataProperties.swift' and '/Users/sunggukim/Library/Developer/Xcode/DerivedData/Patterns-bshesfmiyvjjlvegoiunmaydhdfq/Build/Intermediates/Patterns.build/Debug-iphoneos/Patterns.build/DerivedSources/CoreDataGenerated/Patterns/Pattern+CoreDataProperties.swift' <unknown>:0: note: filenames are used to distinguish private declarations with the same name Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1 <Solution> 1. Delete already generated files. 2. Set *.xcdatamodeld class option     Model : Current Product Module    Codegen : Manual / None 3. Generate code. ...

[Anaconda][spyder] Working for setup environent

이미지
This post is written to memory that how can I setup working environment with Spyder in anaconda. 1. Working with UI. Create a new environment 2. Working with command. Activate an environment 2-1. open command prompt. 2-2. Type in  activate 'VIRTUAL-ENVIRONMENT-NAME' Ex> activate tensorflow_lab After that we can see prompt changed as (tensorflow) /user/home$ 2-3.  Install some modules. conda install  xyz ex> conda install -c menpo dlib=19.4 3. Tip> conda info --envs with this command you can check available virtual environments.