Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

In my class, I teach the autoencoder by asking everyone to stand up. 🙆 Stretch your arms out wide. Imagine you are holding a heavy textbook (like Introduction to Algorithms by Prof. Cormen), the whole thing, every page. Now bring your hands slowly together until they almost touch your...

10,382 Aufrufe • vor 9 Tagen •via X (Twitter)

0 Kommentare

Keine Kommentare verfügbar

Kommentare vom Original-Post werden hier angezeigt

Ähnliche Videos

[VAE] by Hand ✍️ A Variational Auto Encoder (VAE) learns the structure (mean and variance) of hidden features and generates new data from the learned structure. In contrast, GANs only learn to generate new data to fool a discriminator; they may not necessarily know the underlying structure of the data. The International Conference on Learning Representations (ICLR) this year announced its first ever "Test of Time Award" to recognizes the VAE paper, published 10 years ago. This exercise demonstrates how to calculate a VAE by hand. [1] Given: ↳ Three training examples X1, X2, X3 ↳ Copy training examples to the bottom ↳ The purpose is to train the network to reconstruct the training examples. ↳ Since each target is a training example itself, we use the Greek word "auto" which means "self." This crucial step is what makes an autoencoder "auto." [2] Encoder: Layer 1 + ReLU ↳ Multiply inputs with weights and biases ↳ Apply ReLU, crossing out negative values (-1 -> 0) [3] Encoder: Mean and Variance ↳ Multiply features with two sets of weights and biases ↳ 🟩 The first set predicts the means (𝜇) of latent distributions ↳ 🟪 The second set predicts the standard deviation (𝜎) of latent distributions [4] Reparameterization Trick: Random Offset ↳ Sample epsilon ε from the normal distribution with mean = 0 and variance = 1. ↳ The purpose is to randomly pick a offset away from the mean. ↳ Multiply the standard deviation values with epsilon values. ↳ The purpose is to scale the offset by the standard deviation. [5] Reparameterization Trick: Mean + Offset ↳ Add the sampled offset to predicted mean ↳ The result are new parameters or features 🟨 as inputs to the Decoder. [6] Decoder: Layer 1 + ReLU ↳ Multiply input features with weights and biases ↳ Apply ReLU, crossing out negative values. Here, -4 is crossed out. [7] Decoder: Layer 2 ↳ Multiply features with weights and biases ↳ The output is Decoder's attempt to reconstruct the input data X from reparameterized distributions described by 𝜇 and 𝜎. [8]-[10] KL Divergence Loss [8] Loss Gradient: Mean 𝜇 ↳ We want 𝜇 to approach 0. ↳ A lot of math called SGVB simplifies the calculation of loss gradients to simply 𝜇 [9,10] Loss Gradient: Stdev 𝜎 ↳ We want 𝜎 to approach 1. ↳ A lot of math simplifies the calculation to 𝜎 - (1/ 𝜎) [11] Reconstruction Loss ↳ We want the reconstructed data Y (dark 🟧) to be the same as the input data X. ↳ Some math involving Mean Square Error simplifies the calculation to Y - X.

Tom Yeh

48,475 Aufrufe • vor 2 Jahren

Batch Normalization by hand ✍️ ~ 7 steps walkthrough below Batch normalization is common practice for improving training and achieving faster convergence. It sounds simple. But it is often misunderstood. 🤔 Does batch normalization involve trainable parameters, tunable hyper-parameters, or both? 🤔 Is batch normalization applied to inputs, features, weights, biases, or outputs? 🤔 How is batch normalization different from layer normalization? So I drew and calculated one entirely by hand. Goal: normalize a mini-batch of 4 examples to mean 0 and variance 1, then let the network scale it back. = 1. Given = A mini-batch of 4 training examples, each with 3 features. = 2. Linear layer = Let us multiply by the weights and add the biases. Batch norm sits after this, which answers the second question: what gets normalized is features, not inputs, weights or biases. = 3. ReLU = We apply the activation, and -2 becomes 0. Negative values are suppressed before any statistic is taken. = 4. Batch statistics = Let us compute the sum, mean, variance and standard deviation, one row at a time. A row is a feature and the four columns are the four examples, so every number here measures one feature against the rest of the batch. That is the "batch" in batch normalization, and it is exactly what layer normalization does not do. The statistics are rounded to whole numbers, which is what keeps the rest of the page doable in pen. = 5. Shift to mean 0 = We subtract the mean, in green. The four values in each feature now average to zero. = 6. Scale to variance 1 = Let us divide by the standard deviation, in orange. Each feature now has variance one, whatever scale it arrived at. = 7. Scale and shift = We multiply by a linear transformation and pass the result on. The diagonal and the last column are trainable, so having just forced every feature to mean 0 and variance 1, we hand the network the means to undo it. The outputs: Mean of each feature = [2, 1, 2] Std dev of each feature = [1, 1, 2] To the next layer = [2, -2, 2, 0], [-3, 3, 6, -3], [2, 0, 1, 2] The answers: 🤔 Both. The scale and shift are trainable, the statistics are not. Epsilon and the momentum on the running statistics are the hyper-parameters, and one mini-batch by hand needs neither. 🤔 Features, after the linear layer, not inputs, weights or biases. 🤔 Batch norm measures across the batch, one feature at a time. Layer norm measures across the features, one example at a time. 💾 Save this post!

Tom Yeh

20,848 Aufrufe • vor 1 Monat

MLP in PyTorch by hand ✍️ ~ 7 steps walkthrough below Goal: fill in every blank in the PyTorch code to build a multi-layer perceptron. 1. Given Let us start with a code template on the left and the network it is supposed to build on the right. Every blank in the code can be worked out from the picture. 2. Linear layer We count: 3 features in, 4 features out. So the weight matrix is 4 by 3. There is an extra column for the biases, which means bias = T. 3. ReLU Let us apply the activation. ReLU crosses out the negatives, so -1 becomes 0. 4. Linear layer The input size is 4, because that is what the previous layer put out. The output size is 2. A 2 by 4 weight matrix, and this time no extra column, so bias = F. 5. ReLU We cross out the negatives again. 6. Linear layer Two features in, five out. A 5 by 2 weight matrix, with a bias column, so bias = T. 7. Sigmoid Let us finish. Sigmoid squashes the raw scores (3, 0, -2, 5, -5) into probabilities between 0 and 1. You have just implemented a three-layer deep neural network by hand. ✍️ == Story == Three years ago I gave this exercise to my students, to connect the code to the math. They found it odd. Every other AI course they were taking lived inside a Jupyter notebook, and here I was handing out paper. Three years later, my colleagues are the ones rushing to move their materials to paper. The exercise has not changed. Paper still asks the one thing a notebook lets you skip: do you actually understand what the code is doing? If you can tell me why the weight matrix is 4 by 3, and why bias is F on the second layer, you understand nn.Linear better than someone who has been copy-pasting it for a year. 💾 Save this post! #AIbyHand #PyTorch #DeepLearning

Tom Yeh

13,318 Aufrufe • vor 2 Monaten

Transformer by hand ✍️ ~ 6 steps walkthrough below Open the hood of a transformer and the parts list is overwhelming: embeddings, positional encoding, attention weighting, self-attention, cross-attention, multi-head attention, layer norm, skip connections, softmax, linear, Nx, shifted right, query, key, value, masking. Which of those actually make the car run? Two of them. Attention weighting and the feed-forward network. Everything else is an enhancement to make it run faster and longer, which is how we got from a car to a truck, and to the word "large" in large language model. So I drew and calculated those two parts entirely by hand. Goal: push five features through one transformer block, filling in every cell yourself. 1. Given Five positions of input features, arriving from the previous block. 2. Attention matrix Let us feed all five features to a query-key module (QK) and read back an attention weight matrix, A. The details of that module are a post of their own. 3. Attention weighting We multiply the input features by A to get the attention weighted features, Z. Still five positions. The effect is to combine features *across positions*, horizontally: X1 becomes X1 + X2, X2 becomes X2 + X3, and so on. 4. First layer Let us feed all five weighted features into the first layer of the FFN. Multiply by the weights and biases. This time the combining happens *across feature dimensions*, vertically, and each feature grows from 3 numbers to 4. Note that every position goes through the same weight matrix. That is what "position-wise" means. 5. ReLU We cross out the negatives. They become zeros. 6. Second layer Let us bring it back down: 4 dimensions to 3. The output feeds the next block, which has a completely separate set of parameters, and the whole thing runs again. You have just calculated a transformer block by hand. ✍️ The takeaway: the two parts are doing two different jobs, and neither one alone is enough. Attention mixes *across positions*, so a feature can see its neighbours. The FFN mixes *across feature dimensions*, so each position can think about itself. Horizontal, then vertical. Then that pattern repeats N times, each block with its own separate set of weights. That is the Nx from the list up top, and that is what makes the transformer run. 💾 Save this post! #AIbyHand #Transformers #DeepLearning

Tom Yeh

26,089 Aufrufe • vor 2 Monaten

this is more useful than my entire degree Elon Musk's rocket company signed a $60,000,000,000 deal for Cursor in June, and eight days ago the two of them put a worker on sale for $200 a month: it gets its own computer in the cloud, signs into your accounts, clicks through your real apps, and hands back finished work instead of a draft for you to paste i ran one against my receipts folder on sunday and got back 14 filed, 2 it held because they needed a card number, and a saved method i never wrote myself Grok Bot is the one you train by doing your own job in front of it, and the whole handover fits in four messages tonight: 1. write out one job you did today the way you would brief a new hire: what has to be finished, which sites and files to work from, what to hand back, and where it stops and asks you 2. let it run once on something safe to get wrong, then correct the result until it is worth your name 3. say "save what we just did as a skill", and add the one rule about what always needs your approval 4. say "run that skill every weekday at 8 and post the result here. if the source is missing, tell me instead of using yesterday's numbers" xAI wrote that order into its own manual: one real job, then the saved method, then the clock. a schedule sitting on top of a method nobody checked replaces two hours of your clicking with two hours of your mistake turns out you never get to pick the brain, and that is the part i would argue about: the manual says there is no model picker for members or admins, no plan to add one, and the bill follows whichever model answered bookmark this, then open the piece below: which jobs deserve a worker of their own, and which ones quietly burn the seat ↓

Argona

21,946 Aufrufe • vor 29 Tagen

[Backpropagation] by Hand✍️ [1] Forward Pass ↳ Given a multi layer perceptron (3 levels), an input vector X, predictions Y^{Pred} = [0.5, 0.5, 0], and ground truth label Y^{Target} = [0, 1, 0]. [2] Backpropagation ↳ Insert cells to hold our calculations. [3] Layer 3 - Softmax (blue) ↳ Calculate ∂L / ∂z3 directly using the simple equation: Y^{Pred} - Y^{Target} = [0.5, -0.5, 0]. ↳ This simple equation is the benefit of using Softmax and Cross Entropy Loss together. [4] Layer 3 - Weights (orange) & Biases (black) ↳ Calculate ∂L / ∂W3 and ∂L / ∂b3 by multiplying ∂L / ∂z3 and [ a2 | 1 ]. [5] Layer 2 - Activations (green) ↳ Calculate ∂L / ∂a2 by multiplying ∂L / ∂z3 and W3. [6] Layer 2 - ReLU (blue) ↳ Calculate ∂L / ∂z2 by multiplying ∂L / ∂a2 with 1 for positive values and 0 otherwise. [7] Layer 2 - Weights (orange) & Biases (black) ↳ Calculate ∂L / ∂W2 and ∂L / ∂b2 by multiplying ∂L / ∂z2 and [ a1 | 1 ]. [8] Layer 1 - Activations (green) ↳ Calculate ∂L / ∂a1 by multiplying ∂L / ∂z2 and W2. [9] Layer 1 - ReLU (blue) ↳ Calculate ∂L / ∂z1 by multiplying ∂L / ∂a1 with 1 for positive values and 0 otherwise. [10] Layer 1 - Weights (orange) & Biases (black) ↳ Calculate ∂L / ∂W1 and ∂L / ∂b1 by multiplying ∂L / ∂z1 and [ x | 1 ]. [11] Gradient Descent ↳ Update weights and biases (typically a learning rate is applied here). 💡 Matrix Multiplication is All You Need: Just like in the forward pass, backpropagation is all about matrix multiplications. You can definitely do everything by hand as I demonstrated in this exercise, albeit slow and imperfect. This is why GPU's ability to multiply matrices efficiently plays such an important role in the deep learning evolution. This is why NVIDIA is now close to $1 trillion in valuation. 💡Exploding Gradients: We can already see the gradients are getting larger as we back-propagate up, even in this simple 3-layer network. This motivates using methods like skip connections to handle exploding (or diminishing) gradients as in the ResNet. I did the calculations entirely by hand. Please let me know if you spot any error or have any questions!

Tom Yeh

64,645 Aufrufe • vor 2 Jahren

Apparently, I saw this video online and I decided to share. What this worker is applying is called bitumen, or what many of us know as bituminous coating. Most people think a wall is a solid, impenetrable block, but in reality, it is more like a sponge. Concrete and blocks have microscopic pores that pull water from the earth through a process we call capillary action. This thick black substance is the shield that stops that water from climbing up into the house. It is not about making the wall look good because this part will be buried under the dirt forever. It is about creating a skin that water cannot breathe through. When do you need to do this? The need for this arises because the soil is a very aggressive environment. Water is not your only enemy.. The ground also contains salts and sulfates that want to eat away at the cement. If this moisture finds its way to the steel bars inside the columns, those bars will start to rust. And when steel rusts, it expands, and that expansion is what cracks the concrete from the inside out. This coating is the only thing standing between your foundation and that kind of slow destruction. Thats is why if you see wet patches at the bottom of your walls inside your house, it usually means someone skipped this step or did it poorly during construction. You can apply this anytime you are building parts of a structure that will stay in contact with the ground. It is common in areas where the water table is high or where the soil stays damp for most of the year. This is a one-shot opportunity. Once you backfill the soil, you can never go back to fix it without a lot of expense and a lot of digging. It is about having the foresight to protect the heart of the building while it is still exposed. Please don’t ignore this if you need to. If you ignore it now to save a bit of money, you will be funding the future decay of your own home. I hope this helps.

A.Y.O

75,399 Aufrufe • vor 5 Monaten

I understand that many of you are very impatient. Those who complain just need to take a calming pill and relax. This operation has a time frame set from the beginning to the end of 45-47. It has been dismantled move by move, each move has been calculated and through various phases and stages of the operation it must go through. We are in the final phase. And now I am here for those who have found me. I am giving you insight day by day as we approach the grand finale of the events. I have published the daily war reports so you can tune in to see what is happening day by day. There is no one else who does this. You cannot tell people the truth, we have to show it to them. You have to experience the pain, the difficulties. Otherwise people would remain asleep, and no one would believe what the cabal had planned for humanity. They were about to ESTIMATE US, create a NUCLEAR WAR and everyone go underground in the DUMBS and the underground cities they have built. After the EBS/EAS Nesera/Gesera will be active and you will receive all your money! So stop complaining and learn to have faith and trust in GQD. There is no exact date and time set for the EBS/EAS. Everything depends on how the population responds to all these events that are happening. The events coming are designed to create the emotion and desperation that humanity needs to make all this happen. The best thing you can do is maintain your frequency and vibration, stop trying to wake up the sleeping and just be quiet. Enter discussions and put yourself in a position where you will be insulted, lower your vibration and frequency. When humanity is at its breaking point, that is when it will happen. But it will happen. Trust the plan. Trust the process. And trust GQD. daniel H/T Lyran Lightworker

Paul White Gold Eagle

22,939 Aufrufe • vor 1 Tag

Universities and High Schools have not moved rapidly enough to guide students to have skills for the next decade. THEY HAVE FAILED. It is a massive crisis that can be averted by understanding what AI and Robotics will bring about. Solutions are knowing how to use these tools and new industries that will rise. But this situation is also on ALL OF US. No “job” is safe from founder to entry level in most industries. You and I, by what we do, will be “replaced” ultimately. What to do? AI and Robotics are tools, the next decade is owned by those who know how to use them expertly, but this is also temporary. We have to understand that what we do for “work” will change giving ultimately a greater value to those that are: Creative Flexible Always learning Willing to be wrong Love being human Love being alive Know history Covet wisdom Knowing all tech has downsides Building strong family and friends Realize many institutions have failed The first four are required for you to be able to live through this period with your sanity intact. The rest will allow you to thrive. There are no true careers at this point anymore. There are advocation and vocations which will either earn you money or give life meaning. We will learn that we are not “what we do”, just like we knew for 99% of human existence. Let that sink in. — You and I are far, far ahead of knowing this and we can do two things: 1) Laugh at the “clueless” 2) Help people understand with grace Go to Reddit if you are 1, in fact don’t follow me because you will not like this next decade and what I post. You are 2 and thank you. Even if you and I have not solved this issue, we can help people understand what is ahead and with determination and creativity bound together to solve it locally. Or human family has done this millions of times. The evidence is: you are here. The Neo Luddite movement has not even begun and it will potentially rip apart society even more than all the fashionable moment in the recent past has. These Luddites will have a good point with the wrong answers cooked up by dying academics that cling to labels, “virtues” and victim hood. It will be readymade for some governments to enter in as “big daddy” to “help us”. You will not like what they do, but you will only know when it is too late. It will include YOU “volunteering” to “leave” by 60, to “help out” CanadaPod style. “Brian, I’m 24 what do I do?”. I hope to do much more here to help. But I do know this: 1) Learn a trade or vocation because it’s valuable. It may also be free to low cost if you do it right. 2) Learn everything you can about USING AI and TRAINING YOUR AI. Your expertise will be in the top 1% for a decade. But not forever. 3) Understand Bitcoin and how it will rise while other things sink. This is a short list for now. We will know more moving forward. When you see videos like this posted below, know one thing: Many of these folks had no real family of mental and physical support. Maybe no parent or one parent. Maybe only a broke system to prepare them for—nothing. This was not their doing. Now it is not your “job” to help them, it is your survival to help them if that is what you need. See some day after the dust settles these 20 year olds will be 40 year olds and running YOUR world. And at some point you may need them more than you think you do. You will need them, as they need you now. THIS IS WHAT PAST WISDOM KNEW. The elders of the past never found the need to piss on the youth and hope for the best. THE YOUTH ARE OUR BEST, let us all find ways to change it, even if every aspect of “the system” wants us to berate them into the ground.

Brian Roemmele

37,681 Aufrufe • vor 1 Jahr