Deep Learning Core Concepts - From Machine Learning Basics to Keras & Optimization (4 Interactive Widgets + 10 Quiz Questions)
① 머신러닝의 기초 → ② 선형회귀·경사하강법 → ③ 퍼셉트론 → ④ MLP·역전파 → ⑤ 학습률·최적화 → ⑥ 퀴즈 10문제
계산기는 그냥 계산기가 아니라 개념을 손으로 체감하는 체험 도구예요. 3분씩만 만져보세요.
① Machine Learning Basics
Traditional programming works by having humans create algorithms and hand them over to computers. Teaching a computer to recognize a dog from a photo by writing out the procedure in code is nearly impossible for a human. Machine learning flips this: you give the system many photos along with the answer "this is a dog," and it figures out the rules on its own.
The name-and-year pairing matters. Arthur Samuel, 1959, IBM checkers program - this combination is the origin of the term "machine learning."
flowchart TD AI[인공지능 AI] --> ML[머신러닝 ML] ML --> DL[딥러닝 DL] ML --> S1[지도학습: 회귀 · 분류] ML --> S2[비지도학습: 군집화 · 차원축소] ML --> S3[강화학습: 가치기반 · 정책기반 · 액터-크리틱]
Just memorize this concept hierarchy. Artificial Intelligence ⊃ Machine Learning ⊃ Deep Learning, and under machine learning there's supervised, unsupervised, and reinforcement learning.
- Supervised learning: Teacher learning with correct answers (labels). If the output is a continuous value, it's regression; if it's divided into classes, it's classification (e.g., dog/cat). Classification algorithm examples: neural networks, kNN, SVM, decision trees
- Unsupervised learning: Classifying without labels (clustering, dimensionality reduction)
- Reinforcement learning: Value-based, policy-based, actor-critic
Three more terms appeared. A feature is an input value useful for distinguishing (e.g., a drink's color, acidity). Data labeling is the human task of attaching correct answers (the famous analogy is "gluing doll eyes from the 21st century"). And training data (for learning) and test data (for evaluation, data the model has never seen) must always be kept separate.
② Linear Regression and Gradient Descent
Regression predicts continuous values (house prices); classification predicts categories. The basic equation for linear regression is f(x) = Wx + b - the slope W is called the weight, and the intercept b is called the bias. One x means simple; multiple x's mean multiple linear regression.
The loss function is the sum of squared errors between the data and the line. Machine learning is essentially about finding the W and b that minimize this loss. Two minimization approaches: for simple regression, use the least squares method from statistics; for complex models, use gradient descent - stepping slightly in the opposite direction of the loss's slope (gradient).
Remember two pitfalls of gradient descent. If the learning rate is too high, it diverges; and it can get stuck in a local minimum.
[Experience 1] Gradient Descent Simulator
This tool lets you run the original code (X=[0,1,2], y=[3,3.5,5.5], W=b=0, η=0.01, 1000 epochs) and see divergence in action. Slide the learning rate up from 0.01 and watch the moment it diverges.
Note: with η=0.01 and 1000 iterations, it converges to W≈1.253, b≈2.746.
Overfitting means fitting the training data well but performing poorly on new data (generalization). Underfitting means not even fitting the training data well. For underfitting, replace the model itself.
③ Perceptron
Invented by Rosenblatt in 1957, this is a single-unit artificial neural network. Two advantages of neural networks: ① learn from examples ② fault-tolerant - if some component malfunctions, the whole still works.
The activation function converts the weighted sum of inputs into an output. Initially this was a step function (1 if above threshold, 0 otherwise).
[Experience 2] Perceptron Gate Calculator - AND Gate
The classic configuration (w1=w2=1, b=-1.5) gives an AND gate. Slide b up to around -0.5 and you'll see it switch to an OR gate (0,1,1,1).
Learning algorithm: fold bias b into w0 (a 1 appended at the end of the input), and on misclassification update the weights - if a 1 was wrongly output as 0, increase by η×(1−0)×x; if a 0 was wrongly output as 1, decrease. Use η=0.2, epochs=10.
The perceptron's limitation: a single unit cannot represent XOR. This very limitation is why we moved to MLPs.
④ MLP and Backpropagation
MLP has an input layer, hidden layer(s), and output layer. Learning has three steps: forward pass (input → hidden → output) → error calculation → backward pass (weight update).
Activation functions are all nonlinear - stacking linear functions just yields another linear function, which is useless. Here's a comparison of four: step (early perceptron), sigmoid (S-curve, dominant in the 1980s), ReLU (passes through values ≥0, currently most popular), tanh (similar to sigmoid, output range −1 to 1).
The forward pass was assigned as a calculation exercise (weighted sum of inputs → sigmoid → hidden layer output → repeat → output layer).
[Experience 3] MLP Forward Pass Calculator
2 inputs, 2 hidden units, 1 output. Change the weights and watch the flow: z (weighted sum) → sigmoid → output.
The loss function is MSE = 0.5 × Σ(y−t)². Example: if the prediction is close to the answer, loss is 0.03; if far, 0.81.
[Experience 4] MSE Calculator - with example presets
Backpropagation - propagate the loss from the output layer back toward the hidden layer to update weights. The derivation uses the chain rule of calculus. The hidden layer's error is computed by back-propagating the output layer's error, and this error value is called delta (δ). Gradient = delta × unit output.
⑤ Learning Rate, Batch, and Optimization
Three timing approaches for weight updates - matched to the features table:
| Approach | Description | Characteristic |
|---|---|---|
| Online (SGD) | Update after each single sample | Noisy, fluctuates on individual samples |
| Full batch | Update after processing everything | Stable but slow |
| Mini-batch | Update after each batch | Compromise between the two, relatively stable convergence |
Processing multiple samples simultaneously is implemented with matrix multiplication (batch learning).
Learning rate: too high diverges, too low is slow. Momentum: acts like physical momentum for acceleration + helps escape local minima. Adaptive series: Adagrad (learning rate decays inversely with cumulative gradient sum, default 0.01, becomes too small after long training) → RMSprop (Hinton's suggestion, exponential moving average) → Adam (= RMSprop + momentum, currently the most popular). Memorize this lineage.

