<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>마코프 확장 | The Logos</title><link>https://thelogos.dev/tags/%EB%A7%88%EC%BD%94%ED%94%84-%ED%99%95%EC%9E%A5/</link><description>AI-friendly Korean/English knowledge hub designed for fast crawling while remaining welcoming to human visitors.</description><generator>Hugo 0.148.2</generator><language>ko-KR</language><managingEditor/><webMaster/><lastBuildDate>Tue, 16 Jun 2026 12:44:55 +0000</lastBuildDate><atom:link href="https://thelogos.dev/tags/%EB%A7%88%EC%BD%94%ED%94%84-%ED%99%95%EC%9E%A5/index.xml" rel="self" type="application/rss+xml"/><item><title>DSR(Deflated Sharpe Ratio): 좋아 보이는 백테스트를 의심하는 법</title><link>https://thelogos.dev/posts/deflated-sharpe-ratio/</link><pubDate>Tue, 16 Jun 2026 00:50:00 +0900</pubDate><dc:creator>DaeYoung Kim</dc:creator><category>engineering</category><category>Deflated Sharpe Ratio</category><category>DSR</category><category>Quant</category><category>Backtest</category><category>Overfitting</category><category>Sharpe Ratio</category><category>마코프 확장</category><guid isPermaLink="true">https://thelogos.dev/posts/deflated-sharpe-ratio/</guid><description>&lt;div
class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group">
&lt;div
class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none">
&lt;/div>
&lt;div class="relative z-10 flex items-start gap-4">
&lt;div class="flex-1">
&lt;div class="flex items-center gap-2 mb-2">
&lt;span
class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm">
&lt;svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
&lt;path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6">&lt;/path>
&lt;/svg>
AI 요약
&lt;/span>
&lt;/div>
&lt;div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&amp;>p]:m-0">
DSR은 관측된 Sharpe가 많은 후보 탐색, 짧은 표본, 비정규 수익률 때문에 부풀려졌는지 낮춰 보는 지표다. 후보 수가 늘면 요구 Sharpe가 올라가고, 기간이 짧거나 꼬리가 두꺼운 분포일수록 신뢰도는 낮아진다. 왜도와 첨도는 단순 숫자가 아니라 수익률 분포의 꼬리와 비대칭을 바꾸는 위험 신호다.
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽&lt;/h2>
&lt;p>관측 Sharpe, 후보 수, 기간뿐 아니라 왜도와 첨도를 움직여보면 분포의 비대칭과 꼬리 두께가 신뢰도 판단을 어떻게 바꾸는지 볼 수 있다. 기존 막대형 표시 대신 분포 곡선과 꼬리 위험 영역을 함께 그린다.&lt;/p></description><content:encoded>&lt;![CDATA[<div class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group"><div class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none"/><div class="relative z-10 flex items-start gap-4"><div class="flex-1"><div class="flex items-center gap-2 mb-2"><span class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm"><svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/></svg>
AI 요약</span></div><div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&>p]:m-0">
DSR은 관측된 Sharpe가 많은 후보 탐색, 짧은 표본, 비정규 수익률 때문에 부풀려졌는지 낮춰 보는 지표다. 후보 수가 늘면 요구 Sharpe가 올라가고, 기간이 짧거나 꼬리가 두꺼운 분포일수록 신뢰도는 낮아진다. 왜도와 첨도는 단순 숫자가 아니라 수익률 분포의 꼬리와 비대칭을 바꾸는 위험 신호다.</div></div></div></div><h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽</h2><p>관측 Sharpe, 후보 수, 기간뿐 아니라 왜도와 첨도를 움직여보면 분포의 비대칭과 꼬리 두께가 신뢰도 판단을 어떻게 바꾸는지 볼 수 있다. 기존 막대형 표시 대신 분포 곡선과 꼬리 위험 영역을 함께 그린다.</p><style>
.thelogos-interactive-frame-shell {
box-sizing: border-box;
width: 100%;
max-width: 100%;
margin: 36px 0 56px;
overflow: hidden;
border: 1px solid rgba(15, 23, 42, 0.16);
border-radius: 18px;
background: #07111f;
box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}
.dark .thelogos-interactive-frame-shell,
body.dark .thelogos-interactive-frame-shell {
border-color: rgba(255, 255, 255, 0.12);
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}
.thelogos-interactive-frame-shell iframe {
display: block;
width: 100%;
min-height: 680px;
border: 0;
background: #07111f;
}
.thelogos-interactive-frame-fallback {
padding: 16px 18px;
margin: 0;
color: #d7e5f5;
background: #0f1d33;
}
@media (max-width: 640px) {
.thelogos-interactive-frame-shell {
margin-top: 28px;
margin-bottom: 44px;
border-radius: 14px;
}
.thelogos-interactive-frame-shell iframe {
min-height: 760px;
}
}</style><div class="thelogos-interactive-frame-shell"><iframe src="/markov-extensions/deflated-sharpe-ratio/" title="DSR(Deflated Sharpe Ratio): 좋아 보이는 백테스트를 의심하는 법 인터랙티브 인포그래픽" loading="lazy" scrolling="no"/><noscript><p class="thelogos-interactive-frame-fallback">
자바스크립트가 꺼져 있으면 인터랙티브 인포그래픽이 표시되지 않을 수 있다.<a href="/markov-extensions/deflated-sharpe-ratio/">인포그래픽 페이지를 직접 열기</a></p></noscript></div><script>
(function () {
const shell = document.currentScript.previousElementSibling;
const iframe = shell && shell.querySelector('iframe');
if (!iframe) return;
function currentTheme() {
return (document.documentElement.classList.contains('dark') || document.body.classList.contains('dark')) ? 'dark' : 'light';
}
function syncTheme() {
iframe.contentWindow?.postMessage({
type: 'thelogos-interactive-theme',
theme: currentTheme()
}, window.location.origin);
}
window.addEventListener('message', function (event) {
if (event.origin !== window.location.origin || event.source !== iframe.contentWindow || event.data?.type !== 'thelogos-interactive-height') return;
const nextHeight = Math.max(680, Math.ceil(Number(event.data.height) || 0));
iframe.style.height = nextHeight + 'px';
});
iframe.addEventListener('load', syncTheme);
const observer = new MutationObserver(syncTheme);
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
observer.observe(document.body, { attributes: true, attributeFilter: ['class'] });
syncTheme();
}());</script><h2 id="1-요약-executive-summary">1. 요약 (Executive Summary)</h2><p>퀀트 전략을 만들 때 가장 위험한 순간은 백테스트 성과가 매우 좋아 보일
때다. 샤프지수가 높고, MDD가 낮고, 승률이 좋아 보이면 전략이 발견된
것처럼 느껴진다. 하지만 많은 후보를 반복적으로 테스트했다면 이야기가
달라진다.
동전을 1,000번 던지는 실험을 여러 사람이 반복하면, 그중 누군가는
우연히 앞면이 많이 나올 수 있다. 마찬가지로 수백 개의 전략 파라미터를
돌리면, 실제 알파가 없어도 그중 하나는 백테스트에서 좋아 보일 수
있다.
DSR은 이 문제를 다룬다.</p><blockquote><p>“이 Sharpe는 실력인가, 아니면 많은 시도 중 우연히 살아남은
착시인가?”</p></blockquote><h2 id="2-일반-sharpe-ratio의-한계">2. 일반 Sharpe Ratio의 한계</h2><p>Sharpe Ratio는 다음과 같은 구조를 가진다.</p><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>Sharpe Ratio = 평균 초과수익 / 수익률 표준편차</span></span></code></pre></div><p>간단하고 직관적이지만 세 가지 문제가 있다.
첫째, 표본이 짧으면 성과가 쉽게 부풀려진다. 둘째, 수익률이 정규분포가
아니면 평균과 표준편차만으로 위험을 충분히 설명하지 못한다. 셋째, 여러
후보를 테스트한 뒤 가장 좋은 전략만 보고하면 선택 편향이 생긴다.</p><h2 id="3-dsr이-보정하려는-것">3. DSR이 보정하려는 것</h2><p>Bailey와 López de Prado의 DSR은 크게 두 가지 성과 인플레이션을
보정하려 한다.</p><ul><li>여러 번의 테스트로 인한 선택 편향</li><li>비정규 수익률 분포로 인한 Sharpe 신뢰도 왜곡
논문에서는 DSR을 Probabilistic Sharpe Ratio의 확장으로 설명한다. 단,
기준 Sharpe를 사용자가 임의로 정하는 대신, 여러 후보를 테스트했을 때
우연히 기대되는 최대 Sharpe를 반영해 임계치를 높인다.</li></ul><h2 id="4-직관적-예시">4. 직관적 예시</h2><p>전략 후보를 3개만 테스트했다면 Sharpe 1.2는 꽤 강해 보일 수 있다.
하지만 후보를 3,000개 테스트했다면 Sharpe 1.2는 그렇게 놀랍지 않을 수
있다. 우연히 좋은 결과가 나올 기회가 그만큼 많았기 때문이다.
따라서 퀀트 시스템에서 중요한 것은 “Sharpe가 얼마인가?”만이
아니다.</p><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>Sharpe가 얼마인가?</span></span><span style="display:flex;"><span>표본은 충분히 긴가?</span></span><span style="display:flex;"><span>몇 개 후보 중에서 선택된 것인가?</span></span><span style="display:flex;"><span>수익률 분포는 정규분포에 가까운가?</span></span><span style="display:flex;"><span>거래비용과 체결 가능성은 반영되었는가?</span></span></code></pre></div><p>이 질문을 함께 해야 한다.</p><h2 id="5-dsr이-유용한-상황">5. DSR이 유용한 상황</h2><p>DSR은 특히 자동 전략 생성 시스템에서 중요하다. 유전 알고리즘,
베이지안 최적화, 파라미터 그리드 서치, LLM 기반 전략 생성처럼 수많은
후보를 만들고 필터링하는 구조에서는 과최적화 위험이 크다.
이때 DSR은 승격 게이트 역할을 할 수 있다. 단순히 백테스트 Sharpe가
높다는 이유로 후보를 live 또는 probation 단계로 보내지 않고, 여러 후보
중 우연히 살아남은 전략인지 먼저 의심한다.</p><h2 id="6-dsr이-해결하지-못하는-것">6. DSR이 해결하지 못하는 것</h2><p>DSR은 강력하지만 만능은 아니다. 데이터 누수, survivorship bias,
거래비용 누락, 체결 불가능한 주문, 시장 시간 처리 오류, 리밸런싱 지연
같은 구현 문제는 DSR만으로 잡을 수 없다.
또한 DSR은 통계적 신뢰도를 보는 도구이지, 전략의 경제적 논리를
보장하지 않는다. 좋은 퀀트 검증은 통계 지표와 경제적 설명을 함께
요구해야 한다.</p><h2 id="7-결론">7. 결론</h2><p>DSR은 백테스트 성과를 낮춰 보기 위한 도구다. 이는 비관주의가 아니라
생존을 위한 절차다. 시장은 작은 착각을 빠르게 벌한다. 따라서 전략이 좋아
보일수록 더 강하게 의심해야 한다.
좋은 전략 검증의 기본 태도는 다음과 같다.</p><blockquote><p>“성과가 좋다”가 아니라 “우연, 과최적화, 비정규성, 비용을 이겨낸
뒤에도 성과가 남는가?”</p></blockquote><h2 id="참고자료">참고자료</h2><ul><li>MathWorks, “Kalman Filter - MATLAB &amp; Simulink”, 확인일:
2026-06-16,<a href="https://www.mathworks.com/discovery/kalman-filter.html">https://www.mathworks.com/discovery/kalman-filter.html</a></li><li>Alex Becker, “Kalman Filter Explained Through Examples”, 확인일:
2026-06-16,<a href="https://kalmanfilter.net/">https://kalmanfilter.net/</a></li><li>Stan Reference Manual, “MCMC Sampling”, 확인일: 2026-06-16,<a href="https://mc-stan.org/docs/reference-manual/mcmc.html">https://mc-stan.org/docs/reference-manual/mcmc.html</a></li><li>MIT OpenCourseWare, “Lecture 25: Random Walks”, 확인일: 2026-06-16,<a href="https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/">https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/</a></li><li>Stanford CS221, “Markov Decisions”, 확인일: 2026-06-16,<a href="https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html">https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html</a></li><li>Bailey, D. H. &amp; López de Prado, M., “The Deflated Sharpe Ratio:
Correcting for Selection Bias, Backtest Overfitting and Non-Normality”,
Journal of Portfolio Management, 2014; SSRN 확인일: 2026-06-16,<a href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551">https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551</a></li></ul>
]]></content:encoded></item><item><title>강화학습과 MDP: 불확실한 세계에서 행동을 선택하는 수학</title><link>https://thelogos.dev/posts/rl-mdp/</link><pubDate>Tue, 16 Jun 2026 00:40:00 +0900</pubDate><dc:creator>DaeYoung Kim</dc:creator><category>engineering</category><category>Reinforcement Learning</category><category>MDP</category><category>Markov Decision Process</category><category>AI</category><category>제어</category><category>마코프 확장</category><guid isPermaLink="true">https://thelogos.dev/posts/rl-mdp/</guid><description>&lt;div
class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group">
&lt;div
class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none">
&lt;/div>
&lt;div class="relative z-10 flex items-start gap-4">
&lt;div class="flex-1">
&lt;div class="flex items-center gap-2 mb-2">
&lt;span
class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm">
&lt;svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
&lt;path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6">&lt;/path>
&lt;/svg>
AI 요약
&lt;/span>
&lt;/div>
&lt;div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&amp;>p]:m-0">
MDP는 마코프 체인에 행동과 보상을 더해 순차적 의사결정을 표현한다. 각 상태의 가치는 당장의 보상뿐 아니라 미래 보상과 전이 불확실성에 의해 정해진다. 할인율, 미끄러짐 확률, 가치 반복 횟수를 바꾸면 정책 화살표와 가치 지도가 어떻게 바뀌는지 확인할 수 있다.
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽&lt;/h2>
&lt;p>Grid World에서 할인율, 미끄러짐 확률, 반복 횟수를 바꾸면 각 상태의 가치와 정책 화살표가 달라진다. 즉 MDP가 단순한 경로 찾기가 아니라 불확실성과 장기 보상을 함께 계산하는 틀임을 보여준다.&lt;/p></description><content:encoded>&lt;![CDATA[<div class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group"><div class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none"/><div class="relative z-10 flex items-start gap-4"><div class="flex-1"><div class="flex items-center gap-2 mb-2"><span class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm"><svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/></svg>
AI 요약</span></div><div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&>p]:m-0">
MDP는 마코프 체인에 행동과 보상을 더해 순차적 의사결정을 표현한다. 각 상태의 가치는 당장의 보상뿐 아니라 미래 보상과 전이 불확실성에 의해 정해진다. 할인율, 미끄러짐 확률, 가치 반복 횟수를 바꾸면 정책 화살표와 가치 지도가 어떻게 바뀌는지 확인할 수 있다.</div></div></div></div><h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽</h2><p>Grid World에서 할인율, 미끄러짐 확률, 반복 횟수를 바꾸면 각 상태의 가치와 정책 화살표가 달라진다. 즉 MDP가 단순한 경로 찾기가 아니라 불확실성과 장기 보상을 함께 계산하는 틀임을 보여준다.</p><style>
.thelogos-interactive-frame-shell {
box-sizing: border-box;
width: 100%;
max-width: 100%;
margin: 36px 0 56px;
overflow: hidden;
border: 1px solid rgba(15, 23, 42, 0.16);
border-radius: 18px;
background: #07111f;
box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}
.dark .thelogos-interactive-frame-shell,
body.dark .thelogos-interactive-frame-shell {
border-color: rgba(255, 255, 255, 0.12);
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}
.thelogos-interactive-frame-shell iframe {
display: block;
width: 100%;
min-height: 680px;
border: 0;
background: #07111f;
}
.thelogos-interactive-frame-fallback {
padding: 16px 18px;
margin: 0;
color: #d7e5f5;
background: #0f1d33;
}
@media (max-width: 640px) {
.thelogos-interactive-frame-shell {
margin-top: 28px;
margin-bottom: 44px;
border-radius: 14px;
}
.thelogos-interactive-frame-shell iframe {
min-height: 760px;
}
}</style><div class="thelogos-interactive-frame-shell"><iframe src="/markov-extensions/rl-mdp/" title="강화학습과 MDP: 불확실한 세계에서 행동을 선택하는 수학 인터랙티브 인포그래픽" loading="lazy" scrolling="no"/><noscript><p class="thelogos-interactive-frame-fallback">
자바스크립트가 꺼져 있으면 인터랙티브 인포그래픽이 표시되지 않을 수 있다.<a href="/markov-extensions/rl-mdp/">인포그래픽 페이지를 직접 열기</a></p></noscript></div><script>
(function () {
const shell = document.currentScript.previousElementSibling;
const iframe = shell && shell.querySelector('iframe');
if (!iframe) return;
function currentTheme() {
return (document.documentElement.classList.contains('dark') || document.body.classList.contains('dark')) ? 'dark' : 'light';
}
function syncTheme() {
iframe.contentWindow?.postMessage({
type: 'thelogos-interactive-theme',
theme: currentTheme()
}, window.location.origin);
}
window.addEventListener('message', function (event) {
if (event.origin !== window.location.origin || event.source !== iframe.contentWindow || event.data?.type !== 'thelogos-interactive-height') return;
const nextHeight = Math.max(680, Math.ceil(Number(event.data.height) || 0));
iframe.style.height = nextHeight + 'px';
});
iframe.addEventListener('load', syncTheme);
const observer = new MutationObserver(syncTheme);
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
observer.observe(document.body, { attributes: true, attributeFilter: ['class'] });
syncTheme();
}());</script><h2 id="1-요약-executive-summary">1. 요약 (Executive Summary)</h2><p>강화학습(Reinforcement Learning)은 “정답 라벨”을 보고 배우는
지도학습과 다르다. 에이전트는 행동을 선택하고, 환경은 결과와 보상을
돌려준다. 에이전트는 단기 보상만이 아니라 장기 누적 보상을 키우는
방향으로 정책을 개선한다.
이 문제를 수학적으로 표현하는 대표적 틀이 MDP(Markov Decision
Process)다.</p><h2 id="2-mdp의-구성요소">2. MDP의 구성요소</h2><p>MDP는 보통 다음 다섯 요소로 표현한다.</p><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>MDP = (S, A, P, R, γ)</span></span></code></pre></div><ul><li>S: 가능한 상태들의 집합</li><li>A: 가능한 행동들의 집합</li><li>P: 어떤 상태에서 어떤 행동을 했을 때 다음 상태로 갈 확률</li><li>R: 그 전이에서 받는 보상</li><li>γ: 미래 보상을 현재 기준으로 얼마나 중요하게 볼지 정하는 할인율
예를 들어 로봇이 창고에서 이동한다면 상태는 위치와 배터리 잔량,
행동은 전진·회전·충전, 보상은 목표 도착, 충돌 패널티, 시간 비용이 될 수
있다.</li></ul><h2 id="3-마코프-체인과의-차이">3. 마코프 체인과의 차이</h2><p>마코프 체인에서는 상태 전이가 정해진 확률에 따라 발생한다. 에이전트가
선택할 행동은 없다. 반면 MDP에서는 행동이 전이확률을 바꾼다.</p><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>마코프 체인: 상태 → 다음 상태</span></span><span style="display:flex;"><span>MDP: 상태 → 행동 → 다음 상태 + 보상</span></span></code></pre></div><p>즉 MDP는 “관찰하는 확률 과정”이 아니라 “개입할 수 있는 확률
과정”이다.</p><h2 id="4-가치함수와-정책">4. 가치함수와 정책</h2><p>강화학습에서 중요한 개념은 가치함수와 정책이다. 가치함수는 어떤
상태가 장기적으로 얼마나 좋은지를 나타낸다. 정책은 각 상태에서 어떤
행동을 선택할지 정하는 규칙이다.</p><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>V(s) = 그 상태에서 시작했을 때 기대되는 장기 누적 보상</span></span><span style="display:flex;"><span>π(s) = 그 상태에서 선택할 행동</span></span></code></pre></div><p>에이전트의 목표는 좋은 정책을 찾는 것이다.</p><h2 id="5-왜-어려운가">5. 왜 어려운가</h2><p>강화학습이 어려운 이유는 현재 행동의 결과가 즉시 드러나지 않을 수
있기 때문이다. 지금 얻은 작은 손해가 장기적으로 큰 이익을 만들 수도
있고, 지금 얻은 보상이 미래 위험을 키울 수도 있다.
또한 탐험과 활용의 균형이 필요하다. 이미 좋아 보이는 행동만 반복하면
더 좋은 행동을 발견하지 못한다. 반대로 계속 탐험만 하면 성과가 안정되지
않는다.</p><h2 id="6-활용-분야">6. 활용 분야</h2><p>강화학습과 MDP는 게임 AI, 로봇 제어, 자율주행, 추천 시스템, 재고관리,
포트폴리오 의사결정, 에너지 최적화 등 순차적 의사결정 문제가 있는 곳에
적용된다.
다만 현실 적용에서는 보상 설계가 매우 중요하다. 보상을 잘못 설계하면
에이전트는 인간이 의도하지 않은 방식으로 보상을 극대화할 수 있다. 이것은
단순한 기술 문제가 아니라 시스템 설계 문제다.</p><h2 id="7-결론">7. 결론</h2><p>MDP는 불확실한 세계에서 행동을 선택하는 수학적 언어다. 강화학습은 그
언어를 바탕으로 경험을 통해 정책을 개선한다. 결국 핵심 질문은
이것이다.</p><blockquote><p>“지금의 선택이 미래의 가능성을 어떻게 바꾸는가?”</p></blockquote><h2 id="참고자료">참고자료</h2><ul><li>MathWorks, “Kalman Filter - MATLAB &amp; Simulink”, 확인일:
2026-06-16,<a href="https://www.mathworks.com/discovery/kalman-filter.html">https://www.mathworks.com/discovery/kalman-filter.html</a></li><li>Alex Becker, “Kalman Filter Explained Through Examples”, 확인일:
2026-06-16,<a href="https://kalmanfilter.net/">https://kalmanfilter.net/</a></li><li>Stan Reference Manual, “MCMC Sampling”, 확인일: 2026-06-16,<a href="https://mc-stan.org/docs/reference-manual/mcmc.html">https://mc-stan.org/docs/reference-manual/mcmc.html</a></li><li>MIT OpenCourseWare, “Lecture 25: Random Walks”, 확인일: 2026-06-16,<a href="https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/">https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/</a></li><li>Stanford CS221, “Markov Decisions”, 확인일: 2026-06-16,<a href="https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html">https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html</a></li><li>Bailey, D. H. &amp; López de Prado, M., “The Deflated Sharpe Ratio:
Correcting for Selection Bias, Backtest Overfitting and Non-Normality”,
Journal of Portfolio Management, 2014; SSRN 확인일: 2026-06-16,<a href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551">https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551</a></li></ul>
]]></content:encoded></item><item><title>랜덤워크(Random Walk): 우연한 한 걸음이 만드는 장기 패턴</title><link>https://thelogos.dev/posts/random-walk/</link><pubDate>Tue, 16 Jun 2026 00:30:00 +0900</pubDate><dc:creator>DaeYoung Kim</dc:creator><category>engineering</category><category>Random Walk</category><category>확률과정</category><category>마코프 체인</category><category>금융</category><category>확산</category><category>마코프 확장</category><guid isPermaLink="true">https://thelogos.dev/posts/random-walk/</guid><description>&lt;div
class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group">
&lt;div
class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none">
&lt;/div>
&lt;div class="relative z-10 flex items-start gap-4">
&lt;div class="flex-1">
&lt;div class="flex items-center gap-2 mb-2">
&lt;span
class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm">
&lt;svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
&lt;path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6">&lt;/path>
&lt;/svg>
AI 요약
&lt;/span>
&lt;/div>
&lt;div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&amp;>p]:m-0">
랜덤워크는 현재 위치에서 무작위로 한 걸음씩 이동하는 가장 단순한 확률 과정이다. 평균은 제자리에 머물 수 있어도 가능한 위치의 폭은 대략 √n 규모로 커진다. 편향 확률 p를 바꾸면 경로의 중심이 한쪽으로 드리프트하고, 스텝 수를 늘리면 불확실성 부채꼴이 넓어진다.
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽&lt;/h2>
&lt;p>스텝 수와 오른쪽 이동 확률을 바꾸면 평균 드리프트와 불확실성 폭이 함께 달라진다. 진한 선은 하나의 역사이고, 음영은 가능한 미래의 통계적 폭이다.&lt;/p></description><content:encoded>&lt;![CDATA[<div class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group"><div class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none"/><div class="relative z-10 flex items-start gap-4"><div class="flex-1"><div class="flex items-center gap-2 mb-2"><span class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm"><svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/></svg>
AI 요약</span></div><div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&>p]:m-0">
랜덤워크는 현재 위치에서 무작위로 한 걸음씩 이동하는 가장 단순한 확률 과정이다. 평균은 제자리에 머물 수 있어도 가능한 위치의 폭은 대략 √n 규모로 커진다. 편향 확률 p를 바꾸면 경로의 중심이 한쪽으로 드리프트하고, 스텝 수를 늘리면 불확실성 부채꼴이 넓어진다.</div></div></div></div><h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽</h2><p>스텝 수와 오른쪽 이동 확률을 바꾸면 평균 드리프트와 불확실성 폭이 함께 달라진다. 진한 선은 하나의 역사이고, 음영은 가능한 미래의 통계적 폭이다.</p><style>
.thelogos-interactive-frame-shell {
box-sizing: border-box;
width: 100%;
max-width: 100%;
margin: 36px 0 56px;
overflow: hidden;
border: 1px solid rgba(15, 23, 42, 0.16);
border-radius: 18px;
background: #07111f;
box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}
.dark .thelogos-interactive-frame-shell,
body.dark .thelogos-interactive-frame-shell {
border-color: rgba(255, 255, 255, 0.12);
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}
.thelogos-interactive-frame-shell iframe {
display: block;
width: 100%;
min-height: 680px;
border: 0;
background: #07111f;
}
.thelogos-interactive-frame-fallback {
padding: 16px 18px;
margin: 0;
color: #d7e5f5;
background: #0f1d33;
}
@media (max-width: 640px) {
.thelogos-interactive-frame-shell {
margin-top: 28px;
margin-bottom: 44px;
border-radius: 14px;
}
.thelogos-interactive-frame-shell iframe {
min-height: 760px;
}
}</style><div class="thelogos-interactive-frame-shell"><iframe src="/markov-extensions/random-walk/" title="랜덤워크(Random Walk): 우연한 한 걸음이 만드는 장기 패턴 인터랙티브 인포그래픽" loading="lazy" scrolling="no"/><noscript><p class="thelogos-interactive-frame-fallback">
자바스크립트가 꺼져 있으면 인터랙티브 인포그래픽이 표시되지 않을 수 있다.<a href="/markov-extensions/random-walk/">인포그래픽 페이지를 직접 열기</a></p></noscript></div><script>
(function () {
const shell = document.currentScript.previousElementSibling;
const iframe = shell && shell.querySelector('iframe');
if (!iframe) return;
function currentTheme() {
return (document.documentElement.classList.contains('dark') || document.body.classList.contains('dark')) ? 'dark' : 'light';
}
function syncTheme() {
iframe.contentWindow?.postMessage({
type: 'thelogos-interactive-theme',
theme: currentTheme()
}, window.location.origin);
}
window.addEventListener('message', function (event) {
if (event.origin !== window.location.origin || event.source !== iframe.contentWindow || event.data?.type !== 'thelogos-interactive-height') return;
const nextHeight = Math.max(680, Math.ceil(Number(event.data.height) || 0));
iframe.style.height = nextHeight + 'px';
});
iframe.addEventListener('load', syncTheme);
const observer = new MutationObserver(syncTheme);
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
observer.observe(document.body, { attributes: true, attributeFilter: ['class'] });
syncTheme();
}());</script><h2 id="1-요약-executive-summary">1. 요약 (Executive Summary)</h2><p>랜덤워크(Random Walk)는 확률론에서 가장 단순하면서도 강력한 모델 중
하나다. 매 순간 왼쪽 또는 오른쪽으로 한 걸음 이동한다고 생각하면 된다.
각 걸음은 작고 무작위적이지만, 시간이 지나면 전체 경로는 단순하지 않은
구조를 만든다.
랜덤워크는 마코프 체인의 한 예다. 다음 위치는 과거 전체가 아니라 현재
위치와 다음 무작위 스텝에 의해 결정된다.</p><h2 id="2-가장-단순한-정의">2. 가장 단순한 정의</h2><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>X₀ = 0</span></span><span style="display:flex;"><span>Xₙ = Xₙ₋₁ + εₙ</span></span><span style="display:flex;"><span>εₙ ∈ {−1, +1}</span></span></code></pre></div><p>공정한 랜덤워크라면 +1과 -1의 확률이 각각 1/2이다. 이 경우
평균적으로는 오른쪽도 왼쪽도 치우치지 않는다. 하지만 그렇다고 항상 0
근처에만 머무는 것은 아니다. 시간이 갈수록 가능한 위치의 폭은 점점
넓어진다.</p><h2 id="3-직관-평균은-가만히">3. 직관: 평균은 가만히</h2><p>있어도 위험은 커진다
공정한 동전을 던진다면 기대값은 0이다. 그러나 100번 던진 뒤의 위치가
정확히 0일 가능성은 높지 않다. 어떤 경로는 +12까지 가고, 어떤 경로는
-8까지 간다. 평균은 0이지만 분산은 커진다.
이것이 랜덤워크의 중요한 통찰이다.</p><blockquote><p>“방향성 없는 우연도 시간이 지나면 불확실성의 폭을 키운다.”</p></blockquote><h2 id="4-왜-중요한가">4. 왜 중요한가</h2><p>랜덤워크는 확산 현상을 이해하는 기본 모델이다. 물질 입자의 움직임,
열의 확산, 생태계의 이동, 주가 모델, 도박사의 파산 문제까지 다양한
분야에 등장한다.
금융에서 가격 변화가 완전히 예측 불가능하다고 가정하면 가격은
랜덤워크처럼 움직일 수 있다. 물론 실제 시장은 완전한 랜덤워크가 아니다.
거래비용, 유동성, 군집행동, 제도, 정보 비대칭, 추세와 평균회귀가 섞여
있다. 그럼에도 랜덤워크는 “예측 가능한 패턴이 없는 기준선”을
제공한다.</p><h2 id="5-랜덤워크와-마코프-체인">5. 랜덤워크와 마코프 체인</h2><p>랜덤워크는 현재 위치가 상태이고, 다음 상태가 확률적으로 정해지는
마코프 체인이다. 현재 위치가 3이라면 다음 위치는 2 또는 4가 된다. 과거에
어떤 경로로 3에 도달했는지는 다음 한 걸음을 결정하는 데 필요하지
않다.</p><h2 id="6-활용과-한계">6. 활용과 한계</h2><p>랜덤워크는 단순한 기준 모델로 유용하다. 하지만 현실을 그대로
설명한다고 보면 위험하다. 예를 들어 금융 가격은 뉴스, 정책, 유동성,
투자자 행동, 시장 미시구조의 영향을 받는다. 입자의 확산도 매질의 구조에
따라 단순 랜덤워크와 달라진다.
따라서 랜덤워크는 “현실의 완전한 설명”이라기보다 “복잡한 확률적
움직임을 이해하기 위한 첫 좌표계”로 보는 것이 적절하다.</p><h2 id="7-결론">7. 결론</h2><p>랜덤워크는 우연이 누적될 때 어떤 패턴이 생기는지 보여준다. 단순한
모델이지만, 불확실성의 폭, 확산, 리스크, 경로 의존성을 이해하는 데 매우
강력한 출발점이다.</p><h2 id="참고자료">참고자료</h2><ul><li>MathWorks, “Kalman Filter - MATLAB &amp; Simulink”, 확인일:
2026-06-16,<a href="https://www.mathworks.com/discovery/kalman-filter.html">https://www.mathworks.com/discovery/kalman-filter.html</a></li><li>Alex Becker, “Kalman Filter Explained Through Examples”, 확인일:
2026-06-16,<a href="https://kalmanfilter.net/">https://kalmanfilter.net/</a></li><li>Stan Reference Manual, “MCMC Sampling”, 확인일: 2026-06-16,<a href="https://mc-stan.org/docs/reference-manual/mcmc.html">https://mc-stan.org/docs/reference-manual/mcmc.html</a></li><li>MIT OpenCourseWare, “Lecture 25: Random Walks”, 확인일: 2026-06-16,<a href="https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/">https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/</a></li><li>Stanford CS221, “Markov Decisions”, 확인일: 2026-06-16,<a href="https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html">https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html</a></li><li>Bailey, D. H. &amp; López de Prado, M., “The Deflated Sharpe Ratio:
Correcting for Selection Bias, Backtest Overfitting and Non-Normality”,
Journal of Portfolio Management, 2014; SSRN 확인일: 2026-06-16,<a href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551">https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551</a></li></ul>
]]></content:encoded></item><item><title>MCMC: 복잡한 확률분포를 산책으로 이해하는 방법</title><link>https://thelogos.dev/posts/mcmc/</link><pubDate>Tue, 16 Jun 2026 00:20:00 +0900</pubDate><dc:creator>DaeYoung Kim</dc:creator><category>engineering</category><category>MCMC</category><category>Markov Chain</category><category>Monte Carlo</category><category>베이지안</category><category>확률론</category><category>마코프 확장</category><guid isPermaLink="true">https://thelogos.dev/posts/mcmc/</guid><description>&lt;div
class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group">
&lt;div
class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none">
&lt;/div>
&lt;div class="relative z-10 flex items-start gap-4">
&lt;div class="flex-1">
&lt;div class="flex items-center gap-2 mb-2">
&lt;span
class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm">
&lt;svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
&lt;path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6">&lt;/path>
&lt;/svg>
AI 요약
&lt;/span>
&lt;/div>
&lt;div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&amp;>p]:m-0">
MCMC는 목표 분포가 높은 곳에 더 오래 머무는 마코프 체인을 만들어 복잡한 분포의 샘플을 얻는 방법이다. 제안 폭이 작으면 이동은 잘 받아들여지지만 천천히 섞이고, 너무 크면 거절이 많아져 탐색이 멈춘다. 수락률, 방문 빈도, 최근 경로를 함께 보면 샘플링 품질을 직관적으로 판단할 수 있다.
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽&lt;/h2>
&lt;p>제안 폭과 스텝 수를 조정하면 체인이 얼마나 잘 섞이는지 볼 수 있다. 목표 분포, 실제 방문 빈도, 최근 이동 경로가 한 화면에 겹쳐진다.&lt;/p></description><content:encoded>&lt;![CDATA[<div class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group"><div class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none"/><div class="relative z-10 flex items-start gap-4"><div class="flex-1"><div class="flex items-center gap-2 mb-2"><span class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm"><svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/></svg>
AI 요약</span></div><div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&>p]:m-0">
MCMC는 목표 분포가 높은 곳에 더 오래 머무는 마코프 체인을 만들어 복잡한 분포의 샘플을 얻는 방법이다. 제안 폭이 작으면 이동은 잘 받아들여지지만 천천히 섞이고, 너무 크면 거절이 많아져 탐색이 멈춘다. 수락률, 방문 빈도, 최근 경로를 함께 보면 샘플링 품질을 직관적으로 판단할 수 있다.</div></div></div></div><h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽</h2><p>제안 폭과 스텝 수를 조정하면 체인이 얼마나 잘 섞이는지 볼 수 있다. 목표 분포, 실제 방문 빈도, 최근 이동 경로가 한 화면에 겹쳐진다.</p><style>
.thelogos-interactive-frame-shell {
box-sizing: border-box;
width: 100%;
max-width: 100%;
margin: 36px 0 56px;
overflow: hidden;
border: 1px solid rgba(15, 23, 42, 0.16);
border-radius: 18px;
background: #07111f;
box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}
.dark .thelogos-interactive-frame-shell,
body.dark .thelogos-interactive-frame-shell {
border-color: rgba(255, 255, 255, 0.12);
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}
.thelogos-interactive-frame-shell iframe {
display: block;
width: 100%;
min-height: 680px;
border: 0;
background: #07111f;
}
.thelogos-interactive-frame-fallback {
padding: 16px 18px;
margin: 0;
color: #d7e5f5;
background: #0f1d33;
}
@media (max-width: 640px) {
.thelogos-interactive-frame-shell {
margin-top: 28px;
margin-bottom: 44px;
border-radius: 14px;
}
.thelogos-interactive-frame-shell iframe {
min-height: 760px;
}
}</style><div class="thelogos-interactive-frame-shell"><iframe src="/markov-extensions/mcmc/" title="MCMC: 복잡한 확률분포를 산책으로 이해하는 방법 인터랙티브 인포그래픽" loading="lazy" scrolling="no"/><noscript><p class="thelogos-interactive-frame-fallback">
자바스크립트가 꺼져 있으면 인터랙티브 인포그래픽이 표시되지 않을 수 있다.<a href="/markov-extensions/mcmc/">인포그래픽 페이지를 직접 열기</a></p></noscript></div><script>
(function () {
const shell = document.currentScript.previousElementSibling;
const iframe = shell && shell.querySelector('iframe');
if (!iframe) return;
function currentTheme() {
return (document.documentElement.classList.contains('dark') || document.body.classList.contains('dark')) ? 'dark' : 'light';
}
function syncTheme() {
iframe.contentWindow?.postMessage({
type: 'thelogos-interactive-theme',
theme: currentTheme()
}, window.location.origin);
}
window.addEventListener('message', function (event) {
if (event.origin !== window.location.origin || event.source !== iframe.contentWindow || event.data?.type !== 'thelogos-interactive-height') return;
const nextHeight = Math.max(680, Math.ceil(Number(event.data.height) || 0));
iframe.style.height = nextHeight + 'px';
});
iframe.addEventListener('load', syncTheme);
const observer = new MutationObserver(syncTheme);
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
observer.observe(document.body, { attributes: true, attributeFilter: ['class'] });
syncTheme();
}());</script><h2 id="1-요약-executive-summary">1. 요약 (Executive Summary)</h2><p>확률분포를 안다는 것은 단순히 평균 하나를 안다는 뜻이 아니다. 어떤
값이 얼마나 그럴듯한지, 불확실성이 어느 구간에 몰려 있는지, 여러 변수가
함께 움직일 때 어떤 조합이 가능한지를 이해한다는 뜻이다.
문제는 현실의 많은 분포가 너무 복잡하다는 점이다. 식은 쓸 수 있지만
적분이 어렵거나, 차원이 너무 높아서 전체 모양을 직접 계산할 수 없는
경우가 많다. MCMC는 이 문제를 다른 방식으로 푼다.</p><blockquote><p>“전체 지도를 한 번에 그릴 수 없다면, 그 지형을 오래 걸어 다니며 자주
방문한 곳을 기록하자.”</p></blockquote><h2 id="2-이름의-의미">2. 이름의 의미</h2><p>MCMC는 두 단어가 합쳐진 말이다.</p><ul><li>Markov Chain: 다음 위치가 현재 위치에만 의존하는 확률적 이동
과정</li><li>Monte Carlo: 무작위 표본을 많이 뽑아 계산하는 방법
즉 MCMC는 마코프 체인을 이용해 몬테카를로 샘플을 만드는 방법이다.</li></ul><h2 id="3-직관-분포-위를-걷는-사람">3. 직관: 분포 위를 걷는 사람</h2><p>산의 높이가 확률밀도라고 생각해 보자. 높은 산은 그 값이 더
그럴듯하다는 뜻이고, 낮은 평지는 덜 그럴듯하다는 뜻이다. MCMC의 산책자는
높은 곳으로 가는 제안은 잘 받아들이고, 낮은 곳으로 내려가는 제안은
가끔만 받아들인다. 그렇게 하면 산책자는 자연스럽게 높은 확률 영역에 오래
머문다.
오랜 시간이 지나면 산책자의 방문 빈도가 목표 분포의 모양과
비슷해진다.</p><h2 id="4-간단한-알고리즘">4. 간단한 알고리즘:</h2><p>Metropolis-Hastings</p><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>1. 현재 위치 x에서 시작한다.</span></span><span style="display:flex;"><span>2. 주변의 새 위치 x'를 제안한다.</span></span><span style="display:flex;"><span>3. target(x') / target(x)를 계산한다.</span></span><span style="display:flex;"><span>4. 새 위치가 더 그럴듯하면 이동한다.</span></span><span style="display:flex;"><span>5. 덜 그럴듯해도 일정 확률로 이동한다.</span></span><span style="display:flex;"><span>6. 이 과정을 오래 반복한다.</span></span></code></pre></div><p>핵심은 덜 좋은 위치로도 가끔 이동한다는 점이다. 그래야 한 봉우리에
갇히지 않고 전체 분포를 탐색할 수 있다.</p><h2 id="5-왜-필요한가">5. 왜 필요한가</h2><p>베이지안 추론에서는 사전분포와 데이터 likelihood를 결합해 사후분포를
만든다. 하지만 이 사후분포는 대부분 손으로 계산하기 어렵다. MCMC는 이
사후분포에서 직접 샘플을 뽑아 평균, 신뢰구간, 예측분포를 근사한다.
물리학에서는 입자 시스템의 평형 상태를 시뮬레이션할 수 있고,
금융에서는 복잡한 위험분포나 파라미터 불확실성을 탐색할 수 있다.</p><h2 id="6-주의할-점">6. 주의할 점</h2><p>MCMC는 샘플을 준다고 해서 자동으로 정확한 것은 아니다. 체인이 목표
분포에 충분히 도달했는지, 여러 봉우리를 잘 오가고 있는지, 샘플 간 상관이
너무 높지 않은지 확인해야 한다. 이를 수렴 진단, mixing, effective sample
size라고 부른다.
또한 제안 폭이 중요하다. 너무 작으면 천천히 움직이고, 너무 크면
대부분 거절된다. 현대 도구인 Stan은 Hamiltonian Monte Carlo와 NUTS를
사용해 고차원 분포에서 더 효율적으로 이동한다.</p><h2 id="7-결론">7. 결론</h2><p>MCMC는 복잡한 분포를 직접 계산하는 대신, 그 분포가 높은 곳에 오래
머무는 확률적 산책자를 만든다. 이 아이디어는 단순하지만 강력하다.
“모르는 것을 확률적으로 탐색한다”는 점에서 현대 통계학과 머신러닝의 핵심
사고방식 중 하나다.</p><h2 id="참고자료">참고자료</h2><ul><li>MathWorks, “Kalman Filter - MATLAB &amp; Simulink”, 확인일:
2026-06-16,<a href="https://www.mathworks.com/discovery/kalman-filter.html">https://www.mathworks.com/discovery/kalman-filter.html</a></li><li>Alex Becker, “Kalman Filter Explained Through Examples”, 확인일:
2026-06-16,<a href="https://kalmanfilter.net/">https://kalmanfilter.net/</a></li><li>Stan Reference Manual, “MCMC Sampling”, 확인일: 2026-06-16,<a href="https://mc-stan.org/docs/reference-manual/mcmc.html">https://mc-stan.org/docs/reference-manual/mcmc.html</a></li><li>MIT OpenCourseWare, “Lecture 25: Random Walks”, 확인일: 2026-06-16,<a href="https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/">https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/</a></li><li>Stanford CS221, “Markov Decisions”, 확인일: 2026-06-16,<a href="https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html">https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html</a></li><li>Bailey, D. H. &amp; López de Prado, M., “The Deflated Sharpe Ratio:
Correcting for Selection Bias, Backtest Overfitting and Non-Normality”,
Journal of Portfolio Management, 2014; SSRN 확인일: 2026-06-16,<a href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551">https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551</a></li></ul>
]]></content:encoded></item><item><title>칼만 필터(Kalman Filter): 흔들리는 센서 속에서 진짜 상태를 추정하는 법</title><link>https://thelogos.dev/posts/kalman-filter/</link><pubDate>Tue, 16 Jun 2026 00:10:00 +0900</pubDate><dc:creator>DaeYoung Kim</dc:creator><category>engineering</category><category>Kalman Filter</category><category>확률론</category><category>상태추정</category><category>센서융합</category><category>제어공학</category><category>마코프 확장</category><guid isPermaLink="true">https://thelogos.dev/posts/kalman-filter/</guid><description>&lt;div
class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group">
&lt;div
class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none">
&lt;/div>
&lt;div class="relative z-10 flex items-start gap-4">
&lt;div class="flex-1">
&lt;div class="flex items-center gap-2 mb-2">
&lt;span
class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm">
&lt;svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
&lt;path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6">&lt;/path>
&lt;/svg>
AI 요약
&lt;/span>
&lt;/div>
&lt;div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&amp;>p]:m-0">
칼만 필터는 모델 예측과 센서 측정을 불확실성의 크기로 가중해 현재 상태를 추정한다. 측정 노이즈 R이 커지면 센서를 덜 믿고, 모델 노이즈 Q가 커지면 예측을 덜 믿는다. 핵심은 예측과 보정의 반복, 그리고 두 정보원 사이의 신뢰 비율을 정하는 Kalman Gain이다.
&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽&lt;/h2>
&lt;p>측정 노이즈와 모델 노이즈를 바꾸면 필터가 센서와 예측 중 무엇을 더 믿는지 바로 드러난다. 아래 시각화는 실제 상태, 흔들리는 측정값, 필터 추정값, 추정 불확실성 폭을 함께 보여준다.&lt;/p></description><content:encoded>&lt;![CDATA[<div class="ai-summary-box my-6 p-5 rounded-2xl bg-indigo-50/50 dark:bg-slate-800/50 backdrop-blur-sm border border-indigo-100 dark:border-indigo-500/20 shadow-sm relative overflow-hidden group"><div class="absolute inset-0 bg-gradient-to-br from-indigo-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none"/><div class="relative z-10 flex items-start gap-4"><div class="flex-1"><div class="flex items-center gap-2 mb-2"><span class="inline-flex items-center rounded-md bg-indigo-100 px-2.5 py-1 text-xs font-bold text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300 ring-1 ring-inset ring-indigo-700/10 dark:ring-indigo-400/20 shadow-sm"><svg class="w-3.5 h-3.5 mr-1.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/></svg>
AI 요약</span></div><div class="text-slate-700 dark:text-slate-300 text-sm md:text-base leading-relaxed break-keep [&>p]:m-0">
칼만 필터는 모델 예측과 센서 측정을 불확실성의 크기로 가중해 현재 상태를 추정한다. 측정 노이즈 R이 커지면 센서를 덜 믿고, 모델 노이즈 Q가 커지면 예측을 덜 믿는다. 핵심은 예측과 보정의 반복, 그리고 두 정보원 사이의 신뢰 비율을 정하는 Kalman Gain이다.</div></div></div></div><h2 id="인터랙티브-인포그래픽">인터랙티브 인포그래픽</h2><p>측정 노이즈와 모델 노이즈를 바꾸면 필터가 센서와 예측 중 무엇을 더 믿는지 바로 드러난다. 아래 시각화는 실제 상태, 흔들리는 측정값, 필터 추정값, 추정 불확실성 폭을 함께 보여준다.</p><style>
.thelogos-interactive-frame-shell {
box-sizing: border-box;
width: 100%;
max-width: 100%;
margin: 36px 0 56px;
overflow: hidden;
border: 1px solid rgba(15, 23, 42, 0.16);
border-radius: 18px;
background: #07111f;
box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}
.dark .thelogos-interactive-frame-shell,
body.dark .thelogos-interactive-frame-shell {
border-color: rgba(255, 255, 255, 0.12);
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}
.thelogos-interactive-frame-shell iframe {
display: block;
width: 100%;
min-height: 680px;
border: 0;
background: #07111f;
}
.thelogos-interactive-frame-fallback {
padding: 16px 18px;
margin: 0;
color: #d7e5f5;
background: #0f1d33;
}
@media (max-width: 640px) {
.thelogos-interactive-frame-shell {
margin-top: 28px;
margin-bottom: 44px;
border-radius: 14px;
}
.thelogos-interactive-frame-shell iframe {
min-height: 760px;
}
}</style><div class="thelogos-interactive-frame-shell"><iframe src="/markov-extensions/kalman-filter/" title="칼만 필터(Kalman Filter): 흔들리는 센서 속에서 진짜 상태를 추정하는 법 인터랙티브 인포그래픽" loading="lazy" scrolling="no"/><noscript><p class="thelogos-interactive-frame-fallback">
자바스크립트가 꺼져 있으면 인터랙티브 인포그래픽이 표시되지 않을 수 있다.<a href="/markov-extensions/kalman-filter/">인포그래픽 페이지를 직접 열기</a></p></noscript></div><script>
(function () {
const shell = document.currentScript.previousElementSibling;
const iframe = shell && shell.querySelector('iframe');
if (!iframe) return;
function currentTheme() {
return (document.documentElement.classList.contains('dark') || document.body.classList.contains('dark')) ? 'dark' : 'light';
}
function syncTheme() {
iframe.contentWindow?.postMessage({
type: 'thelogos-interactive-theme',
theme: currentTheme()
}, window.location.origin);
}
window.addEventListener('message', function (event) {
if (event.origin !== window.location.origin || event.source !== iframe.contentWindow || event.data?.type !== 'thelogos-interactive-height') return;
const nextHeight = Math.max(680, Math.ceil(Number(event.data.height) || 0));
iframe.style.height = nextHeight + 'px';
});
iframe.addEventListener('load', syncTheme);
const observer = new MutationObserver(syncTheme);
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
observer.observe(document.body, { attributes: true, attributeFilter: ['class'] });
syncTheme();
}());</script><h2 id="1-요약-executive-summary">1. 요약 (Executive Summary)</h2><p>현실의 센서는 완벽하지 않다. GPS는 건물 사이에서 튀고, 카메라는
조명에 흔들리며, IMU는 시간이 지날수록 드리프트가 생긴다. 그렇다고
센서를 버릴 수도 없다. 반대로 물리 모델만 믿는 것도 위험하다. 실제
물체는 마찰, 충격, 바람, 미세한 제어 오차 때문에 모델대로만 움직이지
않는다.
칼만 필터(Kalman Filter)는 이 둘 사이의 균형을 잡는 알고리즘이다.
먼저 현재 상태를 바탕으로 다음 상태를 예측한다. 다음으로 실제 측정값이
들어오면, 예측값과 측정값의 차이를 계산한다. 이 차이를 “innovation” 또는
“residual”이라고 부른다. 그리고 그 차이를 얼마나 반영할지 Kalman
Gain으로 결정한다.
가장 단순하게 말하면 칼만 필터는 다음 질문에 답한다.</p><blockquote><p>“내가 가진 모델과 센서가 둘 다 불완전하다면, 지금 무엇을 가장 믿어야
하는가?”</p></blockquote><h2 id="2-직관-예측과-측정의-협상">2. 직관: 예측과 측정의 협상</h2><p>예를 들어 자동차의 위치를 추정한다고 하자. 자동차가 1초 전에 10m
지점에 있었고 속도가 5m/s였다면, 물리 모델은 1초 뒤 위치를 15m라고
예측할 수 있다. 그런데 GPS가 18m라고 측정했다. 이때 무엇이 맞을까?
정답은 “상황에 따라 다르다”이다. GPS 노이즈가 작다면 18m에 가까운
값을 믿어야 한다. 반대로 GPS가 터널 근처에서 불안정하다면 15m에 가까운
값을 유지해야 한다. 칼만 필터는 이 판단을 감이 아니라 불확실성의 크기로
계산한다.</p><h2 id="3-핵심-공식">3. 핵심 공식</h2><p>칼만 필터의 기본 구조는 예측과 갱신이다.</p><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>예측:</span></span><span style="display:flex;"><span>x̂⁻ = F x̂</span></span><span style="display:flex;"><span>P⁻ = F P Fᵀ + Q</span></span><span style="display:flex;"><span>갱신:</span></span><span style="display:flex;"><span>K = P⁻Hᵀ(HP⁻Hᵀ + R)⁻¹</span></span><span style="display:flex;"><span>x̂ = x̂⁻ + K(z − Hx̂⁻)</span></span><span style="display:flex;"><span>P = (I − KH)P⁻</span></span></code></pre></div><p>여기서 x̂는 상태 추정값, P는 추정 불확실성, F는 시스템이 시간에 따라
어떻게 변하는지 나타내는 모델, Q는 모델 노이즈, z는 측정값, H는 측정
모델, R은 측정 노이즈다. K는 Kalman Gain이다.</p><h2 id="4-무엇을-이해해야-하는가">4. 무엇을 이해해야 하는가</h2><p>칼만 필터를 처음 볼 때 행렬식이 복잡해 보이지만, 핵심은 세
가지다.
첫째, 모든 추정에는 불확실성이 붙는다. 칼만 필터는 값만 추정하지 않고
그 값이 얼마나 믿을 만한지도 함께 추정한다.
둘째, 예측도 틀릴 수 있고 측정도 틀릴 수 있다. Q가 크면 모델을 덜
믿고, R이 크면 센서를 덜 믿는다.
셋째, 필터는 한 번 계산하고 끝나는 것이 아니라 매 시점 반복된다.
그래서 시간에 따라 들어오는 데이터를 연속적으로 흡수한다.</p><h2 id="5-활용-분야">5. 활용 분야</h2><p>칼만 필터는 센서 융합, 항법, 로봇 위치 추정, 컴퓨터 비전 객체 추적,
경제 시계열 추정, 신호처리 등에서 사용된다. 특히 위치와 속도처럼 직접
측정하기 어렵거나, 측정값이 노이즈에 오염되는 문제에서 강력하다.</p><h2 id="6-한계">6. 한계</h2><p>칼만 필터는 기본형 기준으로 선형 시스템과 가우시안 노이즈를 가정한다.
현실 시스템이 강하게 비선형이면 확장 칼만 필터(EKF), 무향 칼만
필터(UKF), 파티클 필터 같은 변형이 필요하다. 또한 Q와 R을 잘못 설정하면
필터가 너무 둔감해지거나, 반대로 노이즈를 실제 변화로 착각할 수
있다.</p><h2 id="7-결론">7. 결론</h2><p>칼만 필터는 단순한 노이즈 제거기가 아니다. 그것은 “모델 기반 예측”과
“현실 기반 측정”을 불확실성의 언어로 결합하는 사고방식이다. 이 관점은
로봇, 항공, 자율주행뿐 아니라 데이터 기반 의사결정 전반에 적용될 수
있다.</p><h2 id="참고자료">참고자료</h2><ul><li>MathWorks, “Kalman Filter - MATLAB &amp; Simulink”, 확인일:
2026-06-16,<a href="https://www.mathworks.com/discovery/kalman-filter.html">https://www.mathworks.com/discovery/kalman-filter.html</a></li><li>Alex Becker, “Kalman Filter Explained Through Examples”, 확인일:
2026-06-16,<a href="https://kalmanfilter.net/">https://kalmanfilter.net/</a></li><li>Stan Reference Manual, “MCMC Sampling”, 확인일: 2026-06-16,<a href="https://mc-stan.org/docs/reference-manual/mcmc.html">https://mc-stan.org/docs/reference-manual/mcmc.html</a></li><li>MIT OpenCourseWare, “Lecture 25: Random Walks”, 확인일: 2026-06-16,<a href="https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/">https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-fall-2010/resources/lecture-25-random-walks/</a></li><li>Stanford CS221, “Markov Decisions”, 확인일: 2026-06-16,<a href="https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html">https://stanford.edu/~cpiech/cs221/handouts/markovDecisions.html</a></li><li>Bailey, D. H. &amp; López de Prado, M., “The Deflated Sharpe Ratio:
Correcting for Selection Bias, Backtest Overfitting and Non-Normality”,
Journal of Portfolio Management, 2014; SSRN 확인일: 2026-06-16,<a href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551">https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2460551</a></li></ul>
]]></content:encoded></item></channel></rss>