반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

Elements of AI - Advanced neural network techniques

2018. 6. 25. 04:12 | Posted by 솔웅


반응형

Elements of AI





III.Advanced neural network techniques





In the previous section, we have discussed the basic ideas behind most neural network methods: multilayer networks, non-linear activation functions, and learning rules such as the backpropagation algorithm.


이전 섹션에서는 neural network 방법의 기본 아이디어 인 multilayer networks, non-linear activation functions 및 backpropagation algorithm 과 같은 것들을 알아 보았습니다.




They power almost all modern neural network applications. However, there are some interesting and powerful variations of the theme that have lead to great advances in deep learning in many areas.


그들은 거의 모든 modern neural network applications을 지원합니다. 그것과 관련해 흥미롭고 강력한 여러 다양한 변형들이 나타남으로서 많은 분야에서 deep learning의 큰 진보를 이끌었습니다. 





Convolutional neural networks (CNNs)


One area where deep learning has achieved spectacular success is image processing. The simple classifier that we studied in detail in the previous section is severely limited – as you noticed it wasn't even possible to classify all the smiley faces correctly. By adding more layers in the network and using backpropagation to learn the weights does in principle solve the problem, but another one emerges: the number of weights becomes extremely large and consequently, the amount of training data required to achieve satisfactory accuracy can become too large to be realistic.



deep learning이 큰 성공을 거둔 분야 중 하나는 image processing 분야 입니다. 이전 섹션에서 자세히 공부 한 simple classifier는 굉장히 제한적입니다. 여러분도 모든 웃는 얼굴을 올바르게 분류 할 수는 없다는 것을 눈치 채셨을 겁니다. 네트워크에 더 많은 레이어를 추가하고 backpropagation을 사용하여 weights를 학습하면 원칙적으로 문제가 해결되지만, weights 수가 극도로 커지고 결과적으로 만족할만한 정확도를 달성하는 데 필요한 교육 데이터의 양이 구현하기에는 너무 커질 수 있습니다.



Fortunately, a very elegant solution to the problem of too many weights exists: a special kind of neural networks, or rather, a special kind of layer that can be included in a deep neural network. This special kind of layer is a so called convolutional layer. Networks including convolutional layers are called convolutional neural networks (CNNs). Their key property is that they can detect image features such as bright or dark (or specific color) spots, edges in various orientations, patterns, and so on. These form the basis for detecting more abstract features such as a cat’s ears, a dog’s snout, a person’s eye, or the octagonal shape of a stop sign. It would normally be hard to train a neural network to detect such features based on the pixels of the input image, because the features can appear in different positions, different orientations, and in different sizes in the image: moving the object or the camera angle will change the pixel values dramatically even if the object itself looks just the same to us. In order to learn to detect a stop sign in all these different conditions would require vast of amounts of training data because the network would only detect the sign in conditions where it has appeared in the training data. So, for example, a stop sign in the top right corner of the image would be detected only if the training data included an image with the stop sign in the top right corner. CNNs can recognize the object anywhere in the image no matter where it has been observed in the training images.



다행스럽게도, 너무 많은 weights 문제에 대한 매우 우아한 해결책이 있습니다. 특수한 종류의 neural networks 또는 심층 신경 네트워크에 포함될 수있는 특별한 종류의 계층이 있습니다. 이 특별한 종류의 레이어는 소위 convolutional layer입니다. convolutional 계층을 포함한 네트워크를 convolutional neural networks, CNN 이라고합니다. 그들의 핵심 속성은 밝거나 어두운 (또는 특정 색) 반점, 다양한 방향의 모서리, 패턴 등과 같은 이미지 피처를 감지 할 수 있다는 것입니다. 이들은 고양이의 귀, 개 주둥이, 사람의 눈 또는 정지 신호의 팔각형 모양과 같은 보다 추상적 인 특징을 탐지하기 위한 기초를 형성합니다. 피쳐가 다른 위치, 다른 방향 및 이미지의 다른 크기로 나타날 수 있기 때문에 일반적으로 입력 이미지의 픽셀을 기반으로 이러한 피쳐를 감지하도록 neural networks을 학습하는 것이 어려울 것입니다. 객체 또는 카메라 각도 이동 객체 자체가 우리에게 똑같이 보일지라도 픽셀 값을 극적으로 바꿀 것입니다. 이러한 모든 조건에서 정지 신호를 감지하는 것을 배우려면 네트워크가 교육 데이터에 나타난 징후 만 감지하기 때문에 엄청난 양의 교육 데이터가 필요합니다. 따라서 예를 들어, 오른쪽 상단 모서리에 정지 신호가 있는 이미지가 교육 데이터에 포함 된 경우에만 이미지 오른쪽 상단의 정지 신호가 감지됩니다. CNN은 트레이닝 이미지에서 관찰 된 위치에 관계없이 이미지의 어느 곳에서나 오브젝트를 인식 할 수 있습니다.




AWS DeepLens - Deep learning enabled video camera for developers


아마존 AWS DeepLens는 Deep learning을 배울 수 있는 개발자용 비디오 카메라 입니다.
2018년 6월부터 판매하고 있습니다. 구매를 원하시면 위 이미지 링크를 클릭하세요.




Note

Why we need CNNs

CNNs use a clever trick to reduce the amount of training data required to detect objects in different conditions. The trick basically amounts to using the same input weights for many neurons — so that all of these neurons are activated by the same pattern — but with different input pixels. We can for example have a set of neurons that are activated by a cat’s pointy ear. When the input is a photo of a cat, two neurons are activated, one for the left ear and another for the right. We can also let the neuron’s input pixels be taken from a smaller or a larger area, so that different neurons are activated by the ear appearing in different scales (sizes), so that we can detect a small cat's ears even if the training data only included images of big cats.


CNN은 다른 조건에서 개체를 탐지하는 데 필요한 교육 데이터의 양을 줄이기 위해 영리한 트릭을 사용합니다. 트릭은 기본적으로 많은 뉴런에 대해 동일한 입력 가중치를 사용하므로 모든 뉴런이 동일한 패턴으로 활성화되지만 입력 픽셀은 다릅니다. 우리는 예를 들어 고양이의 뾰족한 귀로 활성화되는 일련의 뉴런을 가질 수 있습니다. 입력 사진이 고양이의 사진 인 경우 두 개의 뉴런이 활성화됩니다. 하나는 왼쪽 귀에, 다른 하나는 오른쪽에 활성화됩니다. 또한 뉴런의 입력 픽셀을 작거나 큰 영역에서 가져 와서 다른 뉴런이 다른 크기 (크기)로 나타나는 귀에 의해 활성화되도록하여 훈련 데이터만으로도 작은 고양이의 귀를 감지 할 수 있습니다 큰 고양이의 이미지가 포함되어 있습니다.



The convolutional neurons are typically placed in the bottom layers of the network, which processes the raw input pixels. Basic neurons (like the perceptron neuron discussed above) are placed in the higher layers, which process the output of the bottom layers. The bottom layers can usually be trained using unsupervised learning, without a particular prediction task in mind. Their weights will be tuned to detect features that appear frequently in the input data. Thus, with photos of animals, typical features will be ears and snouts, whereas in images of buildings, the features are architectural components such as walls, roofs, windows, and so on. If a mix of various objects and scenes is used as the input data, then the features learned by the bottom layers will be more or less generic. This means that pre-trained convolutional layers can be reused in many different image processing tasks. This is extremely important since it is easy to get virtually unlimited amounts of unlabeled training data - images without labels - which can be used to train the bottom layers. The top layers are always trained by supervised machine learning techniques such as backpropagation.



convolutional neurons은 일반적으로 raw input 픽셀을 처리하는 네트워크의 맨 아래 계층에 배치됩니다. 위에서 언급 한 퍼셉트론 뉴런과 같은 기본 뉴런은 상위 계층에 배치되며 하위 계층의 출력을 처리합니다. 맨 아래 계층은 일반적으로 특정 예측 작업을 염두에 두지 않고 unsupervised learning을 사용하여 학습 할 수 있습니다. weights는 입력 데이터에 자주 나타나는 피쳐를 감지하도록 조정됩니다. 따라서 동물의 사진과 함께 전형적인 특징은 귀와 주둥이 일 것이고 건물의 이미지에서는 벽, 지붕, 창 등과 같은 건축 적 구성 요소입니다. 다양한 오브젝트와 장면의 혼합이 입력 데이터로 사용되면 하단 레이어에서 학습 한 기능이 다소 일반적인 것입니다. 이것은 미리 훈련 된 convolutional 레이어가 많은 다른 이미지 처리 작업에서 재사용 될 수 있음을 의미합니다. 분류되지 않은 교육 데이터 (레이블이없는 이미지)를 사실상 무제한으로 쉽게 얻을 수 있기 때문에 이는 매우 중요합니다.이 이미지는 맨 아래 계층을 교육하는 데 사용할 수 있습니다. 최상위 레이어는 항상 역 전파와 같은 supervised machine learning 기술에 의해 교육됩니다.





Do neural networks dream of electric sheep? Generative adversarial networks (GANs)


Having learned a neural network from data, it can be used for prediction. Since the top layers of the network have been trained in a supervised manner to perform a particular classification or prediction task, the top layers are really useful only for that task. A network trained to detect stop signs is useless for detecting handwritten digits or cats.



데이터로부터 neural network를 학습하면 prediction에 사용할 수 있습니다. 네트워크의 최상위 계층이 특정 분류 또는 예측 작업을 수행하기 위해 supervised manner로 교육 되었기 때문에 최상위 계층은 해당 작업에만 유용합니다. 정지 신호를 탐지하도록 훈련 된 네트워크는 handwritten digits 나 고양이를 탐지하는 데 쓸모가 없습니다.



A fascinating result is obtained by taking the pre-trained bottom layers and studying what the features they have learned look like. This can be achieved by generating images that activate a certain set neurons in the bottom layers. Looking at the generated images, we can see what the neural network “thinks” a particular feature looks like, or what an image with a select set of features in it would look like. Some even like to talk about the networks “dreaming” or “hallucinating” images (see Google’s DeepDream system).



매혹적인 결과는 사전 훈련 된 최하층을 취하고 그들이 배운 기능이 어떻게 생겼는지 연구함으로써 얻을 수 있습니다. 이것은 최하위 계층에서 특정 set neurons을 활성화하는 이미지를 생성하여 얻을 수 있습니다. 생성 된 이미지를 살펴보면, 신경망이 특정 기능을 어떻게 보는지, 또는 특정 기능 세트가 있는 이미지가 어떤 모습인지를 알 수 있습니다. 일부는 심지어 "꿈꾸는 dreaming"또는 "환각적인 hallucinating" 이미지 (Google의 DeepDream 시스템 참조)에 대해 이야기하기를 좋아합니다.



Note

Be careful with metaphors

However, we’d like to once again emphasize the problem with metaphors such as dreaming when simple optimization of the input image is meant — remember the suitcase words discussed in Chapter 1. The neural network doesn’t really dream, and it doesn’t have a concept of a cat that it would understand in a similar sense as a human understands. It is simply trained to recognize objects and it can generate images that are similar to the input data that it is trained on.


그러나 우리는 입력 이미지의 단순한 optimization이 의미하는 은유적인 문제가 의미하는 것을 다시한번 강조하고자 합니다. 1 장에서 논의 된 suitcase 단어를 생각해 보세요. neural network은 실제로 꿈도 꾸지도 못합니다. 인간이 이해하는 것과 비슷한 의미로 이해할 수있는 고양이 개념을 가지고 있지 않습니다. 그것은 단순히 물체를 인식하도록 훈련되었으며 훈련 된 입력 데이터와 유사한 이미지를 생성 할 수 있습니다.





To actually generate real looking cats, human faces, or other objects (you’ll get whatever you used as the training data), Ian Goodfellow who currently works at Google Brain, proposed a clever combination of two neural networks. The idea is to let the two networks compete against each other. One of the networks is trained to generate images like the ones in the training data. The other network’s task is to separate images generated by the first network from real images from the training data — it is called the adversarial network, and the whole system is called generative adversarial network or a GAN.



진짜로 보이는 고양이, 인간의 얼굴 또는 다른 객체 (당신이 훈련 데이터로 사용한 것은 무엇이든지)를 생성하기 위해, 현재 Google Brain에서 일하고있는 Ian Goodfellow는 두 개의 신경 네트워크를 영리하게 조합 할 것을 제안했습니다. 아이디어는 두 네트워크가 서로 경쟁하게 하는 것입니다. 네트워크 중 하나는 training data에 있는 것과 같은 이미지를 생성하도록 교육되었습니다. 다른 네트워크의 임무는 첫 번째 네트워크에서 생성 된 이미지를 훈련 데이터의 실제 이미지와 분리하는 것입니다.이 이미지를 adversarial network라고 하며, 전체 시스템을 generative adversarial network 또는 GAN이라고합니다.



The system trains the two models side by side. In the beginning of the training, the adversarial model has an easy task to tell apart the real images from the training data and the clumsy attempts by the generative model. However, as the generative network slowly gets better and better, the adversarial model has to improve as well, and the cycle continues until eventually the generated images are almost indistinguishable from real ones. The GAN tries to not only reproduce the images in the training data: that would be a way too simple strategy to beat the adversarial network. Rather, the system is trained so that it has to be able to generate new, real-looking images too.



이 시스템은 두 모델을 나란히 훈련시킵니다. 훈련이 시작될 때, adversarial 모델은 훈련 데이터로부터 실제 이미지를 분리하고 생성 모델에 의한 서투른 (clumsy) 시도를 쉽게 구분할 수 있습니다. 그러나 generative 네트워크가 서서히 향상되면서 adversarial 모델도 개선되어야 하고 결국 생성 된 이미지가 실제 이미지와 거의 구별되지 않을 때까지 사이클이 계속됩니다. GAN은 훈련 데이터에서 이미지를 재현하는 것뿐만 아니라 adversarial 네트워크를 이길 수 있는 간단한 전략이기도합니다. 오히려 시스템은 새로운 실제 이미지를 생성 할 수 있도록 훈련되어 있습니다.






The above images were generated by a GAN developed by NVIDIA in a project led by Prof Jaakko Lehtinen (see this article for more details).

Could you have recognized them as fakes?



위 이미지는 Jaakko Lehtinen 교수가 이끄는 프로젝트에서 NVIDIA가 개발 한 GAN에 의해 생성되었습니다 (자세한 내용은이 기사 참조).


여러분은 이게 가짜인지 알아 차리실 수 있습니까?






After completing Chapter 5 you should be able to:

  • Explain what a neural network is and where they are being successfully used
  • Understand the technical methods that underpin neural networks




반응형

Elements of AI - How neural networks are built

2018. 6. 25. 00:30 | Posted by 솔웅


반응형



Elements of AI



II.How neural networks are built





As we said earlier, neurons are very simple processing units. Having discussed linear and logistic regression in Chapter 4, the essential technical details of neural networks can be seen as slight variations of the same idea.


앞서 말했듯이 뉴런은 매우 간단한 처리 단위입니다. 4 장에서 선형 및 로지스틱 회귀에 대해 배웠습니다., 신경망(neural networks)의 핵심 기술의 세부 사항은 그것들과 같은 아이디어에서 약간의 변형을 한 것일 뿐이라는 것을 아시게 될 겁니다.




Note

Weights and inputs

The basic artificial neuron model involves a set of adaptive parameters, called weights like in linear and logistic regression. Just like in regression, these weights are used as multipliers on the inputs of the neuron, which are added up. The sum of the weights times the inputs is called the linear combination of the inputs. You can probably recall the shopping bill analogy: you multiply the amount of each item by its price per unit and add up to get the total.


기본 artificial neuron 모델은 linear 및 logistic regression에서 사용되는 weights 라고하는 adaptive parameters의 세트를 포함합니다. regression와 마찬가지로, 이러한 weights는 더 해지는 뉴런의 입력에 승수로 사용됩니다. weights에 입력 값을 곱한 값의 합을 linear combination이라고합니다. 우리는 shopping bill analogy를 떠 올릴 수 있습니다. 각 항목당 가격에 그 갯수를 곱한 다음 그것들을 합하여 청구금액을 구했습니다. 





If we have a neuron with six inputs (analogous to the amounts of the six shopping items: potatoes, carrots, and so on), input1, input2, input3, input4, input5, and input6, we also need six weights. The weights are analogous to the prices of the items. We’ll call them weight1, weight2, weight3, weight4, weight5, and weight6. In addition, we’ll usually want to include an intercept term like we did in linear regression. This can be thought of as a fixed additional charge due to processing a credit card payment, for example.



우리가 여섯 개의 입력에 한개의 뉴런을 가지고 있다고 합시다. (6개의 쇼핑 아이템들의 amounts와 유사합니다: 감자, 당근 등등), input1, input2, input3, input4, input5 및 input6과 같은 여섯 개의 입력을 갖는 뉴런을 가지고 있다면 여섯 개의 weights도 필요합니다. weights는 품목 가격과 유사합니다. 우리는 그것을 weight1, weight2, weight3, weight4, weight5 및 weight6이라고합니다. 또한 linear regression에서 했던것과 같은 intercept term을 포함하기를 원합니다. 이것은 예를 들어 신용 카드 지불 처리로 인해 생기는 고정 된 추가 비용이라고 생각할 수 있습니다.




We can then calculate the linear combination like this: linear combination = intercept + weight1 × input1 + ... + weight6 × input6 (where the ... is a shorthand notation meaning that the sum include all the terms from 1 to 6).



그 다음 우리는 다음과 같이 linear combination을 계산할 수 있습니다.

linear combination = intercept + weight1 × input1 + ... + weight6 × input6 

(여기서 ...는 합계에 1에서 6까지의 모든 항이 포함되어 있음을 의미하는 약식 표기입니다.)



With some example numbers we could then get:


숫자로 하면 다음과 같이 됩니다.



10.0 + 5.4 × 8 + (-10.2) × 5 + (-0.1) × 22 + 101.4 × (-5) + 0.0 × 2 + 12.0 × (-3) = -543.0




AWS DeepLens - Deep learning enabled video camera for developers

아마존 AWS DeepLens는 Deep learning을 배울 수 있는 개발자용 비디오 카메라 입니다.
2018년 6월부터 판매하고 있습니다. 구매를 원하시면 위 이미지 링크를 클릭하세요.




Exercise 21: Weights and inputs


In this exercise, consider the following expression that has both weights and inputs: 10.0 + 5.4 × 8 + (-10.2) × 5 + (-0.1) × 22 + 101.4 × (-5) + 0.0 × 2 + 12.0 × (-3) = -543.0




What is the intercept term in the expression? 

a) 543.0 

b) 10.0 

c) -3 

d) 5.4?



What are the inputs? 

a) 8, 5, 22, -5, 2, -3 

b) 5.4, 8, -10.2, 5, -0.1, 22, 101.4, -5, 0.0, 2, 12.0, -3 

c) 5.4, -10.2, -0.1, 101.4, 0.0, 12.0 

d) 43.2, -51.0, -2.2, -507.0, 0.0, -36.0



Which of the inputs needs to be changed the least to increase the output by a certain amount? 

a) first 

b) second 

c) third 

d) fourth



What happens when the fifth input is incremented by one? 

a) nothing 

b) the output increases by one 

c) the output increases by two 

d) something else




The weights are almost always learned from data using the same ideas as in linear or logistic regression, as discussed previously. But before we discuss this in more detail, we’ll introduce another important stage that a neuron completes before it sends out an output signal.



weights는 이전에 논의 된 것처럼 linear 또는 logistic regression 에서와 같은 아이디어를 사용하여 거의 항상 데이터로부터 얻어지게 됩니다. 우리가 좀 더 자세한 것들을 논의하기 전에 다른 중요한 stage를 소개해 드릴 겁니다. 그것은 뉴런이 출력 신호를 보내기 전에 완성하게 되는 것입니다.




Activations and outputs


Once the linear combination has been computed, the neuron does one more operation. It takes the linear combination and puts it through a so called activation function. Typical examples of the activation function include:



일단 linear combination이 계산되면, 뉴런은 한 번 더 연산을 수행합니다. linear combination을 취하여 소위 활성화 함수를 통해 전달합니다. activation function의 일반적인 예는 다음과 같습니다.



  • identity function: do nothing and just output the linear combination
  • step function: if the value of the linear combination is greater than zero, send a pulse (ON), otherwise do nothing (OFF)
  • sigmoid function: a “soft” version of the step function


- identity function : 아무것도 하지 않고 선형 조합 만 출력합니다.

- step function : linear combination의 값이 0보다 큰 경우 펄스를 보내고 (ON), 그렇지 않으면 아무 것도 하지 않습니다 (OFF)

- sigmoid function : 스텝 함수의 "soft"버전




Note that with the first activation function, the identity function, the neuron is exactly the same as linear regression. This is why the identity function is rarely used in neural networks: it leads to nothing new and interesting.


첫 번째 activation function 인 identity function의 경우, 뉴런은 linear regression와 정확히 동일합니다. 이것이 identity function이 neural networks에서 거의 사용되지 않는 이유입니다. 그것은 새롭고 흥미로운 것은 없습니다.



Note

How neurons activate

Real, biological neurons communicate by sending out sharp, electrical pulses called “spikes”, so that at any given time, their outgoing signal is either on or off (1 or 0). The step function imitates this behavior. However, artificial neural networks tend to use the second kind of activation functions so that they output a continuous numerical activation level at all times. Thus, to use a somewhat awkward figure of speech, real neurons communicate by something similar to the Morse code, whereas artificial neurons communicate by adjusting the pitch of their voice as if yodeling.


실제, 생물학적 뉴런은 "스파이크 (spikes)"라고하는 날카로운 전기 펄스를 전송함으로써 communicate 합니다. 즉 어떤 주어진 시간에 발신 신호가 켜지거나 꺼지게 됩니다 (1 또는 0). step function는 이 동작을 모방합니다. 그러나 artificial neural은 항상 두 번째 종류의 activation functions을 사용하려고 합니다. 그래서 지속적으로 numerical activation level을 출력합니다. 약간 이상한 표현을 하면 실제 뉴런은 모르스 부호와 비슷한 방식으로 의사 소통하는 반면, 인공 뉴런은 그들의 요괴와 같은 목소리를 조정함으로서 소통을 합니다.




The output of the neuron, determined by the linear combination and the activation function, can be used to extract a prediction or a decision. For example, if the network is designed to identify a stop sign in front of a self-driving car, the input can be the pixels of an image captured by a camera attached in front of the car, and the output can be used to activate a stopping procedure that stops the car before the sign.



linear combination 및 activation function에 의해 결정되는 뉴런의 출력은 예측 또는 결정을 추출하는 데 사용될 수 있습니다. 예를 들어, 그 네트워크가 주율 주행 중인 자동차 앞에서 정지 신호를 식별하도록 설계된 경우, 입력은 자동차 앞쪽에 부착 된 카메라로 캡처 한 이미지의 픽셀 일 수 있으며 출력을 사용하여 표지판 앞에서 차를 멈추는 정지 절차를 실행하게 됩니다.



Learning or adaptation in the network occurs when the weights are adjusted so as to make the network produce the correct outputs, just like in linear or logistic regression. Many neural networks are very large, and the largest contain hundreds of billions of weights. Optimizing them all can be a daunting task that requires massive amounts of computing power.



linear 또는 logistic regression와 마찬가지로 네트워크가 올바른 출력을 생성 할 수 있도록 weights가 조정될 때 네트워크에서의 학습(Learning) 또는 적응(adaptation)이 발생합니다. 많은 neural networks들은 그 규모가 매우 크며, 가장 큰 신경망은 수천억 개의 weights를 포함합니다. 이들 모두를 최적화하는 것은 엄청난 양의 컴퓨팅 능력을 요구하는 어려운 작업 일 수 있습니다.







Exercise 22: Activations and outputs

Below are graphs for three different activation functions with different properties. First we have the sigmoid function, then the step function, and finally the identity function.


다음은 서로 다른 특성을 가진 세 가지 다른 activation functions에 대한 그래프입니다. 먼저 sigmoid functions, step functions, 마지막으로 identity functions를 사용합니다.













Which of the activations described above give: 

the largest output for an input of 5?

Sigmoid

Linear

Step


the smallest output for an input of -5?

Sigmoid

Linear

Step


the largest output for an input of -2.5?

Sigmoid

Linear

Step




Perceptron: the mother of all ANNs


The perceptron is simply a fancy name for the simple neuron model with the step activation function we discussed above. It was among the very first formal models of neural computation and because of its fundamental role in the history of neural networks, it wouldn’t be unfair to call it the “Mother of all Artificial Neural Networks”.



perceptron은 위에서 논의한 step activation function가있는 간단한 뉴런 모델의 멋진 이름입니다. 그것은 neural computation의 최초의 공식 모델 중 하나 였고 신경망의 역사에서 기초가 되는 역할을 하기 때문에 "모든 Artificial Neural Networks의 어머니"라고 부른다고 해서 틀린 말은 아닙니다.



It can be used as a simple classifier in binary classification tasks. A method for learning the weights of the perceptron from data, called the Perceptron algorithm, was introduced by the psychologist Frank Rosenblatt in 1957. We will not study the Perceptron algorithm in detail. Suffice to say that it is just about as simple as the nearest neighbor classifier. The basic principle is to feed the network training data one example at a time. Each misclassification leads to an update in the weight.



이진 분류(binary classification) 작업에서 간단한 classifier로 사용될 수 있습니다. 퍼셉트론 (Perceptron) 알고리즘이라고 불리는 데이터로부터 퍼셉트론의 가중치를 학습하는 방법은 1957 년 심리학자 Frank Rosenblatt에 의해 도입되었습니다. 우리는 Perceptron 알고리즘을 자세히 연구하지는 않을 것입니다. 그것이 nearest neighbor classifier만큼이나 간단하다고 말할 수 있습니다. 기본 원리는 한 번에 한 가지 예를 들어 네트워크 교육 데이터를 제공하는 것입니다. 각 misclassification에 대해서는 weight가 업데이트됩니다.




Note

AI hyperbole

After its discovery, the Perceptron algorithm received a lot of attention, not least because of optimistic statements made by its inventor, Frank Rosenblatt. A classic example of AI hyperbole is a New York Times article published on July 8th, 1958:
“The Navy revealed the embryo of an electronic computer today that it expects will be able to walk, talk, see, reproduce itself and be conscious of its existence.”

Please note that neural network enthusiasts are not at all the only ones inclined towards optimism. The rise and fall of the logic-based expert systems approach to AI had all the same hallmark features of an AI-hype and people claimed that the final breakthrough is just a short while away. The outcome both in the early 1960s and late 1980s was a collapse in the research funding called an AI Winter.


Perceptron 알고리즘을 발견 한 후 이는 많은 주목을 받았는데, 그 이유는 적어도 발명자 인 Frank Rosenblatt가 말한 낙관적 인 진술(optimistic statements) 때문이었습니다. AI hyperbole의 고전적인 예는 1958 년 7 월 8 일에 출판 된 New York Times의 기사입니다.

"해군은 오늘 전자 컴퓨터의 배아가 걸을 수 있고, 말하고,보고, 복제하고, 존재를 의식 할 수있을 것으로 기대한다고 밝혔다.


신경망 애호가가 낙관적 인 경향이있는 것은 아닙니다. AI에 대한 logic-based expert systems 접근법의 인기 상승과 하락은 AI-hype(과장된 AI)의 그것과 거의 같이 갔습니다. 사람들은 최종 목표 지점이 얼마 안 남았다고 주장했죠. 1960 년대 초반과 1980 년대 후반의 두 접근법이 보여준 결과는 AI Winter라고하는 연구 기금의 붕괴였다.




The history of the debate that eventually lead to almost complete abandoning of the neural network approach in the 1960s for more than two decades is extremely fascinating. The article A Sociological Study of the Official History of the Perceptrons Controversy by Mikel Olazaran (published in Social Studies of Science, 1996) reviews the events from a sociology of science point of view. Reading it today is quite thought provoking. Reading stories about celebrated AI heroes who had developed neural networks algorithms that would soon reach the level of human intelligence and become self-conscious can be compared to some statements made during the current hype. If you take a look at the above article, even if you wouldn't read all of it, it will provide an interesting background to today's news. Consider for example an article in the MIT Technology Review published in September 2017, where Jordan Jacobs, co-founder of a multimillion dollar Vector institute for AI compares Geoffrey Hinton (a figure-head of the current deep learning boom) to Einstein because of his contributions to development of neural network algorithms in the 1980s and later. Also recall the Human Brain project mentioned in the previous section.



결국 20 년 넘게 계속된 1960 년대식 neural network 접근법이 완전히 포기하게 되는 과정의 논쟁은 아주 많이 흥미롭습니다. 미켈 올 라자 란 (Mikel Olazaran)의 퍼셉트론 논란 (Perceptrons Controversy)의 공식 역사에 관한 사회 학적 연구 (1996 년 사회학 출판)는 과학적 관점에서 사회학의 사건을 검토합니다. 오늘 그것을 읽는 것은 상당히 자극적이라고 생각합니다. 곧 인간 지능 수준에 도달하고 자의식이되는 신경 회로망 알고리즘을 개발 한 유명한 AI 영웅에 관한 이야기를 읽는 것은 현재 과대 광고 중에 작성된 일부 표현과 비교할 수 있습니다. 위의 기사를 살펴보면 모든 기사를 읽지 않더라도 오늘의 뉴스에 흥미로운 배경을 제공합니다. 예를 들어, 2017 년 9 월에 발표 된 MIT Technology Review의 기사에서 인공 지능을 위한 수백만 달러짜리 벡터 neural network 알고리즘의 개발에 공헌한 정도를 아인슈타인과 비교하기도 합니다. 이전 섹션에서 언급 한 Human Brain 프로젝트를 상기 해보십시오.



According to Hinton, “the fact that it doesn’t work is just a temporary annoyance.” (Although according to the article, Hinton is laughing about the above statement, so it's hard to tell how serious he is about it.) The Human Brain project claims to be “close to a profound leap in our understanding of consciousness“. Doesn't that sound familiar?



Hinton에 따르면, "그것이 제대로 작동하지 않는다는 팩트는 그냥 일시적인 불편함일 뿐이다."(기사에 따르면 Hinton은 위의 문장에 대해 웃음을 짓고 있지만 그가 얼마나 그것에 대해 serious 했는지에 대해서는 자세하 알 수 없습니다.) The uman Brain 프로젝트는 "의식에 대한 우리의 이해에 있어 중대한 도약에 가깝다"고 주장합니다. 왠지 그 표현이 귀에 익숙하지 않으세요?



No-one really knows the future with certainty, but knowing the track record of earlier annoucements of imminent breakthroughs, some critical thinking is advised. We'll return to the future of AI in the final Chapter, but for now, let's see how artificial neural networks are built.


아무도 확실하게 미래를 알지 못하지만, 그것을 해결하기 위해 연구한 이전에 발표 들을 따라가다 보면 더 낳은 어떤 중요한(비판적인) 생각들을 할 수 있습니다.  우리는 마지막 장에서 인공 지능의 미래로 돌아갈 것이지만, 지금은 인공 신경 네트워크가 어떻게 만들어 지는지 보도록하겠습니다.




Putting neurons together: networks



A single neuron would be way too simple to make decisions and prediction reliably in most real-life applications. To unleash the full potential of neural networks, we can use the the output of one neuron as the input of other neurons, whose outputs can be the input to yet other neurons, and so on. The output of the whole network is obtained as the output of a certain subset of the neurons, which are called the output layer. We’ll return to this in a bit, after we discussed the way neural networks adapt to produce different behaviors by learning their parameters from data.



하나의 뉴런은 대부분의 실제 애플리케이션에서 안정적으로 의사 결정과 예측을 내리기에는 너무 단순합니다. 신경 네트워크의 모든 잠재력을 발휘하기 위해 우리는 한 뉴런의 출력을 다른 뉴런의 입력으로 사용할 수 있으며 그 출력은 다른 뉴런에 대한 입력이 될 수 있어야 합니다. 전체 네트워크의 출력은 출력 레이어라고하는 뉴런의 특정 하위 집합의 출력으로 얻어집니다. 우리는 신경 네트워크가 데이터로부터 매개 변수를 학습함으로써 다른 행동을 생산하는 방식에 대해 논의한 후에 이 부분으로 조금 돌아가 보겠습니다.



Key terminology

Layers

Often the network architecture is composed of layers. The input layer consists of neurons that get their inputs directly from the data. So for example, in an image recognition task, the input layer would use the pixel values of the input image as the inputs of the input layer. The network typically also has hidden layers that use the other neurons´ outputs as their input, and whose output is used as the input to other layers of neurons. Finally, the output layer produces the output of the whole network. All the neurons on a given layer get inputs from neurons on the previous layer and feed their output to the next.


종종 네트워크 아키텍처는 레이어로 구성됩니다. 입력 레이어는 데이터에서 직접 입력을받는 뉴런으로 구성됩니다. 예를 들어 이미지 인식 작업에서 입력 레이어는 입력 이미지의 픽셀 값을 입력 레이어의 입력으로 사용합니다. 네트워크는 일반적으로 입력으로 다른 뉴런의 출력을 사용하는 숨겨진 레이어가 있으며, 출력은 뉴런의 다른 레이어에 대한 입력으로 사용됩니다. 마지막으로 출력 레이어는 전체 네트워크의 출력을 생성합니다. 주어진 레이어의 모든 뉴런은 이전 레이어의 뉴런에서 입력을 받아 다음 레이어로 출력합니다.




A classical example of a multilayer network is the so called multilayer perceptron. As we discussed above, Rosenblatt’s Perceptron algorithm can be used to learn the weights of a perceptron. For multilayer perceptron, the corresponding learning problem is way harder and it took a long time before a working solution was discovered. But eventually, one was invented: the so called backpropagation algorithm lead to a revival of neural networks in the late 1980s. It is still at the heart of many of the most advanced deep learning solutions.



다층 네트워크의 고전적인 예는 소위 다층 퍼셉트론 (multilayer perceptron)이라고 합니다. 위에서 언급했듯이 Rosenblatt의 Perceptron 알고리즘을 사용하여 퍼셉트론의 weights를 학습 할 수 있습니다. 다층 퍼셉트론의 경우, 해당 학습 문제가 더욱 어렵습니다. 그 작업의 솔루션을 발견하기까지는 더 많은 시간이 걸릴겁니다. 그러나 결과적으로, 하나는 발명되었습니다. : 소위 역 전파 알고리즘은 1980 년대 후반에 신경 회로망을 부활시키게 됩니다. 그것은 여전히 가장 진보 된 많은 deep learning 솔루션의 핵심입니다.



Note

Meanwhile in Helsinki...

The path(s) leading to the backpropagation algorithm are rather long and winding. An interesting part of the history is related to the computer science department of the University of Helsinki. About three years after the founding of the department in 1967, a Master’s thesis was written by a student called Seppo Linnainmaa. The topic of the thesis was “Cumulative rounding error of algorithms as a Taylor approximation of individual rounding errors” (the thesis was written in Finnish, so this is a translation of the actual title “Algoritmin kumulatiivinen pyöristysvirhe yksittäisten pyöristysvirheiden Taylor-kehitelmänä”).

The automatic differentiation method developed in the thesis was later applied by other researchers to quantify the sensitivity of the output of a multilayer neural network with respect to the individual weights, which is the key idea in backpropagation.


backpropagation 알고리즘으로 이끄는 길은 다소 길며 어려움이 있습니다. 그 역사에서 흥미로운 부분은 헬싱키 대학의 컴퓨터 과학과 관련되어 있습니다. 1967 년에 학과가 창립 된 지 약 3 년 후, Seppo Linnainmaa라는 학생이 석사 논문을 썼습니다. 이 논문의 주제는 "Cumulative rounding error of algorithms as a Taylor approximation of individual rounding errors" (논문은 핀란드어로 작성되었으므로 실제 제목 인 "Algoritmin kumulatiivinen pyöristysvirhe yksittäist pyöristysvirheiden Taylor-kehitelmänä"번역본)입니다.


이 논문에서 개발 된 자동 차별화 (automatic differentiation) 방법은 다른 연구원에 의해 나중에 역 전파에서 핵심 아이디어 인 개별 가중치에 대한 다층 신경망 출력의 민감도를 정량화하기 위해 적용되었습니다.



A simple neural network classifier


To give a relatively simple example of using a neural network classifier, we'll consider a task that is very similar to the MNIST digit recognition task, namely classifying images in two classes. We will first create a classifier to classify whether an image shows a cross (x) or a circle (o). Our images are represented here as pixels that are either colored or white, and the pixels are arranged in 5 × 5 grid. In this format our images of a cross and a circle (more like a diamond, to be honest) look like this:


neural network classifier를 사용하는 비교적 간단한 예제를 제공하기 위해, 우리는 MNIST digit recognition 태스크와 매우 유사한 태스크, 즉 2 개의 클래스로 이미지를 분류하는 태스크를 살펴 볼 겁니다. 먼저 이미지에 가위 표시 (x) 또는 원 (o) 표시 여부를 분류하는 분류자(classifier)를 만듭니다. 우리의 이미지는 여기에 색깔이 있거나 흰색 인 픽셀로 표현되며 픽셀은 5x5 격자로 배열됩니다. 이 형식에서는 가위표시와 원 (솔직히 다이아몬드와 더 비슷합니다.)의 이미지가 다음과 같이 보입니다.






In order to build a neural network classifier, we need to formalise the problem in a way where we can solve it using the methods we have learned. Our first step is to represent the information in the pixels by a numerical values that can be used as the input to a classifier. Let's use 1 if the square is colored, and 0 if it is white. Note that although the symbols in the above graphic are of different color (green and blue), our classifier will ignore the color information and use only the colored/white information. The 25 pixels in the image make the inputs of our classifier.



neural network classifier를 만들기 위해서는 우리가 배운 방법을 사용하여 문제를 공식화해야합니다. 첫 번째 단계는 픽셀의 정보를 분류 기준의 입력으로 사용할 수있는 숫자 값으로 표현하는 것입니다. 사각형에 색이 칠해지면 1을, 흰색이면 0을 사용하기로 하겠습니다. 위의 그림에서는 다른 색상 (녹색 및 파란색)이지만 우리의 classifier는 색상 정보를 무시하고 colored/white 만 사용할 겁니다. 이미지에 있는 25개의 픽셀이 우리의 classifier의 입력을 만듭니다.



To make sure that we know which pixel is which in the numerical representation, we can decide to list the pixels in the same order as you'd read text, so row by row from the top, and reading each row from left to right. The first row of the cross, for example, is represented as 1,0,0,0,1; the second row as 0,1,0,1,0, and so on. The full input for the cross input is then: 1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1.



어떤 픽셀이 어떤 숫자 인지 알기 위해 텍스트를 읽는 순서와 같은 순서로 픽셀을 나열하기 때문에 위쪽에서 행 단위로 정렬하고 각 행을 왼쪽에서 오른쪽으로 읽는 방식으로 결정할 수 있습니다. 예를 들어 십자가의 첫 번째 행은 1,0,0,0,1로 표시됩니다. 두 번째 행은 0,1,0,1,0과 같이 나타납니다. 가위표에 대한 전체 입력은 다음과 같습니다. 1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0, 1,0,0,0,1.



We'll use the basic neuron model where the first step is to compute a linear combination of the inputs. Thus need a weight for each of the input pixels, which means 25 weights in total.


첫 번째 단계는 입력의 linear combination을 계산하는 기본 뉴런 모델을 사용합니다. 따라서 각 입력 픽셀에 대해 weight가 필요합니다. 즉 총 25 개의 weight를 의미합니다.



Finally, we use the step activation function. If the linear combination is negative, the neuron activation is zero, which we decide to use to signify a cross. If the linear combination is positive, the neuron activation is one, which we decide to signify a circle.


마지막으로 step activation function를 사용합니다. linear combination이 음수이면 뉴런 활성화는 0이며 가위표를 나타내는 데 사용하기로 결정합니다. 선형 조합이 양수이면, 뉴런 활성화는 하나이며, 이는 우리가 원을 나타 내기로 결정한 것입니다.



Let's try what happens when all the weights take the same numerical value, 1. With this setup, our linear combination for the cross image will be 9 (9 colored pixels, so 9 × 1, and 16 white pixels, 16 × 0), and for the circle image it will be 8 (8 colored pixels, 8 × 1, and 17 white pixels, 17 × 0). In other words, the linear combination is positive for both images and they are thus classified as circles. Not a very good result given that there are only two images to classify.



모든 weights가 동일한 숫자 값 1을 사용하면 어떻게되는지 시도해 봅시다. 이 설정을 사용하면 가위표 이미지에 대한 선형 조합이 9 (9 colored pixels, so 9 × 1, and 16 white pixels, 16 × 0)가 됩니다. 원 이미지의 경우 8 (8 colored pixels, 8 × 1, and 17 white pixels, 17 × 0)이 됩니다. 즉, linear combination은 두 이미지에 대해 양의 값을 갖기 때문에 원으로 분류됩니다. 분류 할 이미지가 두 개 뿐인 경우 매우 좋은 결과는 아니죠.



To improve the result, we need to adjust the weights in such a way that the linear combination will negative for a cross and positive for a circle. If we think about what differentiates images of crosses and circles, we can see that circles have no colored pixels in the center of the image, whereas crosses do. Likewise, the pixels at the corners of the image are colored in the cross, but white in the circle.



결과를 개선하려면 linear combination이 가위표에 대해 음수이고 원에 대해 양수가되는 방식으로 가중치를 조정해야합니다. 가위표와 원의 이미지를 구별하는 것에 대해 생각해 보면 원은 이미지의 중심에 컬러 픽셀이없고 십자가는 볼 수 있습니다. 마찬가지로 이미지 모서리에있는 픽셀은 십자가에 표시되지만 원에는 흰색으로 표시됩니다.



We can now adjust the weights. There are an infinite number of weights that do the job. For example, assign weight -1 to the center pixel (the 13th pixel), and weight 1 to the pixels in the middle of each of the four sides of the image, letting all the other weights be 0. Now, for the cross input, the center pixel produce the value –1, while for all the other pixels either the pixel value of the weight is 0, so that –1 is also the total value. This leads to activation 0, and the cross is correctly classified.



이제 우리는 weights를 조정할 수 있습니다. 그 일을 하는 무한한 가중치가 있습니다. 예를 들어, 중심 픽셀 (13 번째 픽셀)에 가중치 -1을 할당하고 이미지의 네면의 중간에있는 픽셀에 가중치 1을 할당하여 다른 모든 가중치를 0으로 만듭니다. 이제 교차 입력 중심 픽셀은 값 -1을 생성하지만 다른 모든 픽셀에 대해서는 가중치의 픽셀 값이 0이므로 -1도 총 값입니다. 이로 인해 활성화 0이 발생하고 가위표가 올바르게 분류됩니다.



How about the circle then? Each of the pixels in the middle of the sides produces the value 1, which makes 4 × 1 = 4 in total. For all the other pixels either the pixel value or the weight is zero, so 4 is the total. Since 4 is a positive value, the activation is 1, and the circle is correctly recognized as well.



그럼 원은? 변의 중간에있는 각 픽셀은 값 1을 생성하며, 총 4 × 1 = 4가됩니다. 다른 모든 픽셀의 경우 픽셀 값 또는 가중치가 0이므로 4가 합계입니다. 4가 양수이므로 활성화는 1이며 원이 올바르게 인식됩니다.




Happy or not?


We will now follow similar reasoning to build a classifier for smiley faces. You can assign weights to the input pixels in the image by clicking on them. Clicking once sets the weight to 1, and clicking again sets it to -1. The activation 1 indicates that the image is classified as a happy face, which can be correct or not, while activation –1 indicates that the image is classified as a sad face.


우리는 똑같은 추론(reasoning)을 따라 웃는 얼굴을위한 classifier를 만들 것입니다. 이미지의 입력 픽셀을 클릭하여 weights를 지정할 수 있습니다. 한 번 클릭하면 weights가 1로 설정되고 다시 클릭하면 -1로 설정됩니다. 활성화 1은 이미지가 행복한 얼굴로 분류됨을 나타내며, 활성화 -1은 이미지가 슬픈 얼굴로 분류되었음을 나타냅니다.



Don't be discouraged by the fact that you will not be able to classify all the smiley faces correctly: it is in fact impossible with our simple classifier! This is one important learning objective: sometimes perfect classification just isn't possible because the classifier is too simple. In this case the simple neuron that uses a linear combination of the inputs is too simple for the task. Observe how you can build classifiers that work well in different cases: some classify most of the happy faces correctly while being worse for sad faces, or the other way around.


모든 웃는 얼굴을 정확하게 분류 할 수 없다는 사실로 인해 낙담하지 마십시오. 우리의 간단한 classifier로는 실제로 불가능합니다! 이는 중요한 학습 목표 중 하나입니다. classifier가 너무 간단하기 때문에 완벽한 분류가 불가능한 경우도 있습니다. 이 경우 입력의 선형 조합을 사용하는 단순한 뉴런은 이 작업을 하기에 너무 간단합니다. 다른 경우에 잘 작동하는 classifier를 제작하는 방법을 관찰하십시오. 일부는 행복한 얼굴 대부분을 올바르게 분류하고 슬픈 얼굴이나 그 반대의 경우에도 마찬가지 입니다.



Can you achieve 6/8 correct for both happy and sad faces?







반응형
이전 1 다음