<?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: H4dis</title>
    <description>The latest articles on DEV Community by H4dis (@h4dis).</description>
    <link>https://dev.to/h4dis</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%2F4063083%2Feee07e72-7839-4bb3-848b-dd12630e6fc5.png</url>
      <title>DEV Community: H4dis</title>
      <link>https://dev.to/h4dis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/h4dis"/>
    <language>en</language>
    <item>
      <title>Bearing Fault Diagnosis – Multi‑Layer Intelligent Vibration Analysis Pipeline</title>
      <dc:creator>H4dis</dc:creator>
      <pubDate>Fri, 21 Aug 2026 17:41:42 +0000</pubDate>
      <link>https://dev.to/h4dis/bearing-fault-diagnosis-multi-layer-intelligent-vibration-analysis-pipeline-cmc</link>
      <guid>https://dev.to/h4dis/bearing-fault-diagnosis-multi-layer-intelligent-vibration-analysis-pipeline-cmc</guid>
      <description>&lt;ol&gt;
&lt;li&gt;Introduction &amp;amp; Physical Data Challenges&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In rotating machinery such as electrofans, early detection of bearing faults before catastrophic failure is of critical importance. The vibration data collected from sensors includes six primary signal variables: velocity, acceleration, crest factor, kurtosis, and peak values.&lt;/p&gt;

&lt;p&gt;Initial analysis revealed that direct modeling on raw data faces deep challenges:&lt;/p&gt;

&lt;p&gt;· Severe class overlap in raw variables: Healthy signals (Class 0), severe faults (Class 1), and mild faults (Class 2) show overlapping distributions.&lt;br&gt;
· Local and structural installation effects: A specific vibration level at one measurement position (MP_LOC) or on a particular component (COMP_NAME) may indicate normal operation, while the same level on another component may indicate advanced failure.&lt;br&gt;
· Presence of outliers and skewed distributions: Amplitude features exhibit strong instantaneous fluctuations and right‑skewed distributions.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Exploratory Data Analysis (EDA) – Why Generic Models Fail&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2.1 Severe Overlap in Raw Vibration Features&lt;/p&gt;

&lt;p&gt;[&lt;br&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%2Fz73attw58jg13gxxzmv0.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%2Fz73attw58jg13gxxzmv0.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;]&lt;br&gt;
Figure 1: Distribution of Vel, Rms (RMS) across three classes – showing strong right‑skew and overlap.&lt;/p&gt;

&lt;p&gt;[&lt;br&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%2Fwxch697t6f5ijibpm6pd.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%2Fwxch697t6f5ijibpm6pd.png" alt=" " width="900" height="600"&gt;&lt;/a&gt;]&lt;br&gt;
Figure 2: Distribution of Crest (RMS) across three classes – crest factor ranges between 2.5 and 3.5 with identical overlapping distributions.&lt;/p&gt;

&lt;p&gt;The Crest Factor variable shows nearly identical distribution across all three classes in the range of 2.5 to 3.5. The Vel, Rms variable exhibits strong right‑skewed distribution in the range of 0 to 3.&lt;/p&gt;

&lt;p&gt;2.2 Presence of Outliers and the Necessity of Robust Scaling&lt;/p&gt;

&lt;p&gt;[&lt;br&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%2F1b3mle4oqj8x2qbouo7v.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%2F1b3mle4oqj8x2qbouo7v.png" alt=" " width="800" height="503"&gt;&lt;/a&gt;]&lt;br&gt;
Figure 3: Boxplot of velocity‑to‑acceleration ratio showing severe outliers (values above 30–40).&lt;/p&gt;

&lt;p&gt;Composite features contain severe outliers, making RobustScaler essential for proper scaling.&lt;/p&gt;

&lt;p&gt;2.3 Baseline Model Performance Ceiling &amp;amp; Class 2 Challenge&lt;/p&gt;

&lt;p&gt;[&lt;br&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%2Fxsdivvawse4r9mftnpr4.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%2Fxsdivvawse4r9mftnpr4.png" alt=" " width="799" height="571"&gt;&lt;/a&gt;]&lt;br&gt;
Figure 4: Initial confusion matrix of generic models without local layer – Macro F1: 59.71%&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Feature Engineering&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Feature Name Formula Industrial Purpose&lt;br&gt;
peak_to_rms Vel_Peak / (Vel_Rms + eps) Evaluates sudden impact forces&lt;br&gt;
severity_index Vel_Rms * Acc_Rms * Crest Overall fault severity indicator&lt;br&gt;
early_fault_index (Kurt * Crest) / (Acc_Rms + eps) Detects early‑stage surface defects&lt;br&gt;
Group Z‑Score (x - μ_group) / (σ_group + eps) Removes physical sensor position effects&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Preprocessing &amp;amp; Feature Selection&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Using RFE (Recursive Feature Elimination) with a Random Forest estimator, the top 30 features were selected. All features were then scaled using RobustScaler to mitigate outlier effects.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Model Architecture &amp;amp; Intelligent Hybrid Routing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The final prediction is a hybrid ensemble consisting of:&lt;/p&gt;

&lt;p&gt;· 3 Tree‑Based Models:&lt;br&gt;
  · XGBoost – 35% weight&lt;br&gt;
  · LightGBM – 35% weight&lt;br&gt;
  · RandomForest – 30% weight&lt;br&gt;
· Local KNN Layer with inverse‑distance weighting for context‑aware predictions.&lt;/p&gt;

&lt;p&gt;Adaptive Alpha Blending Logic&lt;/p&gt;

&lt;p&gt;Nearest Neighbor Distance (min_dist) Alpha (KNN Weight) 1‑Alpha (Ensemble Weight) Decision Logic&lt;br&gt;
&amp;lt; 0.5 0.90 0.10 Full trust in local sensor pattern&lt;br&gt;
0.5 – 1.5 0.70 0.30 Local priority with ensemble support&lt;br&gt;
1.5 – 3.0 0.40 0.60 Ensemble priority due to increased distance&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;3.0 0.15 0.85 Full trust in global ensemble generalization&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;Validation &amp;amp; Overfitting Monitoring&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Metric Value&lt;br&gt;
5‑Fold CV F1‑Macro 88.42% ± 0.015&lt;br&gt;
Train Accuracy 88.65%&lt;br&gt;
Train F1‑Macro 88.31%&lt;/p&gt;

&lt;p&gt;The convergence of training and validation scores clearly demonstrates no overfitting and strong generalization capability on unseen data.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Final Submission Specifications&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Item Value&lt;br&gt;
Output File Name submission15.csv&lt;br&gt;
Total Predicted Samples 600 rows&lt;br&gt;
Class Distribution Class 0: 241, Class 1: 238, Class 2: 121&lt;br&gt;
Final Test F1‑Macro 89.46%&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Key Technical Phrases Used in This Project&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Phrase Context&lt;br&gt;
Adaptive Alpha Blending Dynamic weighting between local KNN and global ensemble&lt;br&gt;
Hybrid Routing Routing samples based on local cluster density&lt;br&gt;
Group‑Aware Feature Engineering Z‑score normalization per (COMP_NAME, MP_LOC)&lt;br&gt;
Leakage‑Free Validation GroupKFold to keep identical rows together&lt;br&gt;
Outlier‑Resilient Scaling RobustScaler for skewed vibration data&lt;br&gt;
Contextual KNN Neighbor search restricted to same component &amp;amp; position&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This project demonstrates that combining global ensemble models with a locally‑aware KNN layer significantly improves bearing fault diagnosis, especially for imbalanced classes and location‑dependent vibration patterns. The final model achieved a top‑5 ranking in the competition test phase, with a robust and generalizable pipeline that balances accuracy, interpretability, and industrial applicability.&lt;/p&gt;

&lt;p&gt;Repository: [&lt;a href="https://github.com/H4dis/super-fan-electro" rel="noopener noreferrer"&gt;https://github.com/H4dis/super-fan-electro&lt;/a&gt;]&lt;br&gt;
Full Code &amp;amp; Extended Documentation: Available in the repository.&lt;/p&gt;

</description>
      <category>dataengineering</category>
      <category>challenge</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Feature Engineering Trade-offs &amp; Multi-Metric</title>
      <dc:creator>H4dis</dc:creator>
      <pubDate>Tue, 04 Aug 2026 20:49:58 +0000</pubDate>
      <link>https://dev.to/h4dis/feature-engineering-trade-offs-multi-metric-5473</link>
      <guid>https://dev.to/h4dis/feature-engineering-trade-offs-multi-metric-5473</guid>
      <description>&lt;p&gt;Adding manual signal features (Impact Severity, Energy Ratios) boosted Class 2 F1 score but caused metric drop in Class 0 &amp;amp; 1, decreasing total leaderboard performance.&lt;br&gt;
&lt;strong&gt;Root Causes&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multicollinearity&lt;/strong&gt;: Re-creating Peak-to-RMS ratio when** Crest Factor** was already present.
&lt;strong&gt;- Dimensional Mismatch&lt;/strong&gt;: Direct summation of unscaled velocity (mm/s) and acceleration (g).
&lt;em&gt;-** Outlier Explosion&lt;/em&gt;**: Division by small RMS values creating extreme data spikes.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Metric Trade-off&lt;/strong&gt;: Optimizing&lt;br&gt;
features for a single class without controlling multi-metric balance.&lt;br&gt;
&lt;strong&gt;Key Learnings &amp;amp; Fixes&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Outlier Suppression&lt;/strong&gt;: Apply logarithmic transformation (np.log1p) on raw ratio features to normalize distributions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Feature Stacking&lt;/strong&gt;: Isolate noisy Class 2 features into a binary sub-model, injecting only its output probability (prob_class2) into the main classifier.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multi-Threshold Post-Processing&lt;/strong&gt;: Use scipy.optimize.minimize (Nelder-Mead) on prediction probabilities to optimize overall multi-metric leaderboard score instead of manual feature hacking.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Competition vs Engineering&lt;/strong&gt;: Recognized that high leaderboard scores often rely on prior distribution alignment and post-processing hacks rather than pure signal domain analysis.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>machinelearning</category>
      <category>programming</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
