Reinforcement Learning: Learning Through Actions
هوش مصنوعی برای همه: هوش مصنوعی چطور باهوش شد؟
- An agent, an environment, observations, actions, and rewards in a small maze game.
- A policy as a strategy for selecting actions.
- Immediate rewards versus longer-term outcomes.
- Exploration and exploitation.
- How repeated interaction differs from learning from a fixed set of labeled examples.
- Connections between learned strategies and game search.
- Sparse rewards, costly trial and error, and behavior that maximizes an imperfectly designed reward.
چرخهٔ تجربه در هزارتو
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" class="tm-arrow"/></marker></defs><rect x="35" y="85" width="205" height="260" rx="14" class="tm-soft"/><text x="137" y="112" class="tm-text" font-size="18" text-anchor="middle">environment</text><text x="137" y="139" class="tm-text2" font-size="14" text-anchor="middle" direction="rtl">هزارتو</text><path d="M75 290 L75 190 L125 190 L125 240 L185 240 L185 160 L215 160" fill="none" stroke="currentColor" stroke-width="8" class="tm-line"/><path d="M125 190 L125 155" fill="none" stroke="currentColor" stroke-width="8" class="tm-line"/><circle cx="125" cy="190" r="13" class="tm-accent tm-pulse"/><text x="75" y="322" class="tm-text" font-size="14" text-anchor="middle" direction="rtl">ورودی</text><text x="215" y="148" class="tm-text" font-size="14" text-anchor="middle" direction="rtl">خروجی</text><rect x="300" y="135" width="180" height="150" rx="14" class="tm-surface"/><text x="390" y="185" class="tm-text" font-size="18" text-anchor="middle">agent</text><text x="390" y="218" class="tm-text2" font-size="14" text-anchor="middle" direction="rtl">عامل</text><path d="M240 200 L300 200" fill="none" stroke="currentColor" stroke-width="3" marker-end="url(#arrow)" class="tm-line"/><text x="270" y="185" class="tm-muted" font-size="13" text-anchor="middle">observation</text><path d="M480 190 L550 190" fill="none" stroke="currentColor" stroke-width="3" marker-end="url(#arrow)" class="tm-line-accent"/><text x="515" y="174" class="tm-text-accent" font-size="13" text-anchor="middle">action</text><rect x="550" y="135" width="205" height="150" rx="14" class="tm-gold"/><text x="652" y="188" class="tm-text" font-size="18" text-anchor="middle" direction="rtl">حرکت به راست</text><text x="652" y="222" class="tm-text2" font-size="14" text-anchor="middle" direction="rtl">جابهجایی مهره</text><path d="M550 250 C470 350 320 355 240 270" fill="none" stroke="currentColor" stroke-width="3" marker-end="url(#arrow)" class="tm-line-accent tm-flow"/><rect x="535" y="305" width="220" height="62" rx="12" class="tm-accent tm-enter"/><text x="645" y="331" class="tm-text" font-size="15" text-anchor="middle" direction="rtl">مشاهدهٔ تازه + پاداش</text><text x="645" y="352" class="tm-text" font-size="14" text-anchor="middle" direction="rtl">۰</text></svg>
```
راهبرد با تجربه تغییر میکند
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" class="tm-arrow"/></marker></defs><rect x="30" y="45" width="170" height="90" rx="12" class="tm-soft"/><text x="115" y="82" text-anchor="middle" class="tm-text" font-size="18" direction="rtl">ورودی</text><text x="115" y="110" text-anchor="middle" class="tm-muted" font-size="15" direction="rtl">انتخاب عمل</text><rect x="310" y="45" width="180" height="90" rx="12" class="tm-soft"/><text x="400" y="82" text-anchor="middle" class="tm-text" font-size="18" direction="rtl">راست باز است</text><text x="400" y="110" text-anchor="middle" class="tm-text" font-size="15" direction="rtl">برو راست</text><rect x="600" y="45" width="165" height="90" rx="12" class="tm-soft"/><text x="682" y="82" text-anchor="middle" class="tm-text" font-size="18" direction="rtl">بنبست</text><text x="682" y="110" text-anchor="middle" class="tm-muted" font-size="15" direction="rtl">بازی از ورودی</text><path d="M200 90 L300 90" class="tm-line" marker-end="url(#arrow)"/><path d="M490 90 L590 90" class="tm-line" marker-end="url(#arrow)"/><rect x="30" y="225" width="170" height="90" rx="12" class="tm-soft"/><text x="115" y="262" text-anchor="middle" class="tm-text" font-size="18" direction="rtl">انتخاب دوباره</text><text x="115" y="290" text-anchor="middle" class="tm-muted" font-size="15" direction="rtl">تجربه کافی</text><rect x="310" y="225" width="180" height="90" rx="12" class="tm-green"/><text x="400" y="262" text-anchor="middle" class="tm-text" font-size="18" direction="rtl">مسیر دیگر</text><text x="400" y="290" text-anchor="middle" class="tm-text" font-size="15" direction="rtl">ترجیح تازه</text><path d="M200 270 L300 270" class="tm-line" marker-end="url(#arrow)"/><rect x="30" y="365" width="165" height="60" rx="10" class="tm-soft tm-enter"/><text x="112" y="402" text-anchor="middle" class="tm-text" font-size="16">supervised learning</text><rect x="230" y="365" width="165" height="60" rx="10" class="tm-soft tm-enter"/><text x="312" y="402" text-anchor="middle" class="tm-text" font-size="16" direction="rtl">پاسخ برچسبدار</text><rect x="430" y="365" width="165" height="60" rx="10" class="tm-soft tm-enter"/><text x="512" y="402" text-anchor="middle" class="tm-text" font-size="16" direction="rtl">جستوجو</text><rect x="630" y="365" width="135" height="60" rx="10" class="tm-gold tm-enter"/><text x="697" y="402" text-anchor="middle" class="tm-text" font-size="16" direction="rtl">ترکیبپذیر</text><path d="M595 395 L620 395" class="tm-line-accent tm-flow" marker-end="url(#arrow)"/></svg>
```
مقایسهٔ پیامد دو مسیر
دو مسیر، هرکدام با دو حرکت؛ معیار: جمع پاداشها تا پایان بازی، بدون تنزیل.
**مسیر اول: حرکت نخست**
\[ R_1=+2 \]
راست: سکه
**مسیر اول: پایان**
\[ R_1+0=2+0=2 \]
پایین: چاله؛ پایان بازی
**مسیر دوم: حرکت نخست**
\[ R_2=0 \]
بالا؛ پاداش فوری صفر
**مسیر دوم: پایان**
\[ R_2+6=0+6=6 \]
راست: خروجی؛ پایان بازی
**مقایسهٔ نهایی**
\[ 6>2 \]
مسیر دوم بهتر است؛ صفرِ نخستین حرکت، خطا بودن آن را ثابت نمیکند
تعادل میان تجربه و کشف
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" class="tm-arrow"/></marker></defs><rect x="70" y="170" width="210" height="100" rx="16" class="tm-surface"/><text x="175" y="215" text-anchor="middle" class="tm-text" font-size="20" direction="rtl">مسیر آشنا</text><text x="175" y="245" text-anchor="middle" class="tm-muted" font-size="16">exploitation</text><rect x="520" y="170" width="210" height="100" rx="16" class="tm-soft"/><text x="625" y="215" text-anchor="middle" class="tm-text" font-size="20" direction="rtl">راهروی ناشناخته</text><text x="625" y="245" text-anchor="middle" class="tm-muted" font-size="16">exploration</text><circle cx="400" cy="220" r="42" class="tm-surface"/><text x="400" y="226" text-anchor="middle" class="tm-text" font-size="16" direction="rtl">عامل</text><path d="M358 205 C330 185 310 185 285 205" fill="none" class="tm-line" marker-end="url(#arrow)"/><path d="M442 205 C470 185 490 185 515 205" fill="none" class="tm-line-accent" marker-end="url(#arrow)"/><text x="320" y="155" text-anchor="middle" class="tm-muted" font-size="15" direction="rtl">بهرهگیری از تجربه</text><text x="480" y="155" text-anchor="middle" class="tm-text-accent" font-size="15" direction="rtl">کشف انتخاب بهتر</text><rect x="290" y="330" width="220" height="58" rx="12" class="tm-gold tm-enter"/><text x="400" y="365" text-anchor="middle" class="tm-text" font-size="17" direction="rtl">هزینهٔ اشتباه را بسنج</text><path d="M400 262 L400 325" class="tm-line"/></svg>
```
پاداش و هدف واقعی
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" class="tm-arrow"/></marker></defs><rect x="70" y="150" width="170" height="90" rx="12" class="tm-surface"/><text x="155" y="190" class="tm-text" font-size="18" text-anchor="middle" direction="rtl">ورودی</text><rect x="315" y="150" width="170" height="90" rx="12" class="tm-gold"/><text x="400" y="190" class="tm-text-gold" font-size="18" text-anchor="middle" direction="rtl">خانهٔ سکه</text><rect x="560" y="150" width="170" height="90" rx="12" class="tm-green"/><text x="645" y="190" class="tm-text-green" font-size="18" text-anchor="middle" direction="rtl">خروجی</text><path d="M240 195 L315 195" class="tm-line" marker-end="url(#arrow)"/><path d="M485 195 L560 195" class="tm-line" marker-end="url(#arrow)"/><text x="400" y="290" class="tm-text" font-size="17" text-anchor="middle" direction="rtl">فقط اولین برداشتن: پاداش</text><text x="400" y="330" class="tm-muted" font-size="17" text-anchor="middle" direction="rtl">سکه ناپدید میشود</text><text x="645" y="375" class="tm-text-green" font-size="17" text-anchor="middle" direction="rtl">ایراد مشخص بسته میشود</text></svg>
```
Back to course