Deep Learning Academy · درس

Variational Autoencoders والفضاء الكامن

ولّد عينات بيانات جديدة من توزيع متعلَّم

الدرس 3 من 413 خطوة

Variational Autoencoders والفضاء الكامن درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Deep Learning Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Beyond Plain Codes

A variational autoencoder, or VAE, does not store one fixed code per input. Instead it learns a smooth, organized latent space you can actually sample from.

Encode to a Distribution

The VAE encoder outputs a mean and a variance instead of a single point. Each input becomes a little cloud of likely latent codes.

mu, logvar = encoder(x)

Sample From the Cloud

To get a code, you sample from that cloud using its mean and variance. Sampling adds the randomness that makes the space generative.

The Reparameterization Trick

Random sampling blocks gradients, so the reparameterization trick moves the randomness aside. Now you can still backpropagate through the sample.

std = torch.exp(0.5 * logvar)
z = mu + std * torch.randn_like(std)

Two Losses, Not One

A VAE balances two goals: reconstruction loss for accurate rebuilds, plus a term that shapes the latent space. They pull against each other.

The KL Divergence Term

The second loss is the KL divergence. It nudges each cloud toward a standard normal, keeping the latent space tidy and continuous.

kl = -0.5 * torch.sum(1 + logvar - mu**2 - logvar.exp())

A Smooth Latent Space

Thanks to the KL term, nearby codes decode to similar outputs. This smoothness means you can walk between points and get sensible results. ✨

Generate Brand-New Data

Because the space is organized, you can sample new codes from a normal distribution and decode them into fresh, never-seen samples.

z = torch.randn(1, latent_dim)
new_sample = decoder(z)

Interpolate Between Inputs

Blend two latent codes and decode the mix to morph one input into another. This smooth interpolation is a signature VAE trick.

z = 0.5 * z_a + 0.5 * z_b

VAE vs Plain Autoencoder

A plain autoencoder compresses; a VAE compresses and becomes generative. The extra KL term is what unlocks sampling new data.

Tune the Balance

Weighting the KL term, often called beta, controls the tradeoff. Higher beta gives a cleaner space but slightly blurrier reconstructions.

Quick Check

What gives a VAE its generative power?

Recap

A VAE encodes inputs as distributions, samples with the reparameterization trick, and adds a KL term for a smooth space you can sample and interpolate. 🎉

البدء مجانًا

تعلم Python مع معلم ذكاء اصطناعي — مجانًا

اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.

الدورات
30
الدروس
120

الأسئلة الشائعة

هل درس «Variational Autoencoders والفضاء الكامن» مجاني؟

نعم — نص درس «Variational Autoencoders والفضاء الكامن» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.

ماذا ستتعلم في «Variational Autoencoders والفضاء الكامن»؟

ولّد عينات بيانات جديدة من توزيع متعلَّم تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟

لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.

كم من الوقت يستغرق درس «Variational Autoencoders والفضاء الكامن»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟

نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. Encoder وBottleneck وDecoder
  2. Autoencoders لإزالة التشويش
  3. Variational Autoencoders والفضاء الكامن
  4. اكتشاف الشذوذ بخطأ إعادة البناء
← العودة إلى Deep Learning Academy