<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>编程 on Captain Crystal</title><link>http://log4.love/tags/%E7%BC%96%E7%A8%8B/</link><description>Recent content in 编程 on Captain Crystal</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Fri, 20 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="http://log4.love/tags/%E7%BC%96%E7%A8%8B/index.xml" rel="self" type="application/rss+xml"/><item><title>需求预测小实验（脱敏版）</title><link>http://log4.love/projects/crystal-demand-nowcast/</link><pubDate>Fri, 20 Mar 2026 00:00:00 +0000</pubDate><guid>http://log4.love/projects/crystal-demand-nowcast/</guid><description>&lt;h2 id="在做什么">在做什么&lt;/h2>
&lt;p>一个很小的预测练习：用历史数据猜接下来几天的大概走势，用来练手、也练互相讲清楚「模型在干嘛」。&lt;/p>
&lt;h2 id="我们学到的">我们学到的&lt;/h2>
&lt;ul>
&lt;li>数据对齐比换花哨模型更重要，不然结果再好看也不踏实。&lt;/li>
&lt;li>一个人写代码、另一个人问「这一步为什么合理」，搭档起来很安心。&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 示意：分段时间验证，避免偷看未来&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">walk_forward_score&lt;/span>(model, frames):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> [model&lt;span style="color:#f92672">.&lt;/span>fit(f&lt;span style="color:#f92672">.&lt;/span>train)&lt;span style="color:#f92672">.&lt;/span>score(f&lt;span style="color:#f92672">.&lt;/span>test) &lt;span style="color:#66d9ef">for&lt;/span> f &lt;span style="color:#f92672">in&lt;/span> frames]
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item></channel></rss>