Hands-on Lab: Deep Learning with the Theano Python Library
|
|
- Rosa Palmer
- 6 years ago
- Views:
Transcription
1 Hands-on Lab: Deep Learning with the Python Library Frédéric Bastien Montreal Institute for Learning Algorithms Université de Montréal Montréal, Canada Presentation prepared with Pierre Luc Carrier and Arnaud Bergeron GTC 2016
2 Slides PDF of the slides: github repo of this presentation 2 / 58
3 Introduction Logistic Regression Convolution 3 / 58
4 High level Python <- {NumPy/SciPy/libgpuarray} <- <- {...} Python: OO coding language Numpy: n-dimensional array object and scientic computing toolbox SciPy: sparse matrix objects and more scientic computing functionality libgpuarray: n-dimensional array object in C for CUDA and OpenCL : compiler/symbolic graph manipulation (Not a machine learning framework/software) {...}: Many libraries built on top of 1 / 58
5 What provides Lazy evaluation for performance support Symbolic dierentiation Automatic speed and stability optimization 2 / 58
6 High level Many [machine learning] library build on top of Keras blocks lasagne sklearn-theano PyMC 3 theano-rnn Morb... 3 / 58
7 Goal of the stack Fast to develop Fast to run 4 / 58
8 Some models build with Some models that have been build with. Neural Networks Convolutional Neural Networks, AlexNet, OverFeat, GoogLeNet RNN, CTC, LSTM, GRU NADE, RNADE, MADE Autoencoders Generative Adversarial Nets SVMs many variations of above models and more 5 / 58
9 Project status? Mature: has been developed and used since January 2008 (8 yrs old) Driven hundreds of research papers Good user documentation Active mailing list with worldwide participants Core technology for Silicon-Valley start-ups Many contributors (some from outside our institute) Used to teach many university classes Has been used for research at big compagnies 0.8 released 21th of March, 2016 : deeplearning.net/software/theano/ Deep Learning Tutorials: deeplearning.net/tutorial/ 6 / 58
10 Python General-purpose high-level OO interpreted language Emphasizes code readability Comprehensive standard library Dynamic type and memory management Easily extensible with C Slow execution Popular in web development and scientic communities 7 / 58
11 NumPy/SciPy NumPy provides an n-dimensional numeric array in Python Perfect for high-performance computing Slices of arrays are views (no copying) NumPy provides Elementwise computations Linear algebra, Fourier transforms Pseudorandom number generators (many distributions) SciPy provides lots more, including Sparse matrices More linear algebra Solvers and optimization algorithms Matlab-compatible I/O I/O and signal processing for images and audio 8 / 58
12 Introduction Logistic Regression Convolution 9 / 58
13 Description High-level domain-specic language for numeric computation. Syntax as close to NumPy as possible Compiles most common expressions to C for CPU and/or Limited expressivity means more opportunities for optimizations Strongly typed -> compiles to C Array oriented -> easy parallelism Support for looping and branching in expressions No subroutines -> global optimization Automatic speed and numerical stability optimizations 10 / 58
14 Description (2) Symbolic dierentiation and R op (Hessian Free Optimization) Can reuse other technologies for best performance CUDA, CuBLAS, CuDNN, BLAS, SciPy, PyCUDA, Cython, Numba,... Sparse matrices (CPU only) Extensive unit-testing and self-verication Extensible (You can create new operations as needed) Works on Linux, OS X and Windows Multi- New back-end: Float16 new back-end (need cuda 7.5) Multi dtypes Multi- support in the same process 11 / 58
15 Simple example import theano # d e c l a r e s y m b o l i c v a r i a b l e a = theano. t e n s o r. v e c t o r ( "a" ) # b u i l d s y m b o l i c e x p r e s s i o n b = a + a 10 # c o m p i l e f u n c t i o n f = theano. f u n c t i o n ( [ a ], b ) # E x e c u t e w i t h n u m e r i c a l v a l u e p r i n t f ( [ 0, 1, 2 ] ) # p r i n t s ` a r r a y ( [ 0, 2, ] ) ` 12 / 58
16 Simple example 13 / 58
17 Overview of library is many things Language Compiler Python library 14 / 58
18 Scalar math Some example of scalar operations: import theano from theano import t e n s o r as T x = T. s c a l a r ( ) y = T. s c a l a r ( ) z = x + y w = z x a = T. s q r t (w) b = T. exp ( a ) c = a b d = T. l o g ( c ) 15 / 58
19 Vector math from theano import t e n s o r as T x = T. v e c t o r ( ) y = T. v e c t o r ( ) # S c a l a r math a p p l i e d e l e m e n t w i s e a = x y # V e c t o r dot p r o d u c t b = T. dot ( x, y ) # B r o a d c a s t i n g ( a s NumPy, v e r y p o w e r f u l ) c = a + b 16 / 58
20 Matrix math from theano import t e n s o r as T x = T. m a t r i x ( ) y = T. m a t r i x ( ) a = T. v e c t o r ( ) # Matrix m a t r i x p r o d u c t b = T. dot ( x, y ) # Matrix v e c t o r p r o d u c t c = T. dot ( x, a ) 17 / 58
21 Tensors Using : Dimensionality dened by length of broadcastable argument Can add (or do other elemwise op) two tensors with same dimensionality Duplicate tensors along broadcastable axes to make size match from theano import t e n s o r as T t e n s o r 3 = T. TensorType ( b r o a d c a s t a b l e =( F a l s e, F a l s e, F a l s e ), d t y p e= ' f l o a t 3 2 ' ) x = T. t e n s o r 3 ( ) 18 / 58
22 Reductions from theano i m p o r t t e n s o r as T t e n s o r 3 = T. TensorType ( b r o a d c a s t a b l e =( F a l s e, F a l s e, F a l s e ), d t y p e= ' f l o a t 3 2 ' ) x = t e n s o r 3 ( ) t o t a l = x. sum ( ) m a r g i n a l s = x. sum ( a x i s =(0, 2 ) ) mx = x. max ( a x i s =1) 19 / 58
23 Dimshue from theano i m p o r t t e n s o r as T t e n s o r 3 = T. TensorType ( b r o a d c a s t a b l e =( F a l s e, F a l s e, F a l s e ) ) x = t e n s o r 3 ( ) y = x. d i m s h u f f l e ( ( 2, 1, 0 ) ) a = T. m a t r i x ( ) b = a. T # Same a s b c = a. d i m s h u f f l e ( ( 0, 1 ) ) # Adding t o l a r g e r t e n s o r d = a. d i m s h u f f l e ( ( 0, 1, ' x ' ) ) e = a + d 20 / 58
24 Indexing As NumPy! This mean slices and index selection return view # r e t u r n v i e w s, s u p p o r t e d on a_tensor [ i n t ] a_tensor [ int, i n t ] a_tensor [ s t a r t : s t o p : step, s t a r t : s t o p : s t e p ] a_tensor [ : : 1 ] # r e v e r s e t h e f i r s t d i m e n s i o n # Advanced i n d e x i n g, r e t u r n copy a_tensor [ an_index_vector ] # S u p p o r t e d on a_tensor [ an_index_vector, an_index_vector ] a_tensor [ int, an_index_vector ] a_tensor [ an_index_tensor,... ] 21 / 58
25 Compiling and running expression theano.function shared variables and updates compilation modes 22 / 58
26 theano.function >>> from theano import t e n s o r as T >>> x = T. s c a l a r ( ) >>> y = T. s c a l a r ( ) >>> from theano import f u n c t i o n >>> # f i r s t a r g i s l i s t o f SYMBOLIC i n p u t s >>> # s e c o n d a r g i s SYMBOLIC o u t p u t >>> f = f u n c t i o n ( [ x, y ], x + y ) >>> # C a l l i t w i t h NUMERICAL v a l u e s >>> # Get a NUMERICAL o u t p u t >>> f ( 1., 2. ) a r r a y ( 3. 0 ) 23 / 58
27 Shared variables It's hard to do much with purely functional programming shared variables add just a little bit of imperative programming A shared variable is a buer that stores a numerical value for a variable Can write to as many shared variables as you want, once each, at the end of the function Can modify value outside of function with get_value() and set_value() methods. 24 / 58
28 Shared variable example >>> from theano import s h a r e d >>> x = s h a r e d ( 0. ) >>> u p d a t e s = [ ( x, x + 1 ) ] >>> f = f u n c t i o n ( [ ], u p d a t e s=u p d a t e s ) >>> f ( ) >>> x. g e t _ v a l u e ( ) 1. 0 >>> x. s e t _ v a l u e ( ) >>> f ( ) >>> x. g e t _ v a l u e ( ) / 58
29 Compilation modes Can compile in dierent modes to get dierent kinds of programs Can specify these modes very precisely with arguments to theano.function Can use a few quick presets with environment variable ags 26 / 58
30 Example preset compilation modes FAST_RUN: default. Fastest execution, slowest compilation FAST_COMPILE: Fastest compilation, slowest execution. No C code. DEBUG_MODE: Adds lots of checks. Raises error messages in situations other modes regard as ne. optimizer=fast_compile: as mode=fast_compile, but with C code. theano.function(..., mode=fast_compile) THEANO_FLAGS=mode=FAST_COMPILE python script.py 27 / 58
31 There are macro that automatically build bigger graph for you. theano.grad Others Those functions can get called many times, for example to get the 2nd derivative. 28 / 58
32 The grad method >>> x = T. s c a l a r ( ' x ' ) >>> y = 2. x >>> g = T. grad ( y, x ) # P r i n t t h e not o p t i m i z e d g r a p h >>> theano. p r i n t i n g. p y d o t p r i n t ( g ) 29 / 58
33 The grad method >>> x = T. s c a l a r ( ' x ' ) >>> y = 2. x >>> g = T. grad ( y, x ) # P r i n t t h e o p t i m i z e d g r a p h >>> f = theano. f u n c t i o n ( [ x ], g ) >>> theano. p r i n t i n g. p y d o t p r i n t ( f ) 30 / 58
34 Others R_op, L_op for Hessian Free Optimization hessian jacobian clone the graph with replacement you can navigate the graph if you need (go from the result of computation to its input, recursively) 31 / 58
35 Enabling 's current back-end only supports 32 bit on libgpuarray (new-backend) supports all dtype CUDA supports oat64, but it is slow on gamer s 32 / 58
36 : ags ags allow to congure. Can be set via a conguration le or an environment variable. To enable : Set device=gpu (or a specic gpu, like gpu0) Set oatx=oat32 Optional: warn_oat64={'ignore', 'warn', 'raise', 'pdb'} Instead of ags, user can call theano.sandbox.cuda.cuda('gpu0') 33 / 58
37 oatx Allow to change the dtype between oat32 and oat64. T.fscalar, T.fvector, T.fmatrix are all 32 bit T.dscalar, T.dvector, T.dmatrix are all 64 bit T.scalar, T.vector, T.matrix resolve to oatx oatx is oat64 by default, set it to oat32 for 34 / 58
38 CuDNN V3 and V4 is supported. It is enabled automatically if available. ag to get an error if can't be used: dnn.enabled=true ag to disable it: dnn.enabled=false 35 / 58
39 DebugMode, NanGuardMode Error message theano.printing.debugprint 36 / 58
40 Error message: code import numpy a s np import theano import theano. t e n s o r as T x = T. v e c t o r ( ) y = T. v e c t o r ( ) z = x + x z = z + y f = theano. f u n c t i o n ( [ x, y ], z ) f ( np. ones ( ( 2, ) ), np. ones ( ( 3, ) ) ) 37 / 58
41 Error message: 1st part T r a c e b a c k ( most r e c e n t c a l l l a s t ) : [... ] V a l u e E r r o r : I n p u t d i m e n s i o n mis match. ( i n p u t [ 0 ]. s h a p e [ 0 ] = 3, i n p u t [ 1 ]. s h a p e [ 0 ] = 2 ) A p p l y node t h a t c a u s e d t h e e r r o r : E l e m w i s e { add, n o _ i n p l a c e }(< TensorType ( f l o a t 6 4, v e c t o r ) >, <TensorType ( f l o a t 6 4, v e c t o r ) >, <TensorType ( f l o a t 6 4, v e c t o r )>) I n p u t s t y p e s : [ TensorType ( f l o a t 6 4, v e c t o r ), TensorType ( f l o a t 6 4, v e c t o r ), TensorType ( f l o a t 6 4, v e c t o r ) ] I n p u t s s h a p e s : [ ( 3, ), ( 2, ), ( 2, ) ] I n p u t s s t r i d e s : [ ( 8, ), ( 8, ), ( 8, ) ] I n p u t s v a l u e s : [ a r r a y ( [ 1., 1., 1. ] ), a r r a y ( [ 1., 1. ] ), a r r a y ( [ 1., 1. ] ) ] O u t p u t s c l i e n t s : [ [ ' o u t p u t ' ] ] 38 / 58
42 Error message: 2st part HINT: Re-running with most optimization disabled could give you a back-traces when this node was created. This can be done with by setting the ags optimizer=fast_compile. If that does not work, optimizations can be disabled with optimizer=none. HINT: Use the ag exception_verbosity=high for a debugprint of this apply node. 39 / 58
43 Error message: traceback Traceback ( most r e c e n t c a l l l a s t ) : F i l e " t e s t. py ", l i n e 9, i n <module> f ( np. o n e s ( ( 2, ) ), np. o n e s ( ( 3, ) ) ) F i l e "/u/ b a s t i e n f / r e p o s / t h e a n o / c o m p i l e / f u n c t i o n _ m o d u l e. py ", l i n e 589, i n call s e l f. f n. t h u n k s [ s e l f. f n. p o s i t i o n _ o f _ e r r o r ] ) F i l e "/u/ b a s t i e n f / r e p o s / t h e a n o / c o m p i l e / f u n c t i o n _ m o d u l e. py ", l i n e 579, i n call o u t p u t s = s e l f. f n ( ) 40 / 58
44 Error message: optimizer=fast_compile B a c k t r a c e when t h e node i s c r e a t e d : F i l e " t e s t. py ", l i n e 7, in <module> z = z + y 41 / 58
45 debugprint >>> from theano. p r i n t i n g import d e b u g p r i n t >>> d e b u g p r i n t ( a ) Elemwise {mul, n o _ i n p l a c e } [ id A ] ' ' T e n s o r C o n s t a n t { 2. 0 } [ id B ] Elemwise {add, n o _ i n p l a c e } [ id C ] ' z ' < TensorType ( f l o a t 6 4, s c a l a r )> [ id D] < TensorType ( f l o a t 6 4, s c a l a r )> [ id E ] 42 / 58
46 Logistic Regression Convolution Introduction Logistic Regression Convolution 43 / 58
47 Logistic Regression Convolution Inputs # Load from d i s k and put i n s h a r e d v a r i a b l e. d a t a s e t s = load_data ( d a t a s e t ) train_set_x, t r a i n _ s e t _ y = d a t a s e t s [ 0 ] valid_set_x, v a l i d _ s e t _ y = d a t a s e t s [ 1 ] # a l l o c a t e s y m b o l i c v a r i a b l e s f o r t h e d a t a i n d e x = T. l s c a l a r ( ) # i n d e x t o a [ m i n i ] b a t c h # g e n e r a t e s y m b o l i c v a r i a b l e s f o r i n p u t m i n i b a t c h x = T. m a t r i x ( ' x ' ) # data, 1 row p e r image y = T. i v e c t o r ( ' y ' ) # l a b e l s 44 / 58
48 Logistic Regression Convolution Model n_in = n_out = 10 # w e i g h t s W = theano. s h a r e d ( numpy. z e r o s ( ( n_in, n_out ), d t y p e=theano. c o n f i g. f l o a t X ) ) # b i a s b = theano. s h a r e d ( numpy. z e r o s ( ( n_out, ), d t y p e=theano. c o n f i g. f l o a t X ) ) 45 / 58
49 Logistic Regression Convolution Computation # t h e f o r w a r d p a s s p_y_given_x = T. nnet. softmax (T. dot ( input, W) + b ) # c o s t we m i n i m i z e : t h e n e g a t i v e l o g l i k e l i h o o d l = T. l o g ( p_y_given_x ) c o s t = T. mean ( l [T. a r a n g e ( y. shape [ 0 ] ), y ] ) # t h e e r r o r y_pred = T. argmax ( p_y_given_x, a x i s =1) e r r = T. mean (T. neq ( y_pred, y ) ) 46 / 58
50 Logistic Regression Convolution Gradient and updates # compute t h e g r a d i e n t o f c o s t g_w, g_b = T. grad ( c o s t=c o s t, wrt=(w, b ) ) # model p a r a m e t e r s u p d a t e s r u l e s u p d a t e s = [ (W, W l e a r n i n g _ r a t e g_w), ( b, b l e a r n i n g _ r a t e g_b ) ] 47 / 58
51 Logistic Regression Convolution Training function # c o m p i l e a f u n c t i o n t h a t t r a i n t h e model train_model = theano. f u n c t i o n ( i n p u t s =[ i n d e x ], o u t p u t s =( c o s t, e r r ), u p d a t e s=updates, g i v e n s ={ x : t r a i n _ s e t _ x [ i n d e x b a t c h _ s i z e : ( i n d e x + 1) b a t c h _ s i z e ], y : t r a i n _ s e t _ y [ i n d e x b a t c h _ s i z e : ( i n d e x + 1) b a t c h _ s i z e ] } ) 48 / 58
52 Logistic Regression Convolution Introduction Logistic Regression Convolution 49 / 58
53 Logistic Regression Convolution Inputs # Load from d i s k and put i n s h a r e d v a r i a b l e. d a t a s e t s = load_data ( d a t a s e t ) train_set_x, t r a i n _ s e t _ y = d a t a s e t s [ 0 ] valid_set_x, v a l i d _ s e t _ y = d a t a s e t s [ 1 ] # a l l o c a t e s y m b o l i c v a r i a b l e s f o r t h e d a t a i n d e x = T. l s c a l a r ( ) # i n d e x t o a [ m i n i ] b a t c h x = T. m a t r i x ( ' x ' ) # t h e data, 1 row p e r image y = T. i v e c t o r ( ' y ' ) # l a b e l s # Reshape m a t r i x o f s h a p e ( b a t c h _ s i z e, 28 28) # t o a 4D t e n s o r, c o m p a t i b l e f o r c o n v o l u t i o n l a y e r 0 _ i n p u t = x. r e s h a p e ( ( b a t c h _ size, 1, 28, 2 8 ) ) 50 / 58
54 Logistic Regression Convolution Model image_shape=( batch_size, 1, 28, 28) f i l t e r _ s h a p e =( n k e r n s [ 0 ], 1, 5, 5) W_bound =... W = theano. s h a r e d ( numpy. a s a r r a y ( rng. u n i f o r m ( low= W_bound, h i g h=w_bound, s i z e=f i l t e r _ s h a p e ), d t y p e=theano. c o n f i g. f l o a t X ) ) # t h e b i a s i s a 1D t e n s o r # one b i a s p e r o u t p u t f e a t u r e map b_values = numpy. z e r o s ( ( f i l t e r _ s h a p e [ 0 ], ), d t y p e =... b = theano. s h a r e d ( b_values ) 51 / 58
55 Logistic Regression Convolution Computation # c o n v o l v e i n p u t f e a t u r e maps w i t h f i l t e r s conv_out = conv. conv2d ( input=x, f i l t e r s =W) # downsample each f e a t u r e map i n d i v i d u a l l y, # u s i n g m a x p o o l i n g pooled_out = downsample. max_pool_2d ( input=conv_out, ds =(2, 2 ), // p o o l s i z e i g n o r e _ b o r d e r=true ) o u t p u t = T. tanh ( pooled_out + b. d i m s h u f f l e ( ' x ', 0, ' x ', ' x ' ) ) 52 / 58
56 Introduction Logistic Regression Convolution 53 / 58
57 ipython notebook Introduction ( only exercises) lenet (small CNN model to quickly try it) 54 / 58
58 Connection instructions Navigate to nvlabs.qwiklab.com Login or create a new account Select the Instructor-Led Hands-on Labs class Find the lab called and click Start After a short wait, lab instance connection information will be shown Please ask Lab Assistants for help! 55 / 58
59 Further hands-on training Check out the Self-Paced labs at the conference: Deep Learning, CUDA, OpenACC, Tools and more! Just grab a seat and take any available lab Located in the lower-level outside of LL20C You will also receive Credits to take additional labs at nvidia.qwiklab.com Log in using the same account you used in this lab 56 / 58
60 Where to learn more GTC2016 sessions: S at a Glance: A Framework for Machine Learning Deep Learning Tutorials with : deeplearning.net/tutorial tutorial: deeplearning.net/software/tutorial website: deeplearning.net/software You can also see frameworks on top of like Blocks, Keras, Lasagne, / 58
61 Questions, acknowledgments Questions? Acknowledgments All people working or having worked at the LISA lab/mila institute All users/contributors Compute Canada, RQCHP, NSERC, NVIDIA, and Canada Research Chairs for providing funds, access to computing resources, hardware or libraries. 58 / 58
ECE521 W17 Tutorial 1. Renjie Liao & Min Bai
ECE521 W17 Tutorial 1 Renjie Liao & Min Bai Schedule Linear Algebra Review Matrices, vectors Basic operations Introduction to TensorFlow NumPy Computational Graphs Basic Examples Linear Algebra Review
More informationTheano: A Few Examples
October 21, 2015 Theano in a Nutshell Python library for creating, optimizing and evaluating mathematical expressions. Designed for Machine-Learning applications by the LISA Lab in Montreal, Canada, one
More informationA Practitioner s Guide to MXNet
1/34 A Practitioner s Guide to MXNet Xingjian Shi Hong Kong University of Science and Technology (HKUST) HKUST CSE Seminar, March 31st, 2017 2/34 Outline 1 Introduction Deep Learning Basics MXNet Highlights
More informationDeep Learning 101 a Hands-on Tutorial
Deep Learning 101 a Hands-on Tutorial Yarin Gal yg279@cam.ac.uk A TALK IN THREE ACTS, based in part on the online tutorial deeplearning.net/software/theano/tutorial Synopsis Deep Learning is not rocket
More informationPytorch Tutorial. Xiaoyong Yuan, Xiyao Ma 2018/01
(Li Lab) National Science Foundation Center for Big Learning (CBL) Department of Electrical and Computer Engineering (ECE) Department of Computer & Information Science & Engineering (CISE) Pytorch Tutorial
More informationPython & Numpy A tutorial
Python & Numpy A tutorial Devert Alexandre School of Software Engineering of USTC 13 February 2012 Slide 1/38 Table of Contents 1 Why Python & Numpy 2 First steps with Python 3 Fun with lists 4 Quick tour
More informationINF 5860 Machine learning for image classification. Lecture 5 : Introduction to TensorFlow Tollef Jahren February 14, 2018
INF 5860 Machine learning for image classification Lecture 5 : Introduction to TensorFlow Tollef Jahren February 14, 2018 OUTLINE Deep learning frameworks TensorFlow TensorFlow graphs TensorFlow session
More informationDeep Learning intro and hands-on tutorial
Deep Learning intro and hands-on tutorial Π passalis@csd.auth.gr Ε. ώ Π ώ. Π ΠΘ 1 / 53 Deep Learning 2 / 53 Δ Έ ( ) ω π μ, ώπ ώ π ω (,...), π ώ π π π π ω ω ώπ ώ π, (biologically plausible) Δ π ώώ π ώ Ε
More informationScikit-learn. scikit. Machine learning for the small and the many Gaël Varoquaux. machine learning in Python
Scikit-learn Machine learning for the small and the many Gaël Varoquaux scikit machine learning in Python In this meeting, I represent low performance computing Scikit-learn Machine learning for the small
More informationAMLD Deep Learning in PyTorch. 2. PyTorch tensors
AMLD Deep Learning in PyTorch 2. PyTorch tensors François Fleuret http://fleuret.org/amld/ February 10, 2018 ÉCOLE POLYTECHNIQUE FÉDÉRALE DE LAUSANNE PyTorch s tensors François Fleuret AMLD Deep Learning
More informationMidterm for CSC321, Intro to Neural Networks Winter 2018, night section Tuesday, March 6, 6:10-7pm
Midterm for CSC321, Intro to Neural Networks Winter 2018, night section Tuesday, March 6, 6:10-7pm Name: Student number: This is a closed-book test. It is marked out of 15 marks. Please answer ALL of the
More informationPATTERN RECOGNITION AND MACHINE LEARNING
PATTERN RECOGNITION AND MACHINE LEARNING Slide Set 6: Neural Networks and Deep Learning January 2018 Heikki Huttunen heikki.huttunen@tut.fi Department of Signal Processing Tampere University of Technology
More informationNeural Networks Teaser
1/11 Neural Networks Teaser February 27, 2017 Deep Learning in the News 2/11 Go falls to computers. Learning 3/11 How to teach a robot to be able to recognize images as either a cat or a non-cat? This
More informationVectorization. Yu Wu, Ishan Patil. October 13, 2017
Vectorization Yu Wu, Ishan Patil October 13, 2017 Exercises to be covered We will implement some examples of image classification algorithms using a subset of the MNIST dataset logistic regression for
More information@SoyGema GEMA PARREÑO PIQUERAS
@SoyGema GEMA PARREÑO PIQUERAS WHAT IS AN ARTIFICIAL NEURON? WHAT IS AN ARTIFICIAL NEURON? Image Recognition Classification using Softmax Regressions and Convolutional Neural Networks Languaje Understanding
More informationMachine learning comes from Bayesian decision theory in statistics. There we want to minimize the expected value of the loss function.
Bayesian learning: Machine learning comes from Bayesian decision theory in statistics. There we want to minimize the expected value of the loss function. Let y be the true label and y be the predicted
More informationECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University
ECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University Prof. Mi Lu TA: Ehsan Rohani Laboratory Exercise #4 MIPS Assembly and Simulation
More informationIntroduction to Deep Learning CMPT 733. Steven Bergner
Introduction to Deep Learning CMPT 733 Steven Bergner Overview Renaissance of artificial neural networks Representation learning vs feature engineering Background Linear Algebra, Optimization Regularization
More informationTensorFlow: A Framework for Scalable Machine Learning
TensorFlow: A Framework for Scalable Machine Learning You probably Outline want to know... What is TensorFlow? Why did we create TensorFlow? How does Tensorflow Work? Example: Linear Regression Example:
More informationEE-559 Deep learning 1.4. Tensor basics and linear regression. François Fleuret Mon Mar 18 20:04:34 UTC 2019
EE-559 Deep learning 1.4. Tensor basics and linear regression François Fleuret https://fleuret.org/ee559/ Mon Mar 18 20:04:34 UTC 2019 A tensor is a generalized matrix, a finite table of numerical values
More informationCSC321 Lecture 16: ResNets and Attention
CSC321 Lecture 16: ResNets and Attention Roger Grosse Roger Grosse CSC321 Lecture 16: ResNets and Attention 1 / 24 Overview Two topics for today: Topic 1: Deep Residual Networks (ResNets) This is the state-of-the
More informationIntroduction to Python
Introduction to Python Luis Pedro Coelho Institute for Molecular Medicine (Lisbon) Lisbon Machine Learning School II Luis Pedro Coelho (IMM) Introduction to Python Lisbon Machine Learning School II (1
More informationIntroduction to TensorFlow
Large Scale Data Analysis Using Deep Learning (Prof. U Kang) Introduction to TensorFlow 2017.04.17 Beunguk Ahn ( beunguk.ahn@gmail.com) 1 What is TensorFlow? Consturction Phase Execution Phase Examples
More informationDEEP LEARNING AND NEURAL NETWORKS: BACKGROUND AND HISTORY
DEEP LEARNING AND NEURAL NETWORKS: BACKGROUND AND HISTORY 1 On-line Resources http://neuralnetworksanddeeplearning.com/index.html Online book by Michael Nielsen http://matlabtricks.com/post-5/3x3-convolution-kernelswith-online-demo
More informationAlgorithms for Uncertainty Quantification
Technische Universität München SS 2017 Lehrstuhl für Informatik V Dr. Tobias Neckel M. Sc. Ionuț Farcaș April 26, 2017 Algorithms for Uncertainty Quantification Tutorial 1: Python overview In this worksheet,
More informationI. Numerical Computing
I. Numerical Computing A. Lectures 1-3: Foundations of Numerical Computing Lecture 1 Intro to numerical computing Understand difference and pros/cons of analytical versus numerical solutions Lecture 2
More informationBackpropagation and Neural Networks part 1. Lecture 4-1
Lecture 4: Backpropagation and Neural Networks part 1 Lecture 4-1 Administrative A1 is due Jan 20 (Wednesday). ~150 hours left Warning: Jan 18 (Monday) is Holiday (no class/office hours) Also note: Lectures
More informationNEURAL LANGUAGE MODELS
COMP90042 LECTURE 14 NEURAL LANGUAGE MODELS LANGUAGE MODELS Assign a probability to a sequence of words Framed as sliding a window over the sentence, predicting each word from finite context to left E.g.,
More informationMore on Neural Networks
More on Neural Networks Yujia Yan Fall 2018 Outline Linear Regression y = Wx + b (1) Linear Regression y = Wx + b (1) Polynomial Regression y = Wφ(x) + b (2) where φ(x) gives the polynomial basis, e.g.,
More informationHIGH PERFORMANCE CTC TRAINING FOR END-TO-END SPEECH RECOGNITION ON GPU
April 4-7, 2016 Silicon Valley HIGH PERFORMANCE CTC TRAINING FOR END-TO-END SPEECH RECOGNITION ON GPU Minmin Sun, NVIDIA minmins@nvidia.com April 5th Brief Introduction of CTC AGENDA Alpha/Beta Matrix
More informationLecture 4 Backpropagation
Lecture 4 Backpropagation CMSC 35246: Deep Learning Shubhendu Trivedi & Risi Kondor University of Chicago April 5, 2017 Things we will look at today More Backpropagation Still more backpropagation Quiz
More information2 Getting Started with Numerical Computations in Python
1 Documentation and Resources * Download: o Requirements: Python, IPython, Numpy, Scipy, Matplotlib o Windows: google "windows download (Python,IPython,Numpy,Scipy,Matplotlib" o Debian based: sudo apt-get
More informationLecture 35: Optimization and Neural Nets
Lecture 35: Optimization and Neural Nets CS 4670/5670 Sean Bell DeepDream [Google, Inceptionism: Going Deeper into Neural Networks, blog 2015] Aside: CNN vs ConvNet Note: There are many papers that use
More informationHigh-Performance Scientific Computing
High-Performance Scientific Computing Instructor: Randy LeVeque TA: Grady Lemoine Applied Mathematics 483/583, Spring 2011 http://www.amath.washington.edu/~rjl/am583 World s fastest computers http://top500.org
More informationNeural Architectures for Image, Language, and Speech Processing
Neural Architectures for Image, Language, and Speech Processing Karl Stratos June 26, 2018 1 / 31 Overview Feedforward Networks Need for Specialized Architectures Convolutional Neural Networks (CNNs) Recurrent
More information(Artificial) Neural Networks in TensorFlow
(Artificial) Neural Networks in TensorFlow By Prof. Seungchul Lee Industrial AI Lab http://isystems.unist.ac.kr/ POSTECH Table of Contents I. 1. Recall Supervised Learning Setup II. 2. Artificial Neural
More informationImage Processing in Numpy
Version: January 17, 2017 Computer Vision Laboratory, Linköping University 1 Introduction Image Processing in Numpy Exercises During this exercise, you will become familiar with image processing in Python.
More informationDiffSharp An AD Library for.net Languages
DiffSharp An AD Library for.net Languages Atılım Güneş Baydin 1 Barak A. Pearlmutter 2 Jeffrey Mark Siskind 3 1 University of Oxford gunes@robots.ox.ac.uk 2 Maynooth University barak@pearlmutter.net 3
More information(Artificial) Neural Networks in TensorFlow
(Artificial) Neural Networks in TensorFlow By Prof. Seungchul Lee Industrial AI Lab http://isystems.unist.ac.kr/ POSTECH Table of Contents I. 1. Recall Supervised Learning Setup II. 2. Artificial Neural
More informationTips Geared Towards R. Adam J. Suarez. Arpil 10, 2015
Tips Geared Towards R Departments of Statistics North Carolina State University Arpil 10, 2015 1 / 30 Advantages of R As an interpretive and interactive language, developing an algorithm in R can be done
More informationIntroduction to Python
Introduction to Python Luis Pedro Coelho luis@luispedro.org @luispedrocoelho European Molecular Biology Laboratory Lisbon Machine Learning School 2015 Luis Pedro Coelho (@luispedrocoelho) Introduction
More informationIntroduction. How to use this book. Linear algebra. Mathematica. Mathematica cells
Introduction How to use this book This guide is meant as a standard reference to definitions, examples, and Mathematica techniques for linear algebra. Complementary material can be found in the Help sections
More informationHOMEWORK #4: LOGISTIC REGRESSION
HOMEWORK #4: LOGISTIC REGRESSION Probabilistic Learning: Theory and Algorithms CS 274A, Winter 2019 Due: 11am Monday, February 25th, 2019 Submit scan of plots/written responses to Gradebook; submit your
More informationA Brief Introduction To. GRTensor. On MAPLE Platform. A write-up for the presentation delivered on the same topic as a part of the course PHYS 601
A Brief Introduction To GRTensor On MAPLE Platform A write-up for the presentation delivered on the same topic as a part of the course PHYS 601 March 2012 BY: ARSHDEEP SINGH BHATIA arshdeepsb@gmail.com
More informationCS 453X: Class 1. Jacob Whitehill
CS 453X: Class 1 Jacob Whitehill How old are these people? Guess how old each person is at the time the photo was taken based on their face image. https://www.vision.ee.ethz.ch/en/publications/papers/articles/eth_biwi_01299.pdf
More informationApplied Machine Learning Lecture 2, part 1: Basic linear algebra; linear algebra in NumPy and SciPy. Richard Johansson
Applied Machine Learning Lecture 2, part 1: Basic linear algebra; linear algebra in NumPy and SciPy Richard Johansson linear algebra linear algebra is the branch of mathematics that deals with relationships
More informationNeural Networks 2. 2 Receptive fields and dealing with image inputs
CS 446 Machine Learning Fall 2016 Oct 04, 2016 Neural Networks 2 Professor: Dan Roth Scribe: C. Cheng, C. Cervantes Overview Convolutional Neural Networks Recurrent Neural Networks 1 Introduction There
More informationNumPy 1.5. open source. Beginner's Guide. v g I. performance, Python based free open source NumPy. An action-packed guide for the easy-to-use, high
NumPy 1.5 Beginner's Guide An actionpacked guide for the easytouse, high performance, Python based free open source NumPy mathematical library using realworld examples Ivan Idris.; 'J 'A,, v g I open source
More informationCoordinate Update Algorithm Short Course The Package TMAC
Coordinate Update Algorithm Short Course The Package TMAC Instructor: Wotao Yin (UCLA Math) Summer 2016 1 / 16 TMAC: A Toolbox of Async-Parallel, Coordinate, Splitting, and Stochastic Methods C++11 multi-threading
More informationA Tutorial On Backward Propagation Through Time (BPTT) In The Gated Recurrent Unit (GRU) RNN
A Tutorial On Backward Propagation Through Time (BPTT In The Gated Recurrent Unit (GRU RNN Minchen Li Department of Computer Science The University of British Columbia minchenl@cs.ubc.ca Abstract In this
More informationExercise 1. In the lecture you have used logistic regression as a binary classifier to assign a label y i { 1, 1} for a sample X i R D by
Exercise 1 Deadline: 04.05.2016, 2:00 pm Procedure for the exercises: You will work on the exercises in groups of 2-3 people (due to your large group size I will unfortunately not be able to correct single
More informationConvolutional Neural Networks
Convolutional Neural Networks Books» http://www.deeplearningbook.org/ Books http://neuralnetworksanddeeplearning.com/.org/ reviews» http://www.deeplearningbook.org/contents/linear_algebra.html» http://www.deeplearningbook.org/contents/prob.html»
More informationRecurrent Neural Networks (Part - 2) Sumit Chopra Facebook
Recurrent Neural Networks (Part - 2) Sumit Chopra Facebook Recap Standard RNNs Training: Backpropagation Through Time (BPTT) Application to sequence modeling Language modeling Applications: Automatic speech
More informationCSC321 Lecture 4: Learning a Classifier
CSC321 Lecture 4: Learning a Classifier Roger Grosse Roger Grosse CSC321 Lecture 4: Learning a Classifier 1 / 31 Overview Last time: binary classification, perceptron algorithm Limitations of the perceptron
More informationWelcome to the Machine Learning Practical Deep Neural Networks. MLP Lecture 1 / 18 September 2018 Single Layer Networks (1) 1
Welcome to the Machine Learning Practical Deep Neural Networks MLP Lecture 1 / 18 September 2018 Single Layer Networks (1) 1 Introduction to MLP; Single Layer Networks (1) Steve Renals Machine Learning
More informationVector, Matrix, and Tensor Derivatives
Vector, Matrix, and Tensor Derivatives Erik Learned-Miller The purpose of this document is to help you learn to take derivatives of vectors, matrices, and higher order tensors (arrays with three dimensions
More informationMini-project in scientific computing
Mini-project in scientific computing Eran Treister Computer Science Department, Ben-Gurion University of the Negev, Israel. March 7, 2018 1 / 30 Scientific computing Involves the solution of large computational
More informationDM534 - Introduction to Computer Science
Department of Mathematics and Computer Science University of Southern Denmark, Odense October 21, 2016 Marco Chiarandini DM534 - Introduction to Computer Science Training Session, Week 41-43, Autumn 2016
More informationA Glimpse at Scipy FOSSEE. June Abstract This document shows a glimpse of the features of Scipy that will be explored during this course.
A Glimpse at Scipy FOSSEE June 010 Abstract This document shows a glimpse of the features of Scipy that will be explored during this course. 1 Introduction SciPy is open-source software for mathematics,
More informationCSC321 Lecture 20: Reversible and Autoregressive Models
CSC321 Lecture 20: Reversible and Autoregressive Models Roger Grosse Roger Grosse CSC321 Lecture 20: Reversible and Autoregressive Models 1 / 23 Overview Four modern approaches to generative modeling:
More informationCPSC 540: Machine Learning
CPSC 540: Machine Learning Matrix Notation Mark Schmidt University of British Columbia Winter 2017 Admin Auditting/registration forms: Submit them at end of class, pick them up end of next class. I need
More informationDeep Learning. Convolutional Neural Networks Applications
Deep Learning Using a Convolutional Neural Network Dr. Ing. Morris Riedel Adjunct Associated Professor School of Engineering and Natural Sciences, University of Iceland Research Group Leader, Juelich Supercomputing
More informationPractical Combustion Kinetics with CUDA
Funded by: U.S. Department of Energy Vehicle Technologies Program Program Manager: Gurpreet Singh & Leo Breton Practical Combustion Kinetics with CUDA GPU Technology Conference March 20, 2015 Russell Whitesides
More informationNeural Networks and Deep Learning
Neural Networks and Deep Learning Professor Ameet Talwalkar November 12, 2015 Professor Ameet Talwalkar Neural Networks and Deep Learning November 12, 2015 1 / 16 Outline 1 Review of last lecture AdaBoost
More informationConvolutional Neural Networks II. Slides from Dr. Vlad Morariu
Convolutional Neural Networks II Slides from Dr. Vlad Morariu 1 Optimization Example of optimization progress while training a neural network. (Loss over mini-batches goes down over time.) 2 Learning rate
More informationManaging Uncertainty
Managing Uncertainty Bayesian Linear Regression and Kalman Filter December 4, 2017 Objectives The goal of this lab is multiple: 1. First it is a reminder of some central elementary notions of Bayesian
More informationIntroduction to TensorFlow
Introduction to TensorFlow Oliver Dürr Datalab-Lunch Seminar Series Winterthur, 17 Nov, 2016 1 Abstract Introduc)on to TensorFlow TensorFlow is a mul/purpose open source so2ware library for numerical computa/on
More informationLecture 15: Exploding and Vanishing Gradients
Lecture 15: Exploding and Vanishing Gradients Roger Grosse 1 Introduction Last lecture, we introduced RNNs and saw how to derive the gradients using backprop through time. In principle, this lets us train
More informationLong-Short Term Memory and Other Gated RNNs
Long-Short Term Memory and Other Gated RNNs Sargur Srihari srihari@buffalo.edu This is part of lecture slides on Deep Learning: http://www.cedar.buffalo.edu/~srihari/cse676 1 Topics in Sequence Modeling
More informationAP PHYSICS C Mechanics - SUMMER ASSIGNMENT FOR
AP PHYSICS C Mechanics - SUMMER ASSIGNMENT FOR 2018-2019 Dear Student: The AP physics course you have signed up for is designed to prepare you for a superior performance on the AP test. To complete material
More informationRecurrent Neural Networks
Recurrent Neural Networks Datamining Seminar Kaspar Märtens Karl-Oskar Masing Today's Topics Modeling sequences: a brief overview Training RNNs with back propagation A toy example of training an RNN Why
More informationConvolutional Neural Nets
Convolutional Neural Nets Oliver Dürr Datalab-Lunch Seminar Series Winterthur, 17 December 2014 1 History of CNN 1980 Kunihiko Fukushima introduction 1998 Le Cunn (Backpropagation) Schmidt Huber Group
More informationRecurrent Neural Networks. Jian Tang
Recurrent Neural Networks Jian Tang tangjianpku@gmail.com 1 RNN: Recurrent neural networks Neural networks for sequence modeling Summarize a sequence with fix-sized vector through recursively updating
More informationSolving PDEs with CUDA Jonathan Cohen
Solving PDEs with CUDA Jonathan Cohen jocohen@nvidia.com NVIDIA Research PDEs (Partial Differential Equations) Big topic Some common strategies Focus on one type of PDE in this talk Poisson Equation Linear
More informationOutline. Overview CNTK introduction. Educational resources Conclusions. Symbolic loop Batch scheduling Data parallel training
Outline Overview CNTK introduction Symbolic loop Batch scheduling Data parallel training Educational resources Conclusions Outline Overview CNTK introduction Symbolic loop Batch scheduling Data parallel
More informationIntroduction to Neural Networks
Introduction to Neural Networks Philipp Koehn 4 April 205 Linear Models We used before weighted linear combination of feature values h j and weights λ j score(λ, d i ) = j λ j h j (d i ) Such models can
More informationCSE 241 Class 1. Jeremy Buhler. August 24,
CSE 41 Class 1 Jeremy Buhler August 4, 015 Before class, write URL on board: http://classes.engineering.wustl.edu/cse41/. Also: Jeremy Buhler, Office: Jolley 506, 314-935-6180 1 Welcome and Introduction
More informationA thorough derivation of back-propagation for people who really want to understand it by: Mike Gashler, September 2010
A thorough derivation of back-propagation for people who really want to understand it by: Mike Gashler, September 2010 Define the problem: Suppose we have a 5-layer feed-forward neural network. (I intentionally
More informationTR A Comparison of the Performance of SaP::GPU and Intel s Math Kernel Library (MKL) for Solving Dense Banded Linear Systems
TR-0-07 A Comparison of the Performance of ::GPU and Intel s Math Kernel Library (MKL) for Solving Dense Banded Linear Systems Ang Li, Omkar Deshmukh, Radu Serban, Dan Negrut May, 0 Abstract ::GPU is a
More informationDeep Learning: a gentle introduction
Deep Learning: a gentle introduction Jamal Atif jamal.atif@dauphine.fr PSL, Université Paris-Dauphine, LAMSADE February 8, 206 Jamal Atif (Université Paris-Dauphine) Deep Learning February 8, 206 / Why
More informationMatrix-Vector Operations
Week3 Matrix-Vector Operations 31 Opening Remarks 311 Timmy Two Space View at edx Homework 3111 Click on the below link to open a browser window with the Timmy Two Space exercise This exercise was suggested
More informationCSC321 Lecture 2: Linear Regression
CSC32 Lecture 2: Linear Regression Roger Grosse Roger Grosse CSC32 Lecture 2: Linear Regression / 26 Overview First learning algorithm of the course: linear regression Task: predict scalar-valued targets,
More informationMachine Learning for Physicists Lecture 1
Machine Learning for Physicists Lecture 1 Summer 2017 University of Erlangen-Nuremberg Florian Marquardt (Image generated by a net with 20 hidden layers) OUTPUT INPUT (Picture: Wikimedia Commons) OUTPUT
More informationPractical Information
MA2501 Numerical Methods Spring 2018 Norwegian University of Science and Technology Department of Mathematical Sciences Semester Project Practical Information This project counts for 30 % of the final
More informationMachine Learning: Assignment 1
10-701 Machine Learning: Assignment 1 Due on Februrary 0, 014 at 1 noon Barnabas Poczos, Aarti Singh Instructions: Failure to follow these directions may result in loss of points. Your solutions for this
More informationArtificial Neural Networks D B M G. Data Base and Data Mining Group of Politecnico di Torino. Elena Baralis. Politecnico di Torino
Artificial Neural Networks Data Base and Data Mining Group of Politecnico di Torino Elena Baralis Politecnico di Torino Artificial Neural Networks Inspired to the structure of the human brain Neurons as
More informationDeep Learning Sequence to Sequence models: Attention Models. 17 March 2018
Deep Learning Sequence to Sequence models: Attention Models 17 March 2018 1 Sequence-to-sequence modelling Problem: E.g. A sequence X 1 X N goes in A different sequence Y 1 Y M comes out Speech recognition:
More informationLecture 2: Linear regression
Lecture 2: Linear regression Roger Grosse 1 Introduction Let s ump right in and look at our first machine learning algorithm, linear regression. In regression, we are interested in predicting a scalar-valued
More informationHOMEWORK #4: LOGISTIC REGRESSION
HOMEWORK #4: LOGISTIC REGRESSION Probabilistic Learning: Theory and Algorithms CS 274A, Winter 2018 Due: Friday, February 23rd, 2018, 11:55 PM Submit code and report via EEE Dropbox You should submit a
More informationDeep Learning Autoencoder Models
Deep Learning Autoencoder Models Davide Bacciu Dipartimento di Informatica Università di Pisa Intelligent Systems for Pattern Recognition (ISPR) Generative Models Wrap-up Deep Learning Module Lecture Generative
More informationSequence Modeling with Neural Networks
Sequence Modeling with Neural Networks Harini Suresh y 0 y 1 y 2 s 0 s 1 s 2... x 0 x 1 x 2 hat is a sequence? This morning I took the dog for a walk. sentence medical signals speech waveform Successes
More informationA 2. =... = c c N. 's arise from the three types of elementary row operations. If rref A = I its determinant is 1, and A = c 1
Theorem: Let A n n Then A 1 exists if and only if det A 0 proof: We already know that A 1 exists if and only if the reduced row echelon form of A is the identity matrix Now, consider reducing A to its
More informationLearning Deep Architectures for AI. Part II - Vijay Chakilam
Learning Deep Architectures for AI - Yoshua Bengio Part II - Vijay Chakilam Limitations of Perceptron x1 W, b 0,1 1,1 y x2 weight plane output =1 output =0 There is no value for W and b such that the model
More informationMachine Learning Basics
Security and Fairness of Deep Learning Machine Learning Basics Anupam Datta CMU Spring 2019 Image Classification Image Classification Image classification pipeline Input: A training set of N images, each
More informationCrash Course on TensorFlow! Vincent Lepetit!
Crash Course on TensorFlow Vincent Lepetit 1 TensorFlow Created by Google for easily implementing Deep Networks; Library for Python, but can also be used with C and Java; Exists for Linux, Mac OSX, Windows;
More informationNeural Network Language Modeling
Neural Network Language Modeling Instructor: Wei Xu Ohio State University CSE 5525 Many slides from Marek Rei, Philipp Koehn and Noah Smith Course Project Sign up your course project In-class presentation
More informationLab 2 Worksheet. Problems. Problem 1: Geometry and Linear Equations
Lab 2 Worksheet Problems Problem : Geometry and Linear Equations Linear algebra is, first and foremost, the study of systems of linear equations. You are going to encounter linear systems frequently in
More informationCS 542G: Conditioning, BLAS, LU Factorization
CS 542G: Conditioning, BLAS, LU Factorization Robert Bridson September 22, 2008 1 Why some RBF Kernel Functions Fail We derived some sensible RBF kernel functions, like φ(r) = r 2 log r, from basic principles
More informationintroduction to convolutional networks using tensorflow
introduction to convolutional networks using tensorflow Jesús Fernández Bes, jfbes@ing.uc3m.es 8 de febrero de 2016 contents Install What is Tensorflow? Implementing Softmax Regression Deep Convolutional
More informationName: Student number:
UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2018 EXAMINATIONS CSC321H1S Duration 3 hours No Aids Allowed Name: Student number: This is a closed-book test. It is marked out of 35 marks. Please
More information