• Tidak ada hasil yang ditemukan

Large Scale Data Analysis Using Deep Learning

N/A
N/A
Protected

Academic year: 2024

Membagikan "Large Scale Data Analysis Using Deep Learning"

Copied!
19
0
0

Teks penuh

(1)

Large Scale Data Analysis Using Deep Learning

Deep Feedforward Networks - 2

U Kang

(2)

In This Lecture

๏ฎ

Back propagation

๏ฑ

Motivation

๏ฑ

Main idea

๏ฑ

Procedure

(3)

Computational Graphs

๏ฎ

Formalizes computation

๏ฎ

Each node indicates a variable

๏ฎ

Each edge indicates an operation

(4)

Chain Rule of Calculus

๏ฎ

Let x be a real number, and f and g be functions from R to R. Suppose y = g(x), and z = f(g(x)) = f(y). Then the chain rule states that

๐‘‘๐‘‘๐‘‘๐‘‘๐‘‘๐‘‘๐‘‘๐‘‘

=

๐‘‘๐‘‘๐‘ฆ๐‘ฆ๐‘‘๐‘‘๐‘‘๐‘‘ ๐‘‘๐‘‘๐‘ฆ๐‘ฆ๐‘‘๐‘‘๐‘‘๐‘‘

๏ฎ

Suppose ๐‘ฅ๐‘ฅ โˆˆ ๐‘…๐‘…

๐‘š๐‘š

, ๐‘ฆ๐‘ฆ โˆˆ ๐‘…๐‘…

๐‘›๐‘›

, ๐‘”๐‘”: ๐‘…๐‘…

๐‘š๐‘š

โ†’ ๐‘…๐‘…

๐‘›๐‘›

, ๐‘“๐‘“ : ๐‘…๐‘…

๐‘›๐‘›

โ†’ ๐‘…๐‘… . If ๐’š๐’š = ๐‘”๐‘”(๐’™๐’™) and ๐‘ง๐‘ง = ๐‘“๐‘“(๐’š๐’š) , then

๐œ•๐œ•๐‘‘๐‘‘๐œ•๐œ•๐‘‘๐‘‘

๐‘–๐‘–

= โˆ‘

๐‘—๐‘— ๐œ•๐œ•๐‘ฆ๐‘ฆ๐œ•๐œ•๐‘‘๐‘‘

๐‘—๐‘—

๐œ•๐œ•๐‘ฆ๐‘ฆ๐‘—๐‘—

๐œ•๐œ•๐‘‘๐‘‘๐‘–๐‘–

. In

vector notation: ๐›ป๐›ป

๐’™๐’™

๐‘ง๐‘ง = (

๐œ•๐œ•๐’š๐’š๐œ•๐œ•๐’™๐’™

)

๐‘‡๐‘‡

๐›ป๐›ป

๐’š๐’š

๐‘ง๐‘ง , where

๐œ•๐œ•๐’š๐’š๐œ•๐œ•๐’™๐’™

is the n x m Jacobian matrix of g

๏ฑ E.g., suppose ๐‘ง๐‘ง = ๐‘‘๐‘‘๐‘‡๐‘‡๐’š๐’š, and ๐ฒ๐ฒ = ๐›ป๐›ป๐’™๐’™๐‘”๐‘” ๐’™๐’™ . Then ๐›ป๐›ป๐’™๐’™๐‘ง๐‘ง = (๐œ•๐œ•๐’š๐’š๐œ•๐œ•๐’™๐’™)๐‘‡๐‘‡๐›ป๐›ป๐’š๐’š๐‘ง๐‘ง = ๐ป๐ป๐‘‡๐‘‡๐‘‘๐‘‘

(5)

Repeated Subexpressions

๏ฎ Computing the same subexpression many times would be wasteful

(6)

Backpropagation - Overview

๏ฎ

Backpropagation is an algorithm to compute partial derivatives efficiently in neural networks

๏ฎ

The main idea is dynamic programming

๏ฑ Many computations share common computations

๏ฑ Store the common computations in memory, and read them from memory when needed, without re-computing them from scratch

(7)

Backpropagation - Overview

๏ฎ Assume a computational graph to compute a single scalar ๐‘ข๐‘ข(๐‘›๐‘›)

๏ฑ E.g., this can be the loss

๏ฎ Our goal is to compute a partial derivatives ๐œ•๐œ•๐‘ข๐‘ข๐œ•๐œ•๐‘ข๐‘ข(๐‘›๐‘›)(๐‘–๐‘–) for all ๐‘–๐‘– โˆˆ {1,2, โ€ฆ , ๐‘›๐‘›๐‘–๐‘–} where ๐‘ข๐‘ข(1) to ๐‘ข๐‘ข(๐‘›๐‘›๐‘–๐‘–) are the parameters of model

๏ฎ We assume that nodes are ordered such that we compute their outputs one after the other, starting at ๐‘ข๐‘ข(๐‘›๐‘›๐‘–๐‘–+1) and going up to ๐‘ข๐‘ข(๐‘›๐‘›)

๏ฎ Each node ๐‘ข๐‘ข(๐‘–๐‘–) is associated with an operation ๐‘“๐‘“(๐‘–๐‘–) and is

computed by ๐‘ข๐‘ข(๐‘–๐‘–) = ๐‘“๐‘“(๐ด๐ด(๐‘–๐‘–)) where ๐ด๐ด(๐‘–๐‘–) is the set of all parents of ๐‘ข๐‘ข(๐‘–๐‘–)

(8)

Forward Propagation

๏ฎ This procedure performs the computations mapping ๐‘›๐‘›๐‘–๐‘– inputs ๐‘ข๐‘ข(1) to ๐‘ข๐‘ข(๐‘›๐‘›๐‘–๐‘–) to output ๐‘ข๐‘ข(๐‘›๐‘›)

(9)

Back-Propagation

๏ฎ This procedure computes the partial derivatives of ๐‘ข๐‘ข(๐‘›๐‘›) with respect to the variables ๐‘ข๐‘ข(1), โ€ฆ , ๐‘ข๐‘ข(๐‘›๐‘›๐‘–๐‘–)

(10)

Back-Propagation Example

๏ฎ

Back-propagation procedure (re-use blue-colored computation)

๏ฑ Compute ๐œ•๐œ•๐‘ฆ๐‘ฆ๐œ•๐œ•๐‘‘๐‘‘ and ๐œ•๐œ•๐‘‘๐‘‘๐œ•๐œ•๐‘‘๐‘‘

๏ฑ ๐œ•๐œ•๐‘‘๐‘‘

๐œ•๐œ•๐‘ค๐‘ค โ† ๐œ•๐œ•๐‘ค๐‘ค๐œ•๐œ•๐‘ฆ๐‘ฆ ๐œ•๐œ•๐‘ฆ๐‘ฆ๐œ•๐œ•๐‘‘๐‘‘ + ๐œ•๐œ•๐‘ค๐‘ค๐œ•๐œ•๐‘‘๐‘‘ ๐œ•๐œ•๐‘‘๐‘‘๐œ•๐œ•๐‘‘๐‘‘

๏ฑ ๐œ•๐œ•๐‘‘๐‘‘

๐œ•๐œ•๐‘ฃ๐‘ฃ โ† ๐œ•๐œ•๐‘ค๐‘ค๐œ•๐œ•๐‘ฃ๐‘ฃ ๐œ•๐œ•๐‘ค๐‘ค๐œ•๐œ•๐‘‘๐‘‘

v w

y x

z

(11)

Cost of Back-Propagation

๏ฎ The amount of computation scales linearly with the number of edges in the computational graph

๏ฑ Computation for each edge: computing a partial derivative, one multiplication, and one addition

w

y x

z

Compute ๐œ•๐œ•๐‘‘๐‘‘

๐œ•๐œ•๐‘ฆ๐‘ฆ and ๐œ•๐œ•๐‘‘๐‘‘

๐œ•๐œ•๐‘ง๐‘ง ๐œ•๐œ•๐‘‘๐‘‘

๐œ•๐œ•๐‘ค๐‘ค โ†

๐œ•๐œ•๐‘ฆ๐‘ฆ

๐œ•๐œ•๐‘ค๐‘ค

๐œ•๐œ•๐‘ง๐‘ง

๐œ•๐œ•๐‘ฆ๐‘ฆ + ๐œ•๐œ•๐‘ฅ๐‘ฅ

๐œ•๐œ•๐‘ค๐‘ค

๐œ•๐œ•๐‘ง๐‘ง

๐œ•๐œ•๐‘ง๐‘ง ๐œ•๐œ•๐‘ค๐‘ค ๐œ•๐œ•๐‘ง๐‘ง ๐œ•๐œ•๐‘ฅ๐‘ฅ

(12)

Back-Propagation in Fully Connected

๏ฎ Forward propagation

MLP

(13)

Back-Propagation in Fully Connected

๏ฎ Backward computation

MLP

โจ€: element-wise product

(14)

Minibatch Processing

๏ฎ SGD (recap)

๏ฑ We sample a minibatch of examples ๐ต๐ต = {๐‘ฅ๐‘ฅ 1 , โ€ฆ , ๐‘ฅ๐‘ฅ ๐‘š๐‘š๐‘š } drawn uniformly from the training set

๏ฑ The estimate of the gradient is ๐‘”๐‘” = ๐‘š๐‘š๐‘š1 โˆ‘๐‘–๐‘–=1๐‘š๐‘š๐‘š ๐›ป๐›ป๐œƒ๐œƒ๐ฟ๐ฟ(๐‘ฅ๐‘ฅ ๐‘–๐‘– ,๐‘ฆ๐‘ฆ ๐‘–๐‘– ,๐œƒ๐œƒ)

๏ฑ Then the gradient descent is given by ๐œƒ๐œƒ โ† ๐œƒ๐œƒ โˆ’ ๐œ–๐œ–๐‘”๐‘”

๏ฎ SGD using back propagation

๏ฑ For each instance (๐‘ฅ๐‘ฅ(๐‘–๐‘–),๐‘ฆ๐‘ฆ(๐‘–๐‘–)), where i=1~mโ€™, we compute the gradient

๐›ป๐›ป๐œƒ๐œƒ๐œ•๐œ•(๐‘–๐‘–) using back propagation where ๐œ•๐œ•(๐‘–๐‘–) = ๐ฟ๐ฟ(๐‘ฅ๐‘ฅ ๐‘–๐‘– ,๐‘ฆ๐‘ฆ ๐‘–๐‘– ,๐œƒ๐œƒ) is the i-th loss

๏ฑ The final gradient is ๐‘”๐‘” = ๐‘š๐‘š๐‘š1 โˆ‘๐‘–๐‘–=1๐‘š๐‘š๐‘š ๐›ป๐›ป๐œƒ๐œƒ๐œ•๐œ•(๐‘–๐‘–)

๏ฑ Update ๐œƒ๐œƒ โ† ๐œƒ๐œƒ โˆ’ ๐œ–๐œ–๐‘”๐‘”

(15)

Example

๏ฎ A feedforward neural network with one hidden layer

๏ฎ Forward propagation

๏ฑ ๐’‚๐’‚ โ† ๐‘พ๐‘พ๐’™๐’™

๏ฑ ๐’‰๐’‰ โ† ๐ˆ๐ˆ(๐’‚๐’‚) (elementwise)

๏ฑ ๏ฟฝ๐’š๐’š โ† ๐’—๐’—๐‘‡๐‘‡๐’‰๐’‰

๏ฑ ๐‘ฑ๐‘ฑ โ† ๐ฟ๐ฟ ๏ฟฝ๐’š๐’š,๐’š๐’š + ๐œ†๐œ†๐œ†๐œ† ๐‘พ๐‘พ,๐’—๐’— = (๏ฟฝ๐’š๐’š โˆ’ ๐’š๐’š)๐Ÿ๐Ÿ+๐œ†๐œ†( ๐‘พ๐‘พ ๐น๐น2 + ๐’—๐’— 22)

๐’‰๐’‰ ๐’—๐’—

(16)

Example

๏ฎ Back propagation

๏ฑ ๐‘”๐‘” โ† ๐›ป๐›ป๏ฟฝ๐‘ฆ๐‘ฆ๐œ•๐œ• = 2 ๏ฟฝ๐‘ฆ๐‘ฆ โˆ’ ๐‘ฆ๐‘ฆ

๏ฑ ๐›ป๐›ป๐’—๐’—๐œ•๐œ• โ† ๐›ป๐›ป๐’—๐’—[ ๏ฟฝ๐‘ฆ๐‘ฆ โˆ’ ๐‘ฆ๐‘ฆ 2 + ๐œ†๐œ† ๐‘พ๐‘พ ๐น๐น2 + ๐’—๐’— 22 ] = ๐‘”๐‘”๐’‰๐’‰ + 2๐œ†๐œ†๐’—๐’—

๏ฑ ๐’ˆ๐’ˆ โ† ๐›ป๐›ป๐’‰๐’‰๐œ•๐œ• = ๐›ป๐›ป๐’‰๐’‰[ ๏ฟฝ๐‘ฆ๐‘ฆ โˆ’ ๐‘ฆ๐‘ฆ 2 + ๐œ†๐œ† ๐‘พ๐‘พ ๐น๐น2 + ๐’—๐’— 22 ] = ๐‘”๐‘”๐’—๐’—

๏ฑ ๐’ˆ๐’ˆ โ† ๐›ป๐›ป๐’‚๐’‚๐œ•๐œ• = ๐’ˆ๐’ˆ โจ€ ๐œŽ๐œŽ๐œŽ(๐’‚๐’‚) (elementwise)

๏ฑ ๐›ป๐›ป๐‘พ๐‘พ๐œ•๐œ• โ† ๐›ป๐›ป๐‘พ๐‘พ[ ๏ฟฝ๐‘ฆ๐‘ฆ โˆ’ ๐‘ฆ๐‘ฆ 2 + ๐œ†๐œ† ๐‘พ๐‘พ ๐น๐น2 + ๐’—๐’— 22 ] = ๐’ˆ๐’ˆ๐’™๐’™๐‘‡๐‘‡ + 2๐œ†๐œ†๐‘พ๐‘พ

๐’™๐’™ ๐’‰๐’‰ ๐’‚๐’‚

๐‘พ๐‘พ ๐’—๐’—

(17)

Higher-Order Derivatives

๏ฎ Some software frameworks (e.g., Theano and Tensorflow) support the use of higher-order derivatives

๏ฎ Hessian is useful for optimizing parameters.

๏ฑ For a function ๐‘“๐‘“:๐‘…๐‘…๐‘›๐‘› โ†’ ๐‘…๐‘…, the Hessian matrix is n x n matrix

๏ฑ In deep learning, n is the number of parameters which can be millions or billions; thus constructing entire Hessian is intractable

๏ฑ The typical deep learning approach to compute a function of Hessian is to use Krylov methods: a set of iterative techniques for inverting a matrix or computing eigenvectors using only matrix-vector products

๏ฑ Hessian-vector product can be computed efficiently by

(18)

What you need to know

๏ฎ

Backpropagation is an algorithm to compute partial derivatives efficiently in neural

networks

๏ฑ

Reuse partial derivatives

๏ฎ

Procedure of backpropagation

๏ฎ

Use of backpropagation in SGD

(19)

Questions?

Referensi

Dokumen terkait

; bn so that the sum of squared errors is the smallest (minimum). The most powerful and mathematically mature data analysis method, multiple linear regression is focused on a

The integration of TensorFlow and Apache Spark with TensorFrames allows data scientists to expand their analytics, streaming, graph, and machine learning capabilities to include

Thatโ€™s why this book is a great addition to the Addison-Wesley Data & Analytics series; it provides a broad overview of tools, techniques, and helpful tips for building large

ยฉDaffodil International University 17 CHAPTER 5 SUMMARY, CONCLUSION, RECOMMENDATION AND IMPLICATION FOR FUTURE RESEARCH 5.1 Summary In this work, we proposed a straight

Table 1 - Overview f Task Offloading Techniques In DL Author Name Year Technique used Merits Demerits Ramana, 2022 iTOA algorithm Efficient workload distribution

This research used data mining classification technique in order to predict academic performance that focus on Decision Tree and Naรฏve Bayes algorithm.. The goal was to propose a

In this paper, we have proposed a novel approach using a deep learning model integrated with a knowledge graph for the surveillance monitoring system to be activated to confirm human

Muhammad Faqih Ahkam, Ayi Tarya | http://devotion.greenvest.co.id 2343 Graph 3 Monthly Climatologic Fluctuations of Sea Surface CO2 Partial Pressure with Temperature and Chlorophyll