I gradienti puntano in salita: faccia un passo nella direzione opposta
Usi la pendenza per migliorare i pesi
I gradienti puntano in salita: faccia un passo nella direzione opposta è una lezione Deep Learning Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Deep Learning Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Deep Learning Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
Reading the Slope
To walk downhill you first need to know which way is down. The gradient is the tool that tells you the slope of the loss at your current spot.
Gradient Points Uphill
Here is the surprise: the gradient points in the direction where loss increases fastest. It shows you the steepest way up, not down.
So Step the Other Way
Since the gradient aims uphill, you move in the opposite direction to go down. Subtracting the gradient takes you toward lower loss.
w = w - gradThe Update Rule
This one line is the heart of training. You scale the gradient by a small step size, then subtract it from each weight. Repeat and loss drops.
w = w - lr * gradGradient Is a Vector
With many weights, the gradient is a whole vector: one slope per weight. Each weight gets nudged by its own piece of that vector.
Magnitude Means Steepness
A large gradient value means the loss is very steep in that direction, so that weight needs a bigger correction. Small values mean you are nearly flat there.
Where Gradient Is Zero
At the very bottom of a valley the slope flattens and the gradient becomes zero. With nothing to subtract, the weights stop moving. You have converged.
One Step at a Time
You almost never reach the bottom in one jump. Each step only improves things a little, so descent is a long series of tiny downhill moves.
Following the Negative Gradient
The path you trace by always heading along the negative gradient is the route of steepest descent. It is the greedy shortcut toward lower loss.
step = -gradWhy Subtraction Works
Subtracting moves you against the increase, so loss must fall for a small enough step. That simple sign flip is what turns a slope into progress.
Toward Automatic Gradients
You will rarely compute these slopes by hand. PyTorch's autograd finds the gradient for you, but the rule stays the same: subtract it to descend.
Quick Check
Which direction does the gradient point?
Recap
The gradient points uphill toward higher loss, so you subtract a scaled version of it to step down. Repeat that update and the model rolls toward the valley. ⬇️
Domande Frequenti
La lezione «I gradienti puntano in salita: faccia un passo nella direzione opposta» è gratuita?
Sì — il testo completo di «I gradienti puntano in salita: faccia un passo nella direzione opposta» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Deep Learning Academy, passa a CoddyKit PRO. Il corso Deep Learning Academy include 4 lezioni in totale.
Cosa imparerò in «I gradienti puntano in salita: faccia un passo nella direzione opposta»?
Usi la pendenza per migliorare i pesi Eserciti Deep Learning Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Deep Learning Academy?
Non è richiesta alcuna esperienza precedente. Deep Learning Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.
Quanto tempo richiede la lezione «I gradienti puntano in salita: faccia un passo nella direzione opposta»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Deep Learning Academy?
Sì. Ogni lezione Deep Learning Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- La loss come paesaggio da percorrere in discesa
- I gradienti puntano in salita: faccia un passo nella direzione opposta
- Learning rate: troppo grande, troppo piccolo o perfetto
- Minimizzi una funzione a mano in Python