Spaces:
Running
Running
Commit ·
6af86f5
1
Parent(s): ccd63d1
update deep learning
Browse filesFiles changed (2)
- DeepLearning/index.html+145-111
- index.htmlAdded+308
3314 unmodified lines33153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333841757 unmodified lines514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645 unmodified lines517051715172517351745175517651775178517951805181518242 unmodified lines522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953102 unmodified lines531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553561 unmodified line53585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153822 unmodified lines5385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854296 unmodified lines543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354643 unmodified lines54685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955102 unmodified lines55135514551555165517551855191 unmodified line55215522552355245525552655273314 unmodified lines},"rnn": {overview: `<h3>RNNs & LSTMs</h3><p>Process sequences by maintaining hidden state that captures past information.</p><h3>The Vanishing Gradient Problem</h3><p><strong>Problem:</strong> Standard RNNs can't learn long-term dependencies (gradients vanish over many time steps)</p><p><strong>Solution:</strong> LSTM (Long Short-Term Memory) with gating mechanisms</p><h3>LSTM Gates</h3><ul><li><strong>Forget Gate:</strong> What to remove from cell state</li><li><strong>Input Gate:</strong> What new information to add</li><li><strong>Output Gate:</strong> What to output as hidden state</li></ul><div class="callout warning"><div class="callout-title">⚠️ Limitation</div>Sequential processing (can't parallelize) - Transformers solved this!</div>`,applications: `<div class="info-box"><div class="box-title">📝 Text Generation</div><div class="box-content">Character-level generation, autocomplete (before Transformers)</div></div><div class="info-box"><div class="box-title">🎵 Time Series</div><div class="box-content">Stock prediction, weather forecasting, music generation</div></div>`,math: `<h3>RNN State Equations</h3><p>Standard RNN processes a sequence x₁, x₂, ..., xₜ using a recurring hidden state hₜ.</p><div class="formula">hₜ = tanh(Wₕₕhₜ₋₁ + Wₓₕxₜ + bₕ)<br>yₜ = Wₕᵧhₜ + bᵧ</div><h3>Paper & Pain: The Vanishing Gradient Derivation</h3><p>Why do RNNs fail on long sequences? Let's check the gradient ∂L/∂h₁:</p><div class="formula">∂L/∂h₁ = (∂L/∂hₜ) × (∂hₜ/∂hₜ₋₁) × (∂hₜ₋₁/∂hₜ₋₂) × ... × (∂h₂/∂h₁)<br><br>Where ∂hⱼ/∂hⱼ₋₁ = Wₕₕᵀ diag(tanh'(zⱼ))</div><div class="callout warning"><div class="callout-title">⚠️ The Power Effect</div>If the largest eigenvalue of Wₕₕ < 1: Gradients <strong>shrink exponentially</strong> (0.9¹⁰⁰ ≈ 0.00002).<br>If > 1: Gradients <strong>explode</strong>.<br><strong>LSTM Solution:</strong> The "Constant Error Carousel" (CEC) ensures gradients flow via the cell state without multiplication.</div><h3>LSTM Gating Math</h3><div class="list-item"><div class="list-num">01</div><div>Forget Gate: fₜ = σ(W_f[hₜ₋₁, xₜ] + b_f)</div></div><div class="list-item"><div class="list-num">02</div><div>Input Gate: iₜ = σ(W_i[hₜ₋₁, xₜ] + b_i)</div></div><div class="list-item"><div class="list-num">03</div><div>Cell State Update: cₜ = fₜcₜ₋₁ + iₜtanh(W_c[hₜ₋₁, xₜ] + b_c)</div></div>`},1757 unmodified linesctx.beginPath();ctx.arc(x, y, radius, 0, Math.PI * 2);ctx.fill();// Draw connections to next layerif (layerIdx < layers.length - 1) {const nextLayerHeight = canvas.height / (layers[layerIdx + 1] + 1);const nextX = (layerIdx + 2) * layerWidth;for (let j = 0; j < layers[layerIdx + 1]; j++) {const nextY = (j + 1) * nextLayerHeight;const signalProgress = ((time / 500) + layerIdx * 0.5) % 1;ctx.strokeStyle = `rgba(0, 212, 255, ${0.3 + signalProgress * 0.3})`;ctx.lineWidth = 1;ctx.beginPath();ctx.moveTo(x + radius, y);ctx.lineTo(nextX - 12, nextY);ctx.stroke();// Animated signal dotconst dotX = x + radius + (nextX - 12 - x - radius) * signalProgress;const dotY = y + (nextY - y) * signalProgress;5 unmodified lines}}});ctx.fillStyle = '#00d4ff';ctx.font = 'bold 14px Arial';ctx.textAlign = 'center';ctx.fillText('🔄 Neural Network Animation', centerX, 25);}// Animated GNN with message passingfunction drawAnimatedGNN(ctx, canvas, time) {ctx.fillStyle = '#9900ff';42 unmodified linesctx.fillText(i, n.x, n.y + 4);});}// Animated attention matrixfunction drawAnimatedAttention(ctx, canvas, time) {const words = ['The', 'cat', 'sat', 'on', 'mat'];const cellSize = 50;const startX = (canvas.width - words.length * cellSize) / 2;const startY = 80;ctx.fillStyle = '#00d4ff';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('Self-Attention Animation', canvas.width / 2, 30);// Draw wordsctx.font = '12px Arial';words.forEach((word, i) => {ctx.fillStyle = '#e4e6eb';ctx.fillText(word, startX + i * cellSize + cellSize/2, startY - 10);ctx.save();ctx.translate(startX - 20, startY + i * cellSize + cellSize/2);ctx.fillText(word, 0, 0);ctx.restore();});// Animated attention weightsfor (let i = 0; i < words.length; i++) {for (let j = 0; j < words.length; j++) {const baseWeight = i === j ? 0.8 : 0.2 + Math.abs(i - j) * 0.1;const animatedWeight = baseWeight + Math.sin(time / 500 + i + j) * 0.2;const alpha = Math.max(0.1, Math.min(1, animatedWeight));ctx.fillStyle = `rgba(0, 212, 255, ${alpha})`;ctx.fillRect(startX + j * cellSize + 2, startY + i * cellSize + 2, cellSize - 4, cellSize - 4);ctx.fillStyle = '#e4e6eb';ctx.font = '10px Arial';ctx.fillText(animatedWeight.toFixed(2), startX + j * cellSize + cellSize/2, startY + i * cellSize + cellSize/2 + 4);}}}// Animated gradient flow for backpropfunction drawAnimatedGradientFlow(ctx, canvas, time) {ctx.fillStyle = '#ff6b35';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('Backpropagation - Gradient Flow', canvas.width / 2, 30);const layers = [2, 4, 4, 1];const layerWidth = canvas.width / (layers.length + 1);// Forward pass (left to right) - blueconst forwardProgress = (time / 2000) % 1;layers.forEach((neurons, layerIdx) => {const x = (layerIdx + 1) * layerWidth;const layerHeight = canvas.height / (neurons + 1);for (let i = 0; i < neurons; i++) {const y = (i + 1) * layerHeight;// Pulse effect based on forward passconst isActive = forwardProgress > layerIdx / layers.length;const radius = isActive ? 15 + Math.sin(time / 200) * 3 : 12;ctx.fillStyle = isActive ? '#00d4ff' : 'rgba(0, 212, 255, 0.3)';ctx.beginPath();ctx.arc(x, y, radius, 0, Math.PI * 2);ctx.fill();}});// Backward pass (right to left) - orange/red gradientsconst backwardProgress = ((time / 2000) + 0.5) % 1;for (let layerIdx = layers.length - 2; layerIdx >= 0; layerIdx--) {const x1 = (layerIdx + 1) * layerWidth;const x2 = (layerIdx + 2) * layerWidth;const gradientActive = backwardProgress > (layers.length - 2 - layerIdx) / (layers.length - 1);if (gradientActive) {const gradX = x2 - (x2 - x1) * ((backwardProgress * (layers.length - 1)) % 1);ctx.fillStyle = '#ff6b35';2 unmodified linesctx.fill();}}ctx.fillStyle = '#e4e6eb';ctx.font = '12px Arial';ctx.fillText('Forward: Blue → | Backward: Orange ←', canvas.width / 2, canvas.height - 20);}// Animated network for nn-basicsfunction drawAnimatedNetwork(ctx, canvas, time) {drawDefaultAnimation(ctx, canvas, time);}// Animated decision boundary for perceptronfunction drawAnimatedDecisionBoundary(ctx, canvas, time) {const centerX = canvas.width / 2;const centerY = canvas.height / 2;ctx.fillStyle = '#ff6b35';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('Perceptron Decision Boundary', canvas.width / 2, 30);// Animated rotating decision boundaryconst angle = time / 2000;const length = 200;ctx.strokeStyle = '#ff6b35';ctx.lineWidth = 3;ctx.beginPath();ctx.moveTo(centerX - Math.cos(angle) * length, centerY - Math.sin(angle) * length);ctx.lineTo(centerX + Math.cos(angle) * length, centerY + Math.sin(angle) * length);ctx.stroke();// Fixed sample pointsconst points = [{x: 100, y: 80, c: 1}, {x: 150, y: 100, c: 1}, {x: 120, y: 150, c: 1},{x: 400, y: 200, c: 0}, {x: 450, y: 180, c: 0}, {x: 380, y: 250, c: 0}];points.forEach(p => {ctx.fillStyle = p.c === 1 ? '#00d4ff' : '#00ff88';ctx.beginPath();1 unmodified linectx.fill();});}function drawAnimatedMLP(ctx, canvas, time) {drawDefaultAnimation(ctx, canvas, time);}function drawAnimatedActivations(ctx, canvas, time) {drawActivationFunctions(ctx, canvas);// Add animated input markerconst x = Math.sin(time / 500) * 4;const centerX = canvas.width / 2;const centerY = canvas.height / 2;const scale = 40;ctx.fillStyle = '#ffffff';ctx.beginPath();ctx.arc(centerX + x * scale, centerY, 6, 0, Math.PI * 2);ctx.fill();ctx.strokeStyle = '#ffffff';ctx.setLineDash([5, 5]);ctx.beginPath();2 unmodified linesctx.stroke();ctx.setLineDash([]);}function drawAnimatedConvolution(ctx, canvas, time) {drawConvolutionAnimation(ctx, canvas);}function drawAnimatedGAN(ctx, canvas, time) {ctx.fillStyle = '#ffaa00';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('GAN Training Animation', canvas.width / 2, 30);const phase = Math.floor(time / 1000) % 4;// Generatorctx.fillStyle = phase <= 1 ? '#00ff88' : 'rgba(0, 255, 136, 0.3)';ctx.fillRect(50, 100, 100, 80);ctx.fillStyle = '#e4e6eb';ctx.font = '12px Arial';ctx.fillText('Generator', 100, 145);// Fake imageconst noiseToFake = Math.sin(time / 300) * 0.5 + 0.5;ctx.fillStyle = `rgba(255, 170, 0, ${noiseToFake})`;ctx.fillRect(200, 110, 60, 60);ctx.fillStyle = '#e4e6eb';ctx.fillText('Fake', 230, 200);// Discriminatorctx.fillStyle = phase >= 2 ? '#ff6b35' : 'rgba(255, 107, 53, 0.3)';ctx.fillRect(320, 100, 100, 80);ctx.fillStyle = '#e4e6eb';ctx.fillText('Discriminator', 370, 145);// Outputconst output = phase === 3 ? 'Real?' : 'Fake?';ctx.fillStyle = '#00d4ff';ctx.font = 'bold 14px Arial';ctx.fillText(output, 370, 220);// Arrowsctx.strokeStyle = '#e4e6eb';ctx.lineWidth = 2;6 unmodified linesctx.lineTo(320, 140);ctx.stroke();}function drawAnimatedDiffusion(ctx, canvas, time) {ctx.fillStyle = '#9900ff';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('Diffusion Process Animation', canvas.width / 2, 30);const steps = 5;const stepWidth = canvas.width / (steps + 1);const progress = (time / 3000) % 1;const currentStep = Math.floor(progress * steps);for (let i = 0; i < steps; i++) {const x = (i + 1) * stepWidth;const y = 150;const noiseLevel = i / (steps - 1);const isActive = i <= currentStep;// Draw square with noisectx.fillStyle = isActive ? '#9900ff' : 'rgba(153, 0, 255, 0.3)';ctx.fillRect(x - 30, y - 30, 60, 60);// Add noise dotsif (noiseLevel > 0) {for (let j = 0; j < noiseLevel * 20; j++) {3 unmodified linesctx.fillRect(nx, ny, 2, 2);}}ctx.fillStyle = '#e4e6eb';ctx.font = '10px Arial';ctx.fillText(`t=${i}`, x, y + 50);}ctx.fillStyle = '#e4e6eb';ctx.font = '12px Arial';ctx.fillText('Clean → Noisy (Forward) | Noisy → Clean (Reverse)', canvas.width / 2, canvas.height - 20);}function drawAnimatedRNN(ctx, canvas, time) {ctx.fillStyle = '#00d4ff';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('RNN Unrolled Through Time', canvas.width / 2, 30);const steps = 5;const stepWidth = canvas.width / (steps + 1);const progress = (time / 500) % steps;const activeStep = Math.floor(progress);for (let i = 0; i < steps; i++) {const x = (i + 1) * stepWidth;const y = 150;const isActive = i === activeStep;// Hidden statectx.fillStyle = isActive ? '#00d4ff' : 'rgba(0, 212, 255, 0.3)';ctx.beginPath();ctx.arc(x, y, 25, 0, Math.PI * 2);ctx.fill();ctx.fillStyle = '#e4e6eb';ctx.font = '10px Arial';ctx.fillText(`h${i}`, x, y + 4);// Input arrowctx.strokeStyle = isActive ? '#00ff88' : 'rgba(0, 255, 136, 0.3)';ctx.lineWidth = 2;2 unmodified linesctx.lineTo(x, y + 25);ctx.stroke();ctx.fillText(`x${i}`, x, y + 75);// Recurrent connectionif (i < steps - 1) {ctx.strokeStyle = isActive ? '#ff6b35' : 'rgba(255, 107, 53, 0.3)';1 unmodified linectx.moveTo(x + 25, y);ctx.lineTo(x + stepWidth - 25, y);ctx.stroke();// Animated signalif (isActive) {const signalX = x + 25 + (stepWidth - 50) * (progress % 1);3314 unmodified lines331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734181757 unmodified lines517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985 unmodified lines520452055206520752085209521052115212521352145215521642 unmodified lines525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353442 unmodified lines534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953901 unmodified line53925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554162 unmodified lines5419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254636 unmodified lines547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754983 unmodified lines55025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355442 unmodified lines55475548554955505551555255531 unmodified line55555556555755585559556055613314 unmodified lines},"rnn": {overview: `<h3>The Problem of Long-Term Dependencies</h3><p>Imagine trying to predict the last word in the text: "I grew up in France... [200 words] ... I speak fluent <strong>French</strong>."</p><p>Standard RNNs fail here. As the gap grows, the gradient from "French" has to travel back 200 steps to "France".</p><div class="callout warning"><div class="callout-title">⚠️ The Vanishing Gradient Failure</div>If the weight W < 1, the gradient shrinks exponentially: 0.9²⁰⁰ ≈ 0.0000000007.<br>The network literally "forgets" the context.</div><h3>The LSTM Solution: "The Conveyor Belt"</h3><p>The core idea of LSTM is the <strong>Cell State (C)</strong>. It runs straight down the entire chain, with only minor linear interactions. It's like a conveyor belt—information can flow along it unchanged.</p>`,concepts: `<h3>Step-by-Step LSTM Walkthrough</h3><p>LSTMs control the cell state via "Gates".</p><div class="list-item"><div class="list-num">01</div><div><strong>Forget Gate layer:</strong> "What do we throw away?"<br><span class="formula-caption">σ(W_f · [h_{t-1}, x_t] + b_f)</span><br>Output 0 = complete forget, 1 = keep everything.</div></div><div class="list-item"><div class="list-num">02</div><div><strong>Input Gate layer:</strong> "What new info do we add?"<br>1. Sigmoid layer decides <strong>which values</strong> to update.<br>2. Tanh layer creates <strong>new candidate values</strong> (~C_t).</div></div><div class="list-item"><div class="list-num">03</div><div><strong>Update Cell State:</strong> The Critical Step<br><span class="formula" style="font-size:1.1rem">C_t = f_t * C_{t-1} + i_t * ~C_t</span><br>We multiply old state by f_t (forgetting things) and add i_t * ~C_t (adding new things).</div></div><div class="list-item"><div class="list-num">04</div><div><strong>Output Gate:</strong> "What do we reveal?"<br>We filter the cell state: h_t = o_t * tanh(C_t).</div></div><div class="callout insight"><div class="callout-title">💡 Intuition: Sigmoid vs Tanh</div>• <strong>Sigmoid (0 to 1):</strong> Acts like a valve or gate. Open/Close.<br>• <strong>Tanh (-1 to 1):</strong> Creates content/information. Normalized centered data.</div>`,math: `<h3>Paper & Pain: Why LSTMs Don't Vanish</h3><p>Let's look at the gradient flow in the Cell State equation:</p><div class="formula">C_t = f_t \cdot C_{t-1} + i_t \cdot \tilde{C}_t</div><p>During backpropagation (BPTT), the derivative of C_t with respect to C_{t-1} is:</p><div class="formula" style="color: #00ff88;">\frac{\partial C_t}{\partial C_{t-1}} = f_t + \dots</div><div class="callout tip"><div class="callout-title">✅ The Additive Gradient Highway</div>In standard RNNs, we had multiplicative gradients (W^t). <br>In LSTMs, the gradient is <strong>additive</strong>. If the Forget Gate f_t ≈ 1, the gradient passes through UNCHANGED (1.0).<br>The error signal can travel back 1000 steps without vanishing!</div><h3>Paper & Pain: Manual "Echo" Task</h3><p>Task: Input stream of 0s. If explicit "1" appears, remember it and output "1" 3 steps later.</p><div class="list-item"><div class="list-num">📝</div><div><strong>Strategy:</strong> Set Input Gate to Open (1) only on trigger. Set Forget Gate to Closed (1) to maintain memory.</div></div><div class="list-item"><div class="list-num">🧮</div><div><strong>Weights:</strong> We can manually solve for weights that force i_t high only when x_t=1.</div></div>`,applications: `<div class="info-box"><div class="box-title">🗣️ Sequence-to-Sequence</div><div class="box-content"><strong>Translation:</strong> Google Translate (pre-Transformer) used massive LSTM stacks (GNMT).</div></div><div class="info-box"><div class="box-title">✍️ Handwriting Generation</div><div class="box-content"><strong>Alex Graves (2013):</strong> LSTMs can generate realistic cursive handwriting by predicting pen coordinates.</div></div><div class="info-box"><div class="box-title">🎵 Music Composition</div><div class="box-content">Generating melody and chords where context (key signature, tempo) must be maintained for minutes.</div></div>`},1757 unmodified linesctx.beginPath();ctx.arc(x, y, radius, 0, Math.PI * 2);ctx.fill();// Draw connections to next layerif (layerIdx < layers.length - 1) {const nextLayerHeight = canvas.height / (layers[layerIdx + 1] + 1);const nextX = (layerIdx + 2) * layerWidth;for (let j = 0; j < layers[layerIdx + 1]; j++) {const nextY = (j + 1) * nextLayerHeight;const signalProgress = ((time / 500) + layerIdx * 0.5) % 1;ctx.strokeStyle = `rgba(0, 212, 255, ${0.3 + signalProgress * 0.3})`;ctx.lineWidth = 1;ctx.beginPath();ctx.moveTo(x + radius, y);ctx.lineTo(nextX - 12, nextY);ctx.stroke();// Animated signal dotconst dotX = x + radius + (nextX - 12 - x - radius) * signalProgress;const dotY = y + (nextY - y) * signalProgress;5 unmodified lines}}});ctx.fillStyle = '#00d4ff';ctx.font = 'bold 14px Arial';ctx.textAlign = 'center';ctx.fillText('🔄 Neural Network Animation', centerX, 25);}// Animated GNN with message passingfunction drawAnimatedGNN(ctx, canvas, time) {ctx.fillStyle = '#9900ff';42 unmodified linesctx.fillText(i, n.x, n.y + 4);});}// Animated attention matrixfunction drawAnimatedAttention(ctx, canvas, time) {const words = ['The', 'cat', 'sat', 'on', 'mat'];const cellSize = 50;const startX = (canvas.width - words.length * cellSize) / 2;const startY = 80;ctx.fillStyle = '#00d4ff';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('Self-Attention Animation', canvas.width / 2, 30);// Draw wordsctx.font = '12px Arial';words.forEach((word, i) => {ctx.fillStyle = '#e4e6eb';ctx.fillText(word, startX + i * cellSize + cellSize / 2, startY - 10);ctx.save();ctx.translate(startX - 20, startY + i * cellSize + cellSize / 2);ctx.fillText(word, 0, 0);ctx.restore();});// Animated attention weightsfor (let i = 0; i < words.length; i++) {for (let j = 0; j < words.length; j++) {const baseWeight = i === j ? 0.8 : 0.2 + Math.abs(i - j) * 0.1;const animatedWeight = baseWeight + Math.sin(time / 500 + i + j) * 0.2;const alpha = Math.max(0.1, Math.min(1, animatedWeight));ctx.fillStyle = `rgba(0, 212, 255, ${alpha})`;ctx.fillRect(startX + j * cellSize + 2, startY + i * cellSize + 2, cellSize - 4, cellSize - 4);ctx.fillStyle = '#e4e6eb';ctx.font = '10px Arial';ctx.fillText(animatedWeight.toFixed(2), startX + j * cellSize + cellSize / 2, startY + i * cellSize + cellSize / 2 + 4);}}}// Animated gradient flow for backpropfunction drawAnimatedGradientFlow(ctx, canvas, time) {ctx.fillStyle = '#ff6b35';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('Backpropagation - Gradient Flow', canvas.width / 2, 30);const layers = [2, 4, 4, 1];const layerWidth = canvas.width / (layers.length + 1);// Forward pass (left to right) - blueconst forwardProgress = (time / 2000) % 1;layers.forEach((neurons, layerIdx) => {const x = (layerIdx + 1) * layerWidth;const layerHeight = canvas.height / (neurons + 1);for (let i = 0; i < neurons; i++) {const y = (i + 1) * layerHeight;// Pulse effect based on forward passconst isActive = forwardProgress > layerIdx / layers.length;const radius = isActive ? 15 + Math.sin(time / 200) * 3 : 12;ctx.fillStyle = isActive ? '#00d4ff' : 'rgba(0, 212, 255, 0.3)';ctx.beginPath();ctx.arc(x, y, radius, 0, Math.PI * 2);ctx.fill();}});// Backward pass (right to left) - orange/red gradientsconst backwardProgress = ((time / 2000) + 0.5) % 1;for (let layerIdx = layers.length - 2; layerIdx >= 0; layerIdx--) {const x1 = (layerIdx + 1) * layerWidth;const x2 = (layerIdx + 2) * layerWidth;const gradientActive = backwardProgress > (layers.length - 2 - layerIdx) / (layers.length - 1);if (gradientActive) {const gradX = x2 - (x2 - x1) * ((backwardProgress * (layers.length - 1)) % 1);ctx.fillStyle = '#ff6b35';2 unmodified linesctx.fill();}}ctx.fillStyle = '#e4e6eb';ctx.font = '12px Arial';ctx.fillText('Forward: Blue → | Backward: Orange ←', canvas.width / 2, canvas.height - 20);}// Animated network for nn-basicsfunction drawAnimatedNetwork(ctx, canvas, time) {drawDefaultAnimation(ctx, canvas, time);}// Animated decision boundary for perceptronfunction drawAnimatedDecisionBoundary(ctx, canvas, time) {const centerX = canvas.width / 2;const centerY = canvas.height / 2;ctx.fillStyle = '#ff6b35';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('Perceptron Decision Boundary', canvas.width / 2, 30);// Animated rotating decision boundaryconst angle = time / 2000;const length = 200;ctx.strokeStyle = '#ff6b35';ctx.lineWidth = 3;ctx.beginPath();ctx.moveTo(centerX - Math.cos(angle) * length, centerY - Math.sin(angle) * length);ctx.lineTo(centerX + Math.cos(angle) * length, centerY + Math.sin(angle) * length);ctx.stroke();// Fixed sample pointsconst points = [{ x: 100, y: 80, c: 1 }, { x: 150, y: 100, c: 1 }, { x: 120, y: 150, c: 1 },{ x: 400, y: 200, c: 0 }, { x: 450, y: 180, c: 0 }, { x: 380, y: 250, c: 0 }];points.forEach(p => {ctx.fillStyle = p.c === 1 ? '#00d4ff' : '#00ff88';ctx.beginPath();1 unmodified linectx.fill();});}function drawAnimatedMLP(ctx, canvas, time) {drawDefaultAnimation(ctx, canvas, time);}function drawAnimatedActivations(ctx, canvas, time) {drawActivationFunctions(ctx, canvas);// Add animated input markerconst x = Math.sin(time / 500) * 4;const centerX = canvas.width / 2;const centerY = canvas.height / 2;const scale = 40;ctx.fillStyle = '#ffffff';ctx.beginPath();ctx.arc(centerX + x * scale, centerY, 6, 0, Math.PI * 2);ctx.fill();ctx.strokeStyle = '#ffffff';ctx.setLineDash([5, 5]);ctx.beginPath();2 unmodified linesctx.stroke();ctx.setLineDash([]);}function drawAnimatedConvolution(ctx, canvas, time) {drawConvolutionAnimation(ctx, canvas);}function drawAnimatedGAN(ctx, canvas, time) {ctx.fillStyle = '#ffaa00';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('GAN Training Animation', canvas.width / 2, 30);const phase = Math.floor(time / 1000) % 4;// Generatorctx.fillStyle = phase <= 1 ? '#00ff88' : 'rgba(0, 255, 136, 0.3)';ctx.fillRect(50, 100, 100, 80);ctx.fillStyle = '#e4e6eb';ctx.font = '12px Arial';ctx.fillText('Generator', 100, 145);// Fake imageconst noiseToFake = Math.sin(time / 300) * 0.5 + 0.5;ctx.fillStyle = `rgba(255, 170, 0, ${noiseToFake})`;ctx.fillRect(200, 110, 60, 60);ctx.fillStyle = '#e4e6eb';ctx.fillText('Fake', 230, 200);// Discriminatorctx.fillStyle = phase >= 2 ? '#ff6b35' : 'rgba(255, 107, 53, 0.3)';ctx.fillRect(320, 100, 100, 80);ctx.fillStyle = '#e4e6eb';ctx.fillText('Discriminator', 370, 145);// Outputconst output = phase === 3 ? 'Real?' : 'Fake?';ctx.fillStyle = '#00d4ff';ctx.font = 'bold 14px Arial';ctx.fillText(output, 370, 220);// Arrowsctx.strokeStyle = '#e4e6eb';ctx.lineWidth = 2;6 unmodified linesctx.lineTo(320, 140);ctx.stroke();}function drawAnimatedDiffusion(ctx, canvas, time) {ctx.fillStyle = '#9900ff';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('Diffusion Process Animation', canvas.width / 2, 30);const steps = 5;const stepWidth = canvas.width / (steps + 1);const progress = (time / 3000) % 1;const currentStep = Math.floor(progress * steps);for (let i = 0; i < steps; i++) {const x = (i + 1) * stepWidth;const y = 150;const noiseLevel = i / (steps - 1);const isActive = i <= currentStep;// Draw square with noisectx.fillStyle = isActive ? '#9900ff' : 'rgba(153, 0, 255, 0.3)';ctx.fillRect(x - 30, y - 30, 60, 60);// Add noise dotsif (noiseLevel > 0) {for (let j = 0; j < noiseLevel * 20; j++) {3 unmodified linesctx.fillRect(nx, ny, 2, 2);}}ctx.fillStyle = '#e4e6eb';ctx.font = '10px Arial';ctx.fillText(`t=${i}`, x, y + 50);}ctx.fillStyle = '#e4e6eb';ctx.font = '12px Arial';ctx.fillText('Clean → Noisy (Forward) | Noisy → Clean (Reverse)', canvas.width / 2, canvas.height - 20);}function drawAnimatedRNN(ctx, canvas, time) {ctx.fillStyle = '#00d4ff';ctx.font = 'bold 16px Arial';ctx.textAlign = 'center';ctx.fillText('RNN Unrolled Through Time', canvas.width / 2, 30);const steps = 5;const stepWidth = canvas.width / (steps + 1);const progress = (time / 500) % steps;const activeStep = Math.floor(progress);for (let i = 0; i < steps; i++) {const x = (i + 1) * stepWidth;const y = 150;const isActive = i === activeStep;// Hidden statectx.fillStyle = isActive ? '#00d4ff' : 'rgba(0, 212, 255, 0.3)';ctx.beginPath();ctx.arc(x, y, 25, 0, Math.PI * 2);ctx.fill();ctx.fillStyle = '#e4e6eb';ctx.font = '10px Arial';ctx.fillText(`h${i}`, x, y + 4);// Input arrowctx.strokeStyle = isActive ? '#00ff88' : 'rgba(0, 255, 136, 0.3)';ctx.lineWidth = 2;2 unmodified linesctx.lineTo(x, y + 25);ctx.stroke();ctx.fillText(`x${i}`, x, y + 75);// Recurrent connectionif (i < steps - 1) {ctx.strokeStyle = isActive ? '#ff6b35' : 'rgba(255, 107, 53, 0.3)';1 unmodified linectx.moveTo(x + 25, y);ctx.lineTo(x + stepWidth - 25, y);ctx.stroke();// Animated signalif (isActive) {const signalX = x + 25 + (stepWidth - 50) * (progress % 1);
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308<!DOCTYPE html><html lang="en">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Data Science & AI Masterclass | Aashish Garg</title> <style> :root { --bg-color: #0d1117; --card-bg: #161b22; --text-primary: #c9d1d9; --text-secondary: #8b949e; --accent-dl: #ff6b35; /* Deep Learning Orange */ --accent-ml: #00d4ff; /* ML Cyan */ --accent-math: #a371f7; /* Math Purple */ --accent-stats: #2ecc71; /* Stats Green */ --border: #30363d; --hover-border: #8b949e; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-primary); line-height: 1.6; padding: 40px; }
.container { max-width: 1200px; margin: 0 auto; }
header { text-align: center; margin-bottom: 60px; border-bottom: 1px solid var(--border); padding-bottom: 40px; }
h1 { font-size: 3rem; margin-bottom: 10px; background: linear-gradient(45deg, #00d4ff, #a371f7, #ff6b35); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
p.subtitle { font-size: 1.2rem; color: var(--text-secondary); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 25px; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 25px; text-decoration: none; color: inherit; transition: transform 0.2s, border-color 0.2s; display: flex; flex-direction: column; justify-content: space-between; }
.card:hover { transform: translateY(-5px); border-color: var(--hover-border); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; margin-bottom: 15px; text-transform: uppercase; }
.card h2 { font-size: 1.5rem; margin-bottom: 10px; color: #fff; }
.card p { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 20px; }
.card-footer { display: flex; align-items: center; font-size: 0.9rem; font-weight: bold; }
.arrow { margin-left: auto; transition: transform 0.2s; }
.card:hover .arrow { transform: translateX(5px); }
/* Module Specific Styles */ .dl-card .badge { background: rgba(255, 107, 53, 0.15); color: #ff6b35; }
.dl-card:hover { border-color: #ff6b35; }
.ml-card .badge { background: rgba(0, 212, 255, 0.15); color: #00d4ff; }
.ml-card:hover { border-color: #00d4ff; }
.math-card .badge { background: rgba(163, 113, 247, 0.15); color: #a371f7; }
.math-card:hover { border-color: #a371f7; }
.stats-card .badge { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.stats-card:hover { border-color: #2ecc71; }
.viz-card .badge { background: rgba(255, 206, 86, 0.15); color: #ffce56; }
.viz-card:hover { border-color: #ffce56; }
.prompt-card .badge { background: rgba(247, 113, 182, 0.15); color: #f771b6; }
.prompt-card:hover { border-color: #f771b6; } </style></head>
<body> <div class="container"> <header> <h1>Data Science & AI Masterclass</h1> <p class="subtitle">Comprehensive curriculum from Fundamentals to Deep Learning</p> </header>
<div class="grid"> <!-- Deep Learning --> <a href="DeepLearning/index.html" class="card dl-card"> <div> <span class="badge">🔥 Flagship Course</span> <h2>Deep Learning Masterclass</h2> <p>Complete Zero to Hero journey. CNNs, RNNs, LSTMs, Transformers, GANs, and Diffusion Models. Featuring rigorous "Paper & Pain" math and interactive visualizations.</p> </div> <div class="card-footer"> <span style="color: var(--accent-dl)">Explore Curriculum</span> <span class="arrow">→</span> </div> </a>
<!-- Machine Learning --> <a href="ml_complete-all-topics/index.html" class="card ml-card"> <div> <span class="badge">Core</span> <h2>Machine Learning Complete</h2> <p>The foundation. Regression, Classification, Clustering, SVMs, Decision Trees, and Ensembles. Master Scikit-Learn.</p> </div> <div class="card-footer"> <span style="color: var(--accent-ml)">Start Learning</span> <span class="arrow">→</span> </div> </a>
<!-- ML Lab / Projects --> <a href="ML/index.html" class="card ml-card"> <div> <span class="badge">Lab</span> <h2>ML Experiments & Data</h2> <p>Hands-on laboratory for datasets, experimental scripts, and practical ML applications.</p> </div> <div class="card-footer"> <span style="color: var(--accent-ml)">Enter Lab</span> <span class="arrow">→</span> </div> </a>
<!-- Math --> <a href="math-ds-complete/index.html" class="card math-card"> <div> <span class="badge">Foundation</span> <h2>Mathematics for AI</h2> <p>Calculus, Linear Algebra, and Probability. The engine room of AI. Derivatives, Matrix Operations, and Eigenvalues.</p> </div> <div class="card-footer"> <span style="color: var(--accent-math)">Study Math</span> <span class="arrow">→</span> </div> </a>
<!-- Statistics --> <a href="complete-statistics/index.html" class="card stats-card"> <div> <span class="badge">Foundation</span> <h2>Statistics Complete</h2> <p>Descriptive and Inferential Statistics. Hypothesis testing, Distributions, P-values, and Bayesian concepts.</p> </div> <div class="card-footer"> <span style="color: var(--accent-stats)">Analyze Data</span> <span class="arrow">→</span> </div> </a>
<!-- Feature Engineering --> <a href="feature-engineering/index.html" class="card viz-card"> <div> <span class="badge">Skill</span> <h2>Feature Engineering</h2> <p>Data cleaning, transformation, scaling, encoding, and selection. The art of preparing data for models.</p> </div> <div class="card-footer"> <span style="color: #ffce56">Master Data</span> <span class="arrow">→</span> </div> </a>
<!-- Visualization --> <a href="Visualization/index.html" class="card viz-card"> <div> <span class="badge">Skill</span> <h2>Data Visualization</h2> <p>Matplotlib, Seaborn, Plotly. Communicating insights effectively through beautiful charts and dashboards.</p> </div> <div class="card-footer"> <span style="color: #ffce56">Visualize</span> <span class="arrow">→</span> </div> </a>
<!-- Prompt Engineering --> <a href="prompt-engineering-guide/index.html" class="card prompt-card"> <div> <span class="badge">New</span> <h2>Prompt Engineering</h2> <p>Mastering LLMs. Zero-shot, Few-shot, Chain-of-Thought, and advanced prompting strategies for GPT-4/Claude.</p> </div> <div class="card-footer"> <span style="color: #f771b6">Learn Prompting</span> <span class="arrow">→</span> </div> </a>
</div> </div></body>
</html>DeepLearning/index.html+145-111
index.htmlAdded+308