Get Started With Keras For Beginners

Sep 8, 2015

I'm trying researching on deep learning, and I decided to use Keras, which runs with very simple code. I installed Keras, its requirements with miniconda on python 2.x. miniconda is for very simple dependency management, and python 2.x is for compatibility for some library (not happened, but just in case).

Keras is a minimalist, highly modular neural network library ..., that uses Theano ...

at http://keras.io/.

Update

  • 2016-06-22: I wrote new post for Keras with TensorFlow. Click here.

Environment

$ uname -a
Linux 2a49ce30b6a8 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Install miniconda and python 2.x

See also here.

$ wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-`uname -p`.sh
$ bash Miniconda-latest-Linux-`uname -p`.sh -b
$ rm Miniconda-latest-Linux-`uname -p`.sh

-b option makes script run with default setting.

Reopen shell or run $ . .bashrc for setting up the environment $PATH.

Install Theano

$ conda install -y theano

Conda does not ask for confirmation with -y option.

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

Install Keras

Conda cannot install Keras, so install requirements of Keras first, and install Keras with pip.

$ conda install -y h5py
$ pip install keras

Install build essential (optional)

$ sudo apt-get install -y build-essential

Without g++, you will get this message when run Keras and Keras will be very slow.

WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to exe
cute optimized C-implementations (for both CPU and GPU) and will default to Pyth
on implementations. Performance will be severely degraded. To remove this warnin
g, set Theano flags cxx to an empty string.

Test Keras

$ curl -sSL https://github.com/fchollet/keras/raw/master/examples/mnist_mlp.py | python

And check the output.

60000 train samples
10000 test samples
Train on 60000 samples, validate on 10000 samples
Epoch 0
5s - loss: 0.4356 - acc: 0.8716 - val_loss: 0.1863 - val_acc: 0.9421
Epoch 1
5s - loss: 0.1961 - acc: 0.9414 - val_loss: 0.1274 - val_acc: 0.9601
Epoch 2
5s - loss: 0.1451 - acc: 0.9564 - val_loss: 0.1010 - val_acc: 0.9691
Epoch 3
5s - loss: 0.1189 - acc: 0.9642 - val_loss: 0.0847 - val_acc: 0.9752
Epoch 4
5s - loss: 0.1019 - acc: 0.9691 - val_loss: 0.0850 - val_acc: 0.9735
Epoch 5
5s - loss: 0.0903 - acc: 0.9721 - val_loss: 0.0749 - val_acc: 0.9777
Epoch 6
5s - loss: 0.0822 - acc: 0.9745 - val_loss: 0.0753 - val_acc: 0.9762
Epoch 7
5s - loss: 0.0758 - acc: 0.9762 - val_loss: 0.0743 - val_acc: 0.9796
Epoch 8
5s - loss: 0.0705 - acc: 0.9780 - val_loss: 0.0720 - val_acc: 0.9784
Epoch 9
5s - loss: 0.0648 - acc: 0.9790 - val_loss: 0.0688 - val_acc: 0.9793
Epoch 10
5s - loss: 0.0592 - acc: 0.9819 - val_loss: 0.0663 - val_acc: 0.9797
Epoch 11
5s - loss: 0.0567 - acc: 0.9824 - val_loss: 0.0677 - val_acc: 0.9815
Epoch 12
5s - loss: 0.0536 - acc: 0.9833 - val_loss: 0.0711 - val_acc: 0.9796
Epoch 13
5s - loss: 0.0520 - acc: 0.9834 - val_loss: 0.0684 - val_acc: 0.9806
Epoch 14
5s - loss: 0.0500 - acc: 0.9837 - val_loss: 0.0664 - val_acc: 0.9807
Epoch 15
5s - loss: 0.0471 - acc: 0.9850 - val_loss: 0.0683 - val_acc: 0.9809
Epoch 16
5s - loss: 0.0449 - acc: 0.9856 - val_loss: 0.0682 - val_acc: 0.9812
Epoch 17
5s - loss: 0.0433 - acc: 0.9860 - val_loss: 0.0675 - val_acc: 0.9813
Epoch 18
5s - loss: 0.0401 - acc: 0.9869 - val_loss: 0.0683 - val_acc: 0.9819
Epoch 19
5s - loss: 0.0383 - acc: 0.9874 - val_loss: 0.0705 - val_acc: 0.9820
Test score: 0.0704572771238
Test accuracy: 0.982

 

[출처] http://ermaker.github.io/blog/2015/09/08/get-started-with-keras-for-beginners.html

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
공지 오라클 기본 샘플 데이터베이스 졸리운_곰 2014.01.02 96409
공지 [SQL컨셉] 서적 "SQL컨셉"의 샘플 데이타 베이스 SAMPLE DATABASE of ORACLE 가을의 곰을... 2013.02.10 87144
공지 [G_SQL] Sample Database 가을의 곰을... 2012.05.20 103972
42 블록체인 기반 플랫폼 비즈니스를 이해하자 졸리운_곰 2017.09.10 1668
41 다운타임 없는 서비스 구현 패턴 file 졸리운_곰 2017.09.10 1330
40 테이블의 수직분할과 수평분할에 대한 이해 file 졸리운_곰 2017.09.10 4059
39 정규화와 응집도에 대한 고찰 file 졸리운_곰 2017.05.28 1962
38 머신러닝 새 도전…“클라우드를 벗어나라" file 졸리운_곰 2017.05.28 1880
37 보안성 높이는 공공 거래장부 블록체인 file 졸리운_곰 2017.05.28 1929
36 디지털, 속도의 전쟁 VS 데이터, 품질의 전쟁 file 졸리운_곰 2017.05.05 1677
35 04. 데이터 모델링의 3단계 진행 file 졸리운_곰 2016.03.15 1796
34 데이터베이스 설계의 기본 원리.pdf file 졸리운_곰 2016.03.15 2450
33 실체유형(Entity Type) 정의 사항 및 도출 file 졸리운_곰 2015.05.21 2456
32 마농의 SQL 백문백답: 단순하고 쉽게 작성하는 SQL 노하우 [1회] file 졸리운_곰 2015.05.21 1933
31 sql개발자-sql전문가자격시험 시험 예제.pdf file 졸리운_곰 2015.02.15 2506
30 데이터베이스 선정에는 비밀이 있다 - 4부 졸리운_곰 2015.01.15 2403
29 데이터베이스 선정에는 비밀이 있다 - 3부 졸리운_곰 2015.01.15 2210
28 데이터베이스 선정에는 비밀이 있다 - 2부 졸리운_곰 2015.01.15 2037
27 데이터베이스 선정에는 비밀이 있다 - 1부 졸리운_곰 2015.01.15 2542
26 지금 우리에게 필요한 것은 데이터베이스 성능 최적화이다 (2부) 졸리운_곰 2015.01.15 1687
25 우리에게 필요한 것은 데이터베이스 성능 (1부) 졸리운_곰 2015.01.15 2112
24 21회 결과 secret 졸리운_곰 2014.11.10 0
23 [데이터아키텍쳐준전문가] 시험 fail 자료 secret 졸리운_곰 2014.08.31 0
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED