<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: masaya oka</title>
    <description>The latest articles on DEV Community by masaya oka (@masaya_oka).</description>
    <link>https://dev.to/masaya_oka</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4254869%2Fe6ef6609-a23d-486d-b7d5-b12444689a36.png</url>
      <title>DEV Community: masaya oka</title>
      <link>https://dev.to/masaya_oka</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/masaya_oka"/>
    <language>en</language>
    <item>
      <title>When should you keep a Kalman filter? Three forecasting checks</title>
      <dc:creator>masaya oka</dc:creator>
      <pubDate>Wed, 25 Nov 2026 02:57:02 +0000</pubDate>
      <link>https://dev.to/masaya_oka/when-should-you-keep-a-kalman-filter-three-forecasting-checks-a64</link>
      <guid>https://dev.to/masaya_oka/when-should-you-keep-a-kalman-filter-three-forecasting-checks-a64</guid>
      <description>&lt;p&gt;On two public time series, forecasting the last observed value beat the local level-and-trend Kalman filter I tested. With a synthetic spacecraft trajectory, the extended Kalman filter brought the position error down sharply under nominal observations. A change in the observations then made its position forecasts and uncertainty estimates much less useful.&lt;/p&gt;

&lt;p&gt;These experiments ask when to keep a filter and what to inspect when its predictions start to miss. I used the same rule as in the date-ordered classification example: choose the method on earlier data and evaluate it on a later holdout. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/articles/diy-automl-development-note-06-time-series.md" rel="noopener noreferrer"&gt;Japanese development note&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Give the filter a simple baseline
&lt;/h2&gt;

&lt;p&gt;I tested a one-month-ahead forecast on AirPassengers and a 30-minute-ahead forecast on NYC Taxi. Each series was divided chronologically into a setup period, a selection period, and a final holdout. Each new prediction could use observations available at its forecast origin, including observations that had already arrived during the holdout. &lt;a href="https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/AirPassengers.html" rel="noopener noreferrer"&gt;AirPassengers dataset&lt;/a&gt; · &lt;a href="https://github.com/numenta/NAB/blob/master/data/realKnownCause/nyc_taxi.csv" rel="noopener noreferrer"&gt;NYC Taxi dataset&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this run, DIY AutoML's &lt;code&gt;kalman-track&lt;/code&gt; kept the filter if it reduced selection-period RMSE by at least 5% relative to &lt;strong&gt;persistence&lt;/strong&gt;, which predicts the last observed value. It chose persistence on both series. I also ran a separate experiment that added seasonal candidates, and compared AutoGluon Tabular and H2O AutoML using lag and calendar features on the same holdouts. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/experiments/seasonal_forecast_crosscheck/README.md" rel="noopener noreferrer"&gt;Candidate settings, splits, and reproduction steps&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;AirPassengers RMSE (thousands of passengers, 48 points)&lt;/th&gt;
&lt;th&gt;NYC Taxi RMSE (passengers, 6,288 points)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Continue the Kalman filter&lt;/td&gt;
&lt;td&gt;65.69&lt;/td&gt;
&lt;td&gt;1,962.19&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DIY AutoML's selected method: persistence&lt;/td&gt;
&lt;td&gt;48.04&lt;/td&gt;
&lt;td&gt;1,708.36&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DIY experiment with seasonal candidates&lt;/td&gt;
&lt;td&gt;27.89&lt;/td&gt;
&lt;td&gt;1,708.36&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AutoGluon Tabular&lt;/td&gt;
&lt;td&gt;27.49&lt;/td&gt;
&lt;td&gt;1,115.22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;H2O AutoML&lt;/td&gt;
&lt;td&gt;42.34&lt;/td&gt;
&lt;td&gt;1,171.83&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For AirPassengers, the seasonal experiment selected the same month a year earlier multiplied by an estimated growth factor. It was close to AutoGluon on RMSE and had the lower mean absolute error: 22.09 versus 22.61 thousand passengers. For NYC Taxi, both tabular AutoML workflows had lower overall RMSE than persistence. Comparing absolute errors timestamp by timestamp, persistence still beat H2O at 2,056 of the 6,288 holdout points. Saving the per-timestamp predictions made that comparison possible. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/development-notes/time-series-crosscheck-draft.md" rel="noopener noreferrer"&gt;Timestamp-level comparison record&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Put one forecast next to the known position
&lt;/h2&gt;

&lt;p&gt;In the Voyager-inspired experiment, a simulator supplied a true two-dimensional trajectory and synthetic measurements of range and range rate from Earth. The extended Kalman filter (EKF) used the same form of dynamics as the simulator. It predicted the spacecraft's heliocentric position seven days ahead. I ran three observation conditions along the same trajectory: nominal measurements, a systematic sensor offset, and earlier observations replayed at later timestamps. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/experiments/voyager_crosscheck/README.md" rel="noopener noreferrer"&gt;Experiment and reproduction steps&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Day 574 is near the middle of the holdout. The forecasts were issued on day 567. The open circles in the figure put the true position at zero, and the diamonds show the forecast centers. Each error bar shows the cross-section of the nominal 95% prediction ellipse along the line through the forecast center and the true position. This lets you read the two-dimensional containment test directly from the bar. Each panel uses its own horizontal scale.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkmsf0thrcd1saxajs9sb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkmsf0thrcd1saxajs9sb.png" alt="Day 574: the true position falls inside the nominal-observation forecast bar and outside the bars for systematic bias and replayed observations." width="800" height="684"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Day 574&lt;/th&gt;
&lt;th&gt;Distance from forecast center to truth (km)&lt;/th&gt;
&lt;th&gt;Error bar half-width (km)&lt;/th&gt;
&lt;th&gt;Truth inside&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Nominal observations&lt;/td&gt;
&lt;td&gt;47,367&lt;/td&gt;
&lt;td&gt;99,736&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Systematic bias&lt;/td&gt;
&lt;td&gt;564,983&lt;/td&gt;
&lt;td&gt;71,351&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replayed observations&lt;/td&gt;
&lt;td&gt;839,661,855&lt;/td&gt;
&lt;td&gt;25,906&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Check the errors, the ellipses, and the inputs
&lt;/h2&gt;

&lt;p&gt;I repeated the check over 44 held-out timestamps. Position RMSE summarizes the distance between each forecast center and the known position. Coverage counts the number of timestamps at which the prediction ellipse contains the true position. The observation check compares the recorded change in range with the change implied by the range-rate measurements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx1hvlkmyvnmkb92xwm21.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx1hvlkmyvnmkb92xwm21.png" alt="The aggregate comparison over 44 held-out timestamps. Position RMSE is plotted on a log scale. The EKF ellipses contained the true position at 44, 1, and 0 timestamps in the three conditions." width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Holdout result&lt;/th&gt;
&lt;th&gt;Nominal&lt;/th&gt;
&lt;th&gt;Systematic bias&lt;/th&gt;
&lt;th&gt;Replayed observations&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;EKF position RMSE (km)&lt;/td&gt;
&lt;td&gt;41,982&lt;/td&gt;
&lt;td&gt;502,682&lt;/td&gt;
&lt;td&gt;964,714,784&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Physics-only position RMSE (km)&lt;/td&gt;
&lt;td&gt;5,240,893&lt;/td&gt;
&lt;td&gt;5,240,893&lt;/td&gt;
&lt;td&gt;5,240,893&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Truth inside the EKF ellipse&lt;/td&gt;
&lt;td&gt;44/44&lt;/td&gt;
&lt;td&gt;1/44&lt;/td&gt;
&lt;td&gt;0/44&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Timestamps flagged by the range check&lt;/td&gt;
&lt;td&gt;2/44&lt;/td&gt;
&lt;td&gt;6/44&lt;/td&gt;
&lt;td&gt;42/44&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Under nominal observations, the EKF improved on the physics-only forecast. With systematic bias, its RMSE rose roughly twelvefold while the average ellipse semi-major axis stayed near 300,000 km. The range check flagged 42 of 44 timestamps under replay, but only 6 of 44 under bias. All these counts describe one simulated trajectory.&lt;/p&gt;

&lt;p&gt;This is what I want error evaluation in DIY AutoML to help with. If forecasts start missing their prediction regions, I can look at the point errors, how often the regions contain the realized values, and whether the inputs agree with each other. Those checks point to different follow-up questions, including whether to inspect timestamps, review sensor measurements, or revisit the model assumptions. The next evaluation task is to estimate uncertainty in performance differences while accounting for dependence between nearby timestamps. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/UNCERTAINTY_DESIGN.md" rel="noopener noreferrer"&gt;Uncertainty design notes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI assistance was used to adapt the project's development notes and experiment records into this English article.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>timeseries</category>
      <category>kalmanfilter</category>
      <category>aerospace</category>
    </item>
    <item>
      <title>Read a model's mistakes in Excel and a Windows preview</title>
      <dc:creator>masaya oka</dc:creator>
      <pubDate>Wed, 25 Nov 2026 02:50:01 +0000</pubDate>
      <link>https://dev.to/masaya_oka/read-a-models-mistakes-in-excel-and-a-windows-preview-31oa</link>
      <guid>https://dev.to/masaya_oka/read-a-models-mistakes-in-excel-and-a-windows-preview-31oa</guid>
      <description>&lt;p&gt;In a bike rental experiment, a random forest missed eight fewer regular-demand cases than a simple calendar rule. It also produced 28 more false alarms for that class. I wanted a Windows preview that makes those trade-offs visible to someone using Excel. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/articles/diy-automl-development-note-05-bp-preview.md" rel="noopener noreferrer"&gt;Japanese original&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Iris and compare five models
&lt;/h2&gt;

&lt;p&gt;Use Python with Tcl/Tk and install DIY AutoML in &lt;code&gt;.venv&lt;/code&gt;. From the repository root, run this PowerShell command to open the preview with Iris selected. The preview currently uses Japanese labels, which are shown alongside their English meanings below. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/BUSINESS_USER_GUIDE.en.md#try-the-windows-preview-with-iris" rel="noopener noreferrer"&gt;Setup and complete walkthrough&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;venv&lt;/span&gt;\&lt;span class="nc"&gt;Scripts&lt;/span&gt;\&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exe&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt; &lt;span class="n"&gt;utf8&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="n"&gt;diy_automl&lt;/span&gt; &lt;span class="n"&gt;bp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;preview&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;csv&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;reference&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;iris&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;csv&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Select &lt;code&gt;target&lt;/code&gt; as the outcome column and click &lt;strong&gt;点検する&lt;/strong&gt; (&lt;em&gt;Inspect data&lt;/em&gt;). Check missing values, duplicates, and class counts. To load another UTF-8 CSV, use &lt;strong&gt;CSVを選ぶ…&lt;/strong&gt; (&lt;em&gt;Choose CSV&lt;/em&gt;).&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;使う列を選ぶ…&lt;/strong&gt; (&lt;em&gt;Choose columns&lt;/em&gt;), keep the four Iris measurements, and click &lt;strong&gt;抽出して再点検&lt;/strong&gt; (&lt;em&gt;Extract and inspect again&lt;/em&gt;). The preview saves a separate training CSV with the selected columns and the outcome. With the optional storage dependencies, &lt;strong&gt;作業用Parquetも保存&lt;/strong&gt; (&lt;em&gt;Save a working Parquet copy&lt;/em&gt;) can save a reusable copy for larger inputs.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;5モデルを比較する&lt;/strong&gt; (&lt;em&gt;Compare five models&lt;/em&gt;). For Iris, the preview used 120 rows to select an SVM and 30 held-out rows to test it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Model comparison requires finite numeric features, complete values, and recorded class labels. Before inspection, select &lt;strong&gt;IDでまとめる&lt;/strong&gt; (&lt;em&gt;Group by ID&lt;/em&gt;) to keep a customer's repeated rows together, or &lt;strong&gt;日付順で分ける&lt;/strong&gt; (&lt;em&gt;Split by date&lt;/em&gt;) to evaluate later observations. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/DATA_AUDIT.md#%E7%94%BB%E9%9D%A2%E3%81%8B%E3%82%89%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E6%AF%94%E8%BC%83" rel="noopener noreferrer"&gt;Input and split options (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Look at the counts behind a score
&lt;/h2&gt;

&lt;p&gt;On Iris, the result showed &lt;strong&gt;30 evaluated, 29 correct, and one error&lt;/strong&gt;. &lt;strong&gt;評価Excelを開く&lt;/strong&gt; (&lt;em&gt;Open evaluation workbook&lt;/em&gt;) opens &lt;code&gt;bp_report.xlsx&lt;/code&gt;. Start with &lt;strong&gt;まず読む&lt;/strong&gt; (&lt;em&gt;Start here&lt;/em&gt;) for the totals and &lt;strong&gt;ラベル別&lt;/strong&gt; (&lt;em&gt;By outcome&lt;/em&gt;) for missed cases and false alarms. The model comparison bar chart under &lt;strong&gt;グラフを見る…&lt;/strong&gt; (&lt;em&gt;View charts&lt;/em&gt;) shows training-side validation scores. Holdout scores appear on the results screen and in the workbook. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/BUSINESS_USER_GUIDE.en.md#read-the-evaluation-workbook" rel="noopener noreferrer"&gt;How to read the workbook&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8q62mouhqyk6yvx6b7fi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8q62mouhqyk6yvx6b7fi.png" alt="The Iris SVM classified 29 of 30 held-out rows correctly. One versicolor was classified as virginica. Macro F1 was 0.967, with a conditional 95% interval of 0.898 to 1.000." width="800" height="639"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;English summary redrawn from the saved Iris example workbook.&lt;/em&gt; &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/BP_OUTPUT_EXAMPLE.md" rel="noopener noreferrer"&gt;Original workbook and evaluation conditions (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Date-ordered evaluations add a monthly holdout chart. In Bike Sharing, I defined 200 or more rentals in a recorded hour as busy, and anything below that as regular. I held out the latest fifth of observed dates, which gave 582 rows from August 7 to December 31, 2012. I compared the selected random forest with a simple rule that predicts the most frequent training label for the same day of the week and hour. &lt;a href="https://archive.ics.uci.edu/dataset/275/bike%2Bsharing%2Bdataset" rel="noopener noreferrer"&gt;Bike Sharing dataset&lt;/a&gt; · &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/DATA_AUDIT.md#%E6%97%A5%E4%BB%98%E9%A0%86%E3%81%AE%E5%88%86%E5%89%B2" rel="noopener noreferrer"&gt;Data preparation and split (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgswqlu7j4554sbmgclml.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgswqlu7j4554sbmgclml.png" alt="Monthly held-out macro F1 for the Bike Sharing model and baseline rules. The random forest leads the weekday-and-hour rule in August and September. The rule leads from October to December." width="800" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The overall majority rule always predicts the most frequent label in the training period. Macro F1 gives the busy and regular classes equal weight.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Across the full period, the weekday-and-hour rule scored &lt;strong&gt;0.656&lt;/strong&gt; macro F1 and the random forest scored &lt;strong&gt;0.638&lt;/strong&gt;. The random forest caught 80 of the 109 regular cases, and the rule caught 72. The forest missed 29 regular cases versus 37 for the rule. It also labeled 143 busy cases as regular, compared with 115 for the rule. The model scored higher in August and September, and the rule scored higher from October through December. These numbers describe the held-out period. Intervals that account for time dependence remain a research task. In Excel, the simple-rule comparison, monthly breakdown, and monthly breakdown by outcome let you go back to the counts for each period. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/DATA_AUDIT.md#%E6%9C%88%E5%88%A5%E3%81%AE%E6%88%90%E7%B8%BE%E3%81%A8%E5%8D%98%E7%B4%94%E3%83%AB%E3%83%BC%E3%83%AB" rel="noopener noreferrer"&gt;Monthly comparison details (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The charts use the saved evaluation tables. You can also open those worksheets in a charting tool or export them as CSV. For example, use &lt;code&gt;Model&lt;/code&gt; and &lt;code&gt;F1&lt;/code&gt; from &lt;code&gt;SL_CV_Mean&lt;/code&gt; to plot the training-side validation scores. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/development-notes/05-business-preview.en.md#take-the-saved-tables-into-a-charting-tool" rel="noopener noreferrer"&gt;Charting examples in the development notes&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Give the preview a way to open custom charts
&lt;/h2&gt;

&lt;p&gt;One idea is to put PyGWalker inside Streamlit so a user can choose the chart type, axes, and series from the saved tables. In the local test with Python 3.14.7 and PyGWalker 0.5.0.1, an Iris evaluation table produced an HTML file for local viewing. &lt;a href="https://docs.kanaries.net/pygwalker/api-reference/streamlit" rel="noopener noreferrer"&gt;PyGWalker Streamlit documentation&lt;/a&gt; · &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/THREAD_SUMMARY_20261119.md" rel="noopener noreferrer"&gt;Prototype log (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The proposed Windows workflow uses an initial batch file on a PC with Python already installed. The batch would create a charting environment, get the dependencies over the network, and start the viewer. After that, a button in the preview could reuse the environment and open the current evaluation in a local browser. The Streamlit integration, initial setup, and button launch still need to be tested together. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/ROADMAP.md#bp%E5%90%91%E3%81%91%E3%81%AE%E8%A9%B3%E7%B4%B0%E3%82%B0%E3%83%A9%E3%83%95to-do" rel="noopener noreferrer"&gt;Charting roadmap (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That wraps up the classification examples. The next article uses the same chronological holdout idea to check predictions of future observations.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI assistance was used to adapt the project's development notes and experiment records into this English article.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>database</category>
      <category>excel</category>
    </item>
    <item>
      <title>Does simulated annealing help pick a smaller feature set?</title>
      <dc:creator>masaya oka</dc:creator>
      <pubDate>Wed, 25 Nov 2026 02:37:41 +0000</pubDate>
      <link>https://dev.to/masaya_oka/does-simulated-annealing-help-pick-a-smaller-feature-set-30g9</link>
      <guid>https://dev.to/masaya_oka/does-simulated-annealing-help-pick-a-smaller-feature-set-30g9</guid>
      <description>&lt;p&gt;After preparing a dataset, I sometimes want to know which measurements I can leave out. If a column is expensive to collect, a model that uses fewer columns could make the next round of data collection easier. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/articles/diy-automl-development-note-04-annealing.md" rel="noopener noreferrer"&gt;Japanese original&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are 4,095 nonempty ways to choose up to six of Wine's 13 features. Evaluating each combination takes a series of model fits. DIY AutoML's optional CPU command, &lt;code&gt;annealing-check&lt;/code&gt;, sets a budget for how many subsets to score. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/ANNEALING_CHECK.md" rel="noopener noreferrer"&gt;Command and report design (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Give a lower-scoring candidate a chance
&lt;/h2&gt;

&lt;p&gt;Simulated annealing starts from a subset. A nearby candidate adds a column, removes a column, or swaps a selected column with an unselected one. The search accepts a candidate whose score is at least as high as the current one. It sometimes accepts a lower-scoring candidate, which lets it move through a worse subset to look for a better one. &lt;a href="https://doi.org/10.1126/science.220.4598.671" rel="noopener noreferrer"&gt;Original paper on simulated annealing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For a score decrease, the acceptance probability is &lt;code&gt;exp((candidate score - current score) / temperature)&lt;/code&gt;. The temperature falls from 0.03 to 0.002 by default. For example, a drop of 0.01 has a roughly 72% chance of acceptance at the initial temperature and about 0.67% at the final temperature. The report records the moves and returns the best subset found, preferring fewer columns when scores tie. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/src/diy_automl/annealing.py" rel="noopener noreferrer"&gt;Feature subset search implementation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Compare searches with the same number of candidates
&lt;/h2&gt;

&lt;p&gt;I fixed the classifier to an SVM and changed the feature subsets. All candidates used the same two repeats of stratified five-fold cross-validation on the training data. The scaler was fitted on the training portion of each fold. The search averaged ten validation macro F1 scores per candidate.&lt;/p&gt;

&lt;p&gt;Annealing and random search shared an initial subset and evaluated the same number of distinct subsets. Random search drew uniformly from the remaining eligible combinations. Each candidate required ten fits, so a budget of eight meant 80 fits per method, and a budget of 32 meant 320. I also ran a separate model with all features and evaluated all 15 nonempty subsets on Iris.&lt;/p&gt;

&lt;p&gt;Each method refitted the classifier on all the training rows using its chosen subset. The final tests used the same held-out rows, 30 for Iris and 36 for Wine. I kept the data splits fixed, varying only the search seed from 44 through 53.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dataset&lt;/th&gt;
&lt;th&gt;Budget per method&lt;/th&gt;
&lt;th&gt;Cross-validation result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Iris&lt;/td&gt;
&lt;td&gt;8 subsets&lt;/td&gt;
&lt;td&gt;The exhaustive maximum was 0.9707, using all four features. Annealing reached it in 3 of 10 runs and random search in 8 of 10.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wine&lt;/td&gt;
&lt;td&gt;32 subsets&lt;/td&gt;
&lt;td&gt;With up to six features per subset, each search method had the higher cross-validation score in 5 of 10 runs.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On Wine at seed 44, the five-feature annealing model and the full 13-feature model agreed on all 36 predictions. This happened in one of the ten runs. In that run, annealing scored &lt;strong&gt;+0.0558&lt;/strong&gt; in held-out macro F1 relative to random search, with a 95% interval of &lt;strong&gt;[0.0000, +0.1419]&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The interval keeps the fitted models fixed and resamples the same evaluation rows for both methods within classes. The intervals included zero for all 20 Iris and Wine searches, leaving the direction unresolved under these conditions. The runs show how the subset choice can vary even with the same split and evaluation budget. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/ANNEALING_CHECK.md#iris%E3%81%A8wine%E3%81%A7%E3%81%AE%E6%A4%9C%E8%A8%BC" rel="noopener noreferrer"&gt;Experiment settings and results (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce search seed 44
&lt;/h2&gt;

&lt;p&gt;From the repository root, run these PowerShell commands using the installed &lt;code&gt;.venv&lt;/code&gt;. Use a new value for &lt;code&gt;$work&lt;/code&gt; on subsequent runs.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
powershell
$python = ".\.venv\Scripts\python.exe"
$work = "runs/dev-note-04-annealing"

&amp;amp; $python -X utf8 -m diy_automl annealing-check --csv data/reference/iris.csv --target target --budget 8 --exhaustive --search-seed 44 --output "$work/iris"
&amp;amp; $python -X utf8 -m diy_automl annealing-check --csv data/reference/wine.csv --target target --budget 32 --max-features 6 --search-seed 44 --output "$work/wine"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Keep the CSV and reuse a working copy with Parquet and DuckDB</title>
      <dc:creator>masaya oka</dc:creator>
      <pubDate>Wed, 25 Nov 2026 02:29:05 +0000</pubDate>
      <link>https://dev.to/masaya_oka/keep-the-csv-and-reuse-a-working-copy-with-parquet-and-duckdb-mmp</link>
      <guid>https://dev.to/masaya_oka/keep-the-csv-and-reuse-a-working-copy-with-parquet-and-duckdb-mmp</guid>
      <description>&lt;p&gt;On a Windows PC with 16 GB of RAM, auditing a million-row CSV and writing Parquet took 91.1 seconds. A later run took 2.3 seconds to extract 10,000 rows from the prepared file. Here is how DIY AutoML keeps track of the original CSV, the working copy, and the data that goes into training. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/articles/diy-automl-development-note-03-parquet-duckdb.md" rel="noopener noreferrer"&gt;Japanese original&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the original CSV and record the working copy
&lt;/h2&gt;

&lt;p&gt;The workflow keeps and audits the original CSV, optionally creates a working file, then extracts and checks the training data. The audit looks at row counts, missing values, duplicate rows, and label counts. A conversion records the output row count, column types, and SHA-256 hash of the source CSV.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parquet&lt;/strong&gt; stores data by column. DIY AutoML writes it with Zstandard compression to reduce the bytes stored and read. &lt;a href="https://parquet.apache.org/docs/overview/" rel="noopener noreferrer"&gt;Apache Parquet overview&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DuckDB&lt;/strong&gt; reads Parquet directly and can limit reads to the projected columns. If the row group statistics show that a group cannot match a filter, DuckDB can skip it. A persistent &lt;code&gt;.duckdb&lt;/code&gt; file can also hold a table for reuse. &lt;a href="https://duckdb.org/docs/data/parquet#partial-reading" rel="noopener noreferrer"&gt;DuckDB Parquet documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By default, conversion preserves the text read from each CSV field. That keeps leading zeros in identifiers, for example. The &lt;code&gt;--conversion-types numeric&lt;/code&gt; option gives numerical types to feature columns whose values can be represented exactly. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/DATA_AUDIT.md#parquet%E3%81%A8duckdb%E3%81%B8%E3%81%AE%E5%A4%89%E6%8F%9B" rel="noopener noreferrer"&gt;Conversion and verification rules (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Select columns from Raisin while keeping every row
&lt;/h2&gt;

&lt;p&gt;The Raisin CSV has 900 records. I extracted area (&lt;code&gt;Area&lt;/code&gt;), perimeter (&lt;code&gt;Perimeter&lt;/code&gt;), and the recorded variety (&lt;code&gt;target&lt;/code&gt;). Run the PowerShell commands from the repository root. If needed, install the optional dependencies with &lt;code&gt;.\.venv\Scripts\python.exe -m pip install -e ".[storage]"&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$python&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;".\.venv\Scripts\python.exe"&lt;/span&gt;
&lt;span class="nv"&gt;$work&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"runs/dev-note-03-raisin"&lt;/span&gt;

&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$python&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt; &lt;span class="n"&gt;utf8&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="n"&gt;diy_automl&lt;/span&gt; &lt;span class="n"&gt;audit&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;csv&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;reference&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;raisin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;csv&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;convert&lt;/span&gt; &lt;span class="n"&gt;parquet&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;convert&lt;/span&gt; &lt;span class="n"&gt;duckdb&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"$work/source-audit"&lt;/span&gt;
&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$python&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt; &lt;span class="n"&gt;utf8&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="n"&gt;diy_automl&lt;/span&gt; &lt;span class="n"&gt;extract&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="s2"&gt;"$work/source-audit/converted/data.parquet"&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt; &lt;span class="nc"&gt;Area&lt;/span&gt; &lt;span class="nc"&gt;Perimeter&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"$work/from-parquet"&lt;/span&gt;
&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$python&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt; &lt;span class="n"&gt;utf8&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="n"&gt;diy_automl&lt;/span&gt; &lt;span class="n"&gt;audit&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;csv&lt;/span&gt; &lt;span class="s2"&gt;"$work/from-parquet/data.csv"&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"$work/extracted-audit"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first command creates both working files. You can request a single format by passing one &lt;code&gt;--convert&lt;/code&gt; option. To extract from DuckDB, change the input to &lt;code&gt;data.duckdb&lt;/code&gt; and give the extraction a fresh output directory. Set a new &lt;code&gt;$work&lt;/code&gt; path to repeat the whole example.&lt;/p&gt;

&lt;p&gt;For both formats, the three columns and row order matched the original CSV. The counts stayed at &lt;strong&gt;450 Besni and 450 Kecimen&lt;/strong&gt;. The extracted &lt;code&gt;data.csv&lt;/code&gt; is the file that goes to training. The audit and extraction manifests let you trace the selected columns back to the original data. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/data/reference/README.md" rel="noopener noreferrer"&gt;Raisin source and example (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure each stage on a PC with 16 GB of RAM
&lt;/h2&gt;

&lt;p&gt;I used a Windows PC with a Core i5-14400 and 16 GB of RAM. The test dataset was a synthetic one-million-row table with seven numeric features and a binary label. The audit and conversion processed all one million rows, and model comparison used 10,000 extracted rows. The Parquet benchmark used &lt;code&gt;--conversion-types numeric&lt;/code&gt;. The CSV occupied &lt;strong&gt;36.2 MB&lt;/strong&gt; and the compressed Parquet file &lt;strong&gt;18.9 MB&lt;/strong&gt;. For each stage, elapsed time is the median of three runs. Memory is the highest peak working set of the Python process across those runs.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;Input or output size&lt;/th&gt;
&lt;th&gt;Time (s)&lt;/th&gt;
&lt;th&gt;Memory (MiB)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Audit CSV&lt;/td&gt;
&lt;td&gt;1,000,000 input rows&lt;/td&gt;
&lt;td&gt;63.3&lt;/td&gt;
&lt;td&gt;169&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Audit and convert to Parquet&lt;/td&gt;
&lt;td&gt;1,000,000 input rows&lt;/td&gt;
&lt;td&gt;91.1&lt;/td&gt;
&lt;td&gt;186&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Extract from the existing Parquet file&lt;/td&gt;
&lt;td&gt;10,000 output rows&lt;/td&gt;
&lt;td&gt;2.3&lt;/td&gt;
&lt;td&gt;186&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Compare and evaluate five models&lt;/td&gt;
&lt;td&gt;10,000 extracted rows&lt;/td&gt;
&lt;td&gt;10.4&lt;/td&gt;
&lt;td&gt;195&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first conversion includes the audit and the write to Parquet. The extraction timing starts with the working file already in place. For this benchmark, two filters and a 10,000-row cap defined the extraction, and the models trained on the extracted dataset. At 100,000 rows, increasing the number of features from seven to 28 raised the audit-plus-conversion time from 7.4 to 15.6 seconds. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/experiments/tabular_scale_benchmark/README.md" rel="noopener noreferrer"&gt;Benchmark procedure&lt;/a&gt; · &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/experiments/tabular_scale_benchmark/results-2026-11-19.json" rel="noopener noreferrer"&gt;All timings and input sizes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For an evaluation, I start with the rows and columns needed to answer the question and generally keep every row in that scope. Around 100,000 rows or 20 columns is a starting point for considering a working file, especially if I will read or reshape the data repeatedly. The cost of training still depends on the rows, features, and models passed to that stage.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI assistance was used to adapt the project's development notes and experiment records into this English article.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dataengineering</category>
      <category>parquet</category>
      <category>duckdb</category>
    </item>
    <item>
      <title>Same F1, different mistakes: cross-checking machine learning libraries</title>
      <dc:creator>masaya oka</dc:creator>
      <pubDate>Wed, 25 Nov 2026 02:19:36 +0000</pubDate>
      <link>https://dev.to/masaya_oka/same-f1-different-mistakes-cross-checking-machine-learning-libraries-19mf</link>
      <guid>https://dev.to/masaya_oka/same-f1-different-mistakes-cross-checking-machine-learning-libraries-19mf</guid>
      <description>&lt;p&gt;On Wine, DIY AutoML and AutoGluon had the same macro F1 and confusion matrix. They misclassified different rows. I used Iris and Wine to look at what the aggregate score leaves out, first by comparing neural-network probabilities and then by scoring separately selected models on the same holdouts. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/articles/diy-automl-development-note-02-cross-check.md" rel="noopener noreferrer"&gt;Japanese original&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Compare labels and probabilities across two neural-network libraries
&lt;/h2&gt;

&lt;p&gt;I used TensorFlow 2.20.0 and PyTorch 2.14.0 on a Windows CPU with Python 3.13.17. Both networks had hidden layers of 32, 16, and 8 units. They shared the standardization fitted on the training rows, Float32 inputs, initial weights, and minibatch order. I ran three training seeds. When both libraries used the same weights for inference, the largest absolute difference in predicted probabilities on the 0–1 scale was about 6 × 10⁻⁸. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/experiments/dl_backend_crosscheck/README.md" rel="noopener noreferrer"&gt;Experiment settings and reproduction steps&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After training each implementation separately, the predicted labels matched row for row on the holdout for all three seeds. The confusion matrices and macro F1 also matched. The probabilities showed small differences.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dataset&lt;/th&gt;
&lt;th&gt;Held-out rows&lt;/th&gt;
&lt;th&gt;Largest probability difference after training&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Iris&lt;/td&gt;
&lt;td&gt;30&lt;/td&gt;
&lt;td&gt;3.05 percentage points&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wine&lt;/td&gt;
&lt;td&gt;36&lt;/td&gt;
&lt;td&gt;0.21 percentage points&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For Iris at seed 42, both models predicted class 2 for CSV line 58, counting the header as line 1. TensorFlow assigned class 2 a probability of &lt;strong&gt;56.867%&lt;/strong&gt; and PyTorch assigned &lt;strong&gt;53.814%&lt;/strong&gt;. The correct class was 1, to which they assigned &lt;strong&gt;42.232%&lt;/strong&gt; and &lt;strong&gt;45.253%&lt;/strong&gt;, respectively. The confusion matrix records the same error either way.&lt;/p&gt;

&lt;p&gt;Log loss reflects the probability assigned to the correct class. For Wine, I kept the fitted models fixed and drew paired samples with replacement from the 36 holdout rows. For each sample I calculated the difference in mean log loss across the three seeds (PyTorch minus TensorFlow). When the number of draws increased from 1,000 to 20,000, the upper end of the 95% interval moved from −3.0 × 10⁻⁷ to +1.8 × 10⁻⁷. With the longer run, the interval just included zero. I left the direction of the difference unresolved. &lt;a href="https://scikit-learn.org/stable/modules/generated/sklearn.metrics.log_loss.html" rel="noopener noreferrer"&gt;Log loss definition&lt;/a&gt; · &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/articles/backup/diy-automl-ds-backend-probabilities.md" rel="noopener noreferrer"&gt;Recomputing the interval from saved predictions (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluate AutoGluon on the same splits
&lt;/h2&gt;

&lt;p&gt;AutoGluon Tabular 1.6.3 reused the cross-validation and final test row indices saved by DIY AutoML's &lt;code&gt;rank-sl&lt;/code&gt; command. Each workflow kept its own candidates and preprocessing. AutoGluon's five candidates in this run were random forest, Extra Trees, k-nearest neighbors, logistic regression, and a weighted ensemble. An available-memory check led to skipping LightGBM on this PC.&lt;/p&gt;

&lt;p&gt;Each workflow selected its leader using macro F1 on the shared cross-validation splits. DIY AutoML selected an SVM for both datasets. AutoGluon selected k-nearest neighbors for Iris and logistic regression for Wine. I then scored the winners on the same final test rows. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/experiments/autogluon_sl_crosscheck/README.md" rel="noopener noreferrer"&gt;AutoGluon experiment and reproduction steps&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dataset&lt;/th&gt;
&lt;th&gt;DIY AutoML F1&lt;/th&gt;
&lt;th&gt;AutoGluon F1&lt;/th&gt;
&lt;th&gt;AutoGluon minus DIY and 95% interval&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Iris, 30 rows&lt;/td&gt;
&lt;td&gt;0.9666&lt;/td&gt;
&lt;td&gt;1.0000&lt;/td&gt;
&lt;td&gt;+0.0334 [0.0000, +0.1023]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wine, 36 rows&lt;/td&gt;
&lt;td&gt;0.9710&lt;/td&gt;
&lt;td&gt;0.9710&lt;/td&gt;
&lt;td&gt;0.0000 [−0.0911, +0.0911]&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The paired bootstrap held the fitted models fixed and drew the same held-out rows for both models, within classes, 1,000 times. Both intervals included zero. On Wine, the macro F1 and confusion matrices matched, but the error occurred on CSV line 132 for DIY AutoML and line 136 for AutoGluon, counting the header as line 1.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional check with H2O AutoML
&lt;/h3&gt;

&lt;p&gt;On the same Windows PC, I ran H2O AutoML 3.46.0.12 with Python 3.14.7 and Java 17. The run used up to five candidates from generalized linear models, distributed random forests, and gradient boosting. H2O used the first of DIY AutoML's saved five-fold repeats and selected by mean fold macro F1. The DIY AutoML models in the comparison came from the original five repeats. H2O selected a generalized linear model on both datasets. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/experiments/h2o_sl_crosscheck/README.md" rel="noopener noreferrer"&gt;H2O configuration and reproduction steps&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dataset&lt;/th&gt;
&lt;th&gt;H2O AutoML F1&lt;/th&gt;
&lt;th&gt;H2O minus DIY and 95% interval&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Iris, 30 rows&lt;/td&gt;
&lt;td&gt;1.0000&lt;/td&gt;
&lt;td&gt;+0.0334 [0.0000, +0.1023]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wine, 36 rows&lt;/td&gt;
&lt;td&gt;0.9407&lt;/td&gt;
&lt;td&gt;−0.0302 [−0.0960, 0.0000]&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;AutoGluon and H2O each got all 30 Iris rows right. On Wine, DIY AutoML got 35 of 36 right and H2O got 34. The H2O differences were evaluated using the same resampled test rows as the AutoGluon comparison. Both intervals included zero under this evaluation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the predictions that explain the score
&lt;/h2&gt;

&lt;p&gt;A workbook gives you the score. Saved row indices, labels, and predictions let you see where two runs agree and where their errors differ. With saved probabilities, I could extend the neural-network comparison to log loss without retraining. That is the part I want DIY AutoML to make easy to follow, from checking the original data to handing off results someone else can read and reproduce.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI assistance was used to adapt the project's development notes and experiment records into this English article.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>deeplearning</category>
      <category>machinelearning</category>
      <category>tensorflow</category>
      <category>pytorch</category>
    </item>
    <item>
      <title>Audit an Iris CSV before ranking five classifiers</title>
      <dc:creator>masaya oka</dc:creator>
      <pubDate>Wed, 25 Nov 2026 02:09:49 +0000</pubDate>
      <link>https://dev.to/masaya_oka/audit-an-iris-csv-before-ranking-five-classifiers-457</link>
      <guid>https://dev.to/masaya_oka/audit-an-iris-csv-before-ranking-five-classifiers-457</guid>
      <description>&lt;p&gt;I ran five classifiers on Iris and selected an SVM. The held-out macro F1 was 0.967, with a conditional 95% interval of 0.898 to 1.000. To decide what that result is worth, I want to know which data went in, how the candidates were compared, and which rows produced the final score. DIY AutoML saves those details from the initial audit through the evaluation.&lt;/p&gt;

&lt;p&gt;I tried the workflow on a Windows PC with 16 GB of RAM using a Python 3.13.17 virtual environment. The core uses pandas to read tables, scikit-learn to train and compare the classifiers, and openpyxl to write the Excel reports. The bundled Iris CSV has four numerical measurements and a species label per row, so the example runs on a CPU. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/README.en.md#try-it-on-iris" rel="noopener noreferrer"&gt;Setup&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Trace the result back to the input
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu47u6foe46qcuficpghr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu47u6foe46qcuficpghr.png" alt="Keep and audit the source CSV. Prepare the CSV directly or use a Parquet or DuckDB working copy. Set aside the holdout, compare models on the training split, then evaluate on the holdout and save the results for reanalysis and Excel reporting." width="800" height="847"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The audit records issues such as missing values and duplicate rows. If a dataset will be read and filtered several times, a Parquet or DuckDB working copy can make that preparation easier to repeat. After extracting the training data, check the row count, missing values, and label counts again. For the 150-row Iris example, the original CSV is small enough to use directly. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/papers/DIY_AutoML_Full_Paper_20261119/DIY_AutoML_Full_Paper_20261119.pdf" rel="noopener noreferrer"&gt;Workflow in Figure 1 of the full paper (Japanese)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inspect Iris and compare five classifiers
&lt;/h2&gt;

&lt;p&gt;Run these PowerShell commands from the repository root with Python 3.13 installed. The recorded species is in &lt;code&gt;target&lt;/code&gt;. Use a fresh output directory when repeating the commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$python&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;".\.venv\Scripts\python.exe"&lt;/span&gt;
&lt;span class="nv"&gt;$work&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"runs/dev-note-01-iris"&lt;/span&gt;
&lt;span class="n"&gt;py&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;3.13&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="n"&gt;venv&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;venv&lt;/span&gt;
&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$python&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$python&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt; &lt;span class="n"&gt;utf8&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="n"&gt;diy_automl&lt;/span&gt; &lt;span class="n"&gt;audit&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;csv&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;reference&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;iris&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;csv&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt; &lt;span class="s2"&gt;"One iris plant"&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"$work/audit"&lt;/span&gt;
&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$python&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt; &lt;span class="n"&gt;utf8&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="n"&gt;diy_automl&lt;/span&gt; &lt;span class="n"&gt;select&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;csv&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;reference&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;iris&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;csv&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"$work/selection"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The audit found 50 rows for each of the three classes and one exact duplicate across all columns. An identical row prompts a check of the original records to see whether two rows describe the same observation. I kept all 150 rows for this walkthrough.&lt;/p&gt;

&lt;p&gt;The split put 120 rows on the training side and reserved 30 for the final test. A decision tree, random forest, logistic regression, support vector machine (SVM), and k-nearest neighbors all used the same five cross-validation splits on the 120 rows. Standardization was fitted on the training portion of each fold. Candidate scores use macro F1, which averages the F1 scores of the classes with equal weight.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What I checked&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Selected model and mean cross-validation macro F1&lt;/td&gt;
&lt;td&gt;SVM, 0.967&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance on the 30 held-out rows&lt;/td&gt;
&lt;td&gt;29 correct, macro F1 of 0.967&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Conditional 95% interval for held-out macro F1&lt;/td&gt;
&lt;td&gt;0.898 to 1.000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The two F1 values round to the same number and come from different rows. The cross-validation average selects the candidate. The held-out score evaluates that candidate after refitting it on all 120 training rows. The interval shows how the score varies when the evaluation rows are resampled within their recorded classes with the fitted model held fixed. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/DATA_SCIENCE_GUIDE.en.md#interpret-an-uncertainty-estimate" rel="noopener noreferrer"&gt;Evaluation guide&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Hand off the same result in two ways
&lt;/h2&gt;

&lt;p&gt;For data scientists, &lt;code&gt;report.xlsx&lt;/code&gt; holds the scores, &lt;code&gt;arrays.npz&lt;/code&gt; holds the splits and predictions, and &lt;code&gt;manifest.json&lt;/code&gt; records the settings and input hash. The Windows preview shows the number evaluated, the correct and incorrect counts, and charts from the same evaluation. It also opens a workbook with summary sheets and class-level errors. &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/DATA_SCIENCE_GUIDE.en.md" rel="noopener noreferrer"&gt;Data science guide&lt;/a&gt; · &lt;a href="https://github.com/okamasaya/DIY_AutoML/blob/64b17f120dad1ead6256d963b779c13630457898/docs/BUSINESS_USER_GUIDE.en.md" rel="noopener noreferrer"&gt;Business user guide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A team may choose a model lower in the ranking for operational reasons. The scores from the same cross-validation folds give the team a way to quantify what it is trading off.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I want to measure next
&lt;/h2&gt;

&lt;p&gt;The next experiments cover library cross-checks, reusable data preparation, feature selection, reading errors in Excel, and time-series forecasting.&lt;/p&gt;

&lt;p&gt;For date-ordered classification, I want to estimate how uncertain the gap between a model and a simple rule is when nearby days are dependent. Then I want to see &lt;/p&gt;

</description>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>python</category>
      <category>scikitlearn</category>
    </item>
  </channel>
</rss>
