Classification algorithms Logistic regression and neural networks HAF
- Slides: 48
Classification algorithms Logistic regression and neural networks HAF Workshop, 22. 3 – 23. 3. 2018, KIT Martin Siggel German Aerospace Center
DLR. de • Chart 2 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Outline • Basics • • • Supervised learning: regression and classification Math theory Training Optimization: gradient descent, gradient checking Over- and underfitting, regularization • Logistic Regression: • • Linear regression vs logistic regression Formalism Cost vs. Loss One-vs-All for multi-classification • Neural Networks • • • History Neurons Formalism Loss + Back-propagation Advanced topics
DLR. de • Chart 3 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Basics
DLR. de • Chart 4 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Big picture: supervised learning Regression 900 800 Price in tsd. euros 700 600 500 400 300 200 100 0 0 50 100 150 200 Size house in m² 250 300 350 400
DLR. de • Chart 5 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Big picture: supervised learning Classification Age Malignant Benign Tumor size Classification = choose between discrete options
DLR. de • Chart 6 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Big picture: supervised learning Mathematical model • House size (x) 80 85 120 122 137 180 183 192 Price (y) 220 390 368 371 427 553 546 511
DLR. de • Chart 7 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Big picture: supervised learning The hypothesis Training set Learning Algorithm x (House size) h hypothesis y (estimated house price)
DLR. de • Chart 8 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training the hypothesis Loss function •
DLR. de • Chart 9 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training the hypothesis Gradient descent optimization • Learning Rate
DLR. de • Chart 10 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training the hypothesis Gradient descent optimization
DLR. de • Chart 11 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training the hypothesis Gradient descent optimization
DLR. de • Chart 12 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training the hypothesis Gradient Checking •
DLR. de • Chart 13 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training the hypothesis Over- / underfitting Underfitting Just right Overfitting
DLR. de • Chart 14 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training the hypothesis Regularization •
DLR. de • Chart 15 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Logistic Regression
DLR. de • Chart 16 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Simple linear regression 1 Miss-classification 0. 5 Malignant? 0 Tumor size (x)
DLR. de • Chart 17 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Logistic regression 1 Malignant? 0. 5 Less prone to extreme values 0 Tumor size (x)
DLR. de • Chart 18 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Sigmoid function (Logistic curve) → Measure of classification probabilty
DLR. de • Chart 19 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Logistic Regression Formalism •
DLR. de • Chart 20 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Cost function • nonvex Non-convex Desired
DLR. de • Chart 21 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Cost function • 2. 5 y = 1 2 y = 0 1. 5 1 0. 5 0 0 0. 2 0. 4 0. 6 0. 8 1
DLR. de • Chart 22 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Simplified Cost Function • y=0 y=1
DLR. de • Chart 23 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Loss function regularized Logistic Regression •
DLR. de • Chart 24 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Multi-classification with Logistic Regression
DLR. de • Chart 25 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Multi-classification with Logistic Regression One-vs-all red or not 3 Classifiers blue or not green or not
DLR. de • Chart 26 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Multi-classification with Logistic Regression One-vs-all •
DLR. de • Chart 27 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Excercise • Classify hand-written digits (MNIST) • TODO: 1. 2. 3. 4. Get a feeling for the data Implement and check the loss function of the LR method Classify images from a test data set and compute accuracy of our method. Figure out, how test set accuracy and training set accuracy depend on the number of samples. • 30 min
DLR. de • Chart 28 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Neural Networks
DLR. de • Chart 29 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 History • Originally invented to mimic brain • Hyped due to many successful applications in the 80 s / early 90 s • Recognition of hand-written text (Yan Le. Cun) • Winter of neural networks: networks were not as good as hoped • Lately revival of large scale deep neural networks due to better hardware, better network architectures
DLR. de • Chart 30 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 The Neuron
DLR. de • Chart 31 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 The Neuron Mathematical analogon 1 Neuron = Logistic Regressor
DLR. de • Chart 32 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Neural Network Learns abstract features
DLR. de • Chart 33 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Neural Network
DLR. de • Chart 34 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Multi-Class classification • Neural network has K output neurons • Each output neuron represents a different class e. g. … • The neuron that fires most (has highest probabilty) wins
DLR. de • Chart 35 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Multi-Class classification One-hot encoding • The true values have to be encoded to match output topology, i. e. … • This encoding is called one-hot
DLR. de • Chart 36 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training Loss function • Sum over all parameters, except bias
DLR. de • Chart 37 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training Back-propagation Application of chain rule:
DLR. de • Chart 38 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training Back-propagation forward activation flow Backwards gradient propagation
DLR. de • Chart 39 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training Back-propagation, Example • X 3 80 y -4 * -12 -20 -60 + z -20 1 w 2 2 0 max -20 -10 -20 ^2 100 1
DLR. de • Chart 40 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Training Back-propagation, Layers Just believe me ; ) Add regularization part
DLR. de • Chart 41 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 • Bad: all zero values • Lead to same gradients and same updates. • Bad: large values • Activation is saturated • Gradients become zero • Optimization can‘t process • Good: small random numbers • Keeps the activation in the dynamic region of the sigmoid function • Gradients usable • Breaks symmetry
DLR. de • Chart 42 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Advanced Topics Other activation functions • Add non-linearity, make networks more flexible • Different in training convergence • Re. LU seems to work best for large networks!
DLR. de • Chart 43 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Advanced Topics Convolutional Networks Image Filters • Good for image classification • Similar to the receptive field of the eye Filtered images
DLR. de • Chart 44 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Advanced Topics Deep Networks • Currently very successful in image classification • Many layers, often combined with convolution
DLR. de • Chart 45 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Advaned Topics Tensor Frameworks • • • Build to create large scale deep networks Often GPU acceleration Automatic gradient computation / back-propagation! Specialized optimization algorithms (mini-batch mode, stochastic gradients) Pre-configured networks …
DLR. de • Chart 46 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Excercise • Classify hand-written digits with a 3 -layer network • TODO: 1. Implement and check the cost function of the Neural Network 2. Classify images from a test data set and compute the accuracy. 3. Figure out, how test set accuracy and training set accuracy depend on the number of samples. 4. Try to improve the accuracy by changing the number of neurons in the hidden layer or by changing the regularization. • 30 min
DLR. de • Chart 47 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Further reading • https: //www. coursera. org/learn/machine-learning (Great introduction) • http: //cs 231 n. github. io/ (Stanford course for Conv. Networks) • http: //www. subsubroutine. com/sub-subroutine/2016/11/12/painting-like-vangogh-with-convolutional-neural-networks (making art with neural networks) • https: //www. youtube. com/watch? v=Agkf. IQ 4 IGa. M (Amazing video, how neurons get specialized tasks) • http: //ruder. io/optimizing-gradient-descent/ (Overview on optimization algorithms for neural networks)
DLR. de • Chart 48 > Logistic regression and neural networks> Martin Siggel • 22. 03. 2018 Questions martin. siggel@dlr. de
- Survival analysis vs logistic regression
- Logistic regression vs linear regression
- Logistic regression and discriminant analysis
- Logistic regression residual deviance
- Sequential logistic regression
- Logistic regression in predictive analytics
- Perceptron
- Multinomial logistic regression
- Cost function logistic regression
- Andy field regression
- Logistic function
- Multinomial logistic regression
- Logistic regression epidemiology
- Hans burgerhof
- Logistic regression spss output
- Analisis regresi
- Logistic regression stata
- Logistic regression stata
- Logistic regression interaction interpretation
- Logistic regression slide
- Ratio test
- Logistic regression outliers
- Advantage of logistic regression
- Disadvantages of linear regression
- Gradient descent java
- Logistic regression spark
- Logistic regression in data mining
- Logistic regression optimization
- Backpropagation logistic regression
- Logistic regression assignment
- Pca logistic regression
- Backpropagation logistic regression
- Backpropagation logistic regression
- Regularization andrew ng
- Example of intuition
- Octave cost function
- Exact logistic regression
- Nonlinear logistic regression
- The group lasso for logistic regression
- Penalized likelihood logistic regression
- Visualizing and understanding convolutional networks
- Deep neural networks and mixed integer linear optimization
- Least mean square algorithm in neural network
- Neural networks for rf and microwave design
- Fuzzy logic lecture
- Neural networks and learning machines
- Linear regression vs multiple regression
- Computer networks routing algorithms
- Vc bound