<?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: Talha Bin Rais</title>
    <description>The latest articles on DEV Community by Talha Bin Rais (@talha_binrais_4323bd7bb4).</description>
    <link>https://dev.to/talha_binrais_4323bd7bb4</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%2F4085150%2F0996d0a7-5674-4afd-90c9-cbfb8614b6c3.png</url>
      <title>DEV Community: Talha Bin Rais</title>
      <link>https://dev.to/talha_binrais_4323bd7bb4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/talha_binrais_4323bd7bb4"/>
    <language>en</language>
    <item>
      <title>step-01</title>
      <dc:creator>Talha Bin Rais</dc:creator>
      <pubDate>Wed, 19 Aug 2026 13:52:59 +0000</pubDate>
      <link>https://dev.to/talha_binrais_4323bd7bb4/step-01-k53</link>
      <guid>https://dev.to/talha_binrais_4323bd7bb4/step-01-k53</guid>
      <description>&lt;p&gt;Yes. Let's restart the &lt;strong&gt;ML/hybrid notebook from Step 01&lt;/strong&gt;, but keep the decisions that are already sound. We will not redesign BEACON; this is only the ML prediction stage.&lt;/p&gt;

&lt;p&gt;I recommend we build it &lt;strong&gt;one step at a time and run/check each step before moving to the next&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  New notebook structure
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;01. Load Carbon Catalogue
02. Define target and input features
03. Fixed 80/20 train-test split
04. Create inner training / validation split
05. Structured-feature preprocessing
06. Text preparation
07. Sentence-BERT embeddings
08. Optional PCA experiment
09. Feature fusion
10. Baseline ML models
11. Hybrid ML models
12. Validation comparison
13. Select best configuration
14. Freeze final model
15. Final 20% test evaluation
16. Baseline vs Hybrid comparison
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 01 — Load and inspect the dataset
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Do not do feature engineering, PCA, Sentence-BERT, or modelling yet.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first notebook cell should simply establish the dataset.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ============================================================
# STEP 01 — LOAD AND INSPECT CARBON CATALOGUE
# ============================================================
&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="c1"&gt;# Load dataset
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_CARBON_CATALOGUE_FILE.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Dataset shape:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Columns:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tolist&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;First 5 rows:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Data types:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dtypes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Missing values:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isnull&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Duplicate rows:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;duplicated&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What we want to establish here
&lt;/h3&gt;

&lt;p&gt;After running Step 01, we should know:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Number of rows&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Number of columns&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Exact column names&lt;/li&gt;
&lt;li&gt;Data types&lt;/li&gt;
&lt;li&gt;Missing values&lt;/li&gt;
&lt;li&gt;Duplicate rows&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Most importantly, we need to confirm the exact &lt;strong&gt;PCF target column&lt;/strong&gt; and the exact text columns you intend to use.&lt;/p&gt;




&lt;h2&gt;
  
  
  Then Step 02 will define the modelling inputs
&lt;/h2&gt;

&lt;p&gt;Conceptually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Target
   │
   └── Product Carbon Footprint (PCF)

Structured branch
   │
   ├── Year
   ├── Weight
   ├── Industry information
   ├── Protocol information
   └── other selected structured features

Text branch
   │
   ├── Product Name
   ├── Company
   └── Country
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should &lt;strong&gt;not guess these columns&lt;/strong&gt;. We will take them from your existing notebook/dataset so that the new implementation remains consistent with the work you have already done.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 03 — Split the data
&lt;/h2&gt;

&lt;p&gt;We will retain the good part of the previous design:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 ALL DATA
                 866 rows
                    │
             ┌──────┴──────┐
             │             │
           80%           20%
        Development       Test
          ~692            ~174
             │
        ┌────┴────┐
        │         │
      80%       20%
     ~553       ~139
     Train    Validation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;174 test rows remain untouched&lt;/strong&gt; until the very end.&lt;/p&gt;

&lt;p&gt;That is important and I do &lt;strong&gt;not&lt;/strong&gt; recommend changing it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 04 onwards — the hybrid experiment
&lt;/h2&gt;

&lt;p&gt;The central part will eventually become:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                   TEXT
                     │
                     ▼
              Sentence-BERT
                     │
                     ▼
                  384-D
                     │
              ┌──────┴──────┐
              │             │
          No PCA          PCA
              │             │
              │       200 / 100 / 50
              │             │
              └──────┬──────┘
                     │
                     ▼
              TEXT FEATURES
                     │
                     │
STRUCTURED ──────────┘
FEATURES
     │
     ▼
FEATURE FUSION
     │
     ▼
HYBRID FEATURES
     │
     ▼
ML REGRESSOR
     │
     ▼
PCF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;384-dimensional version is our natural starting point&lt;/strong&gt;. PCA is then an experiment to determine whether reducing those dimensions improves or maintains performance.&lt;/p&gt;

&lt;p&gt;So we are &lt;strong&gt;not assuming that 384 is too high&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  One important rule for the restart
&lt;/h1&gt;

&lt;p&gt;Let's not write the entire notebook in one go.&lt;/p&gt;

&lt;p&gt;We should work like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 01 → run → inspect result → confirm → Step 02 → run → inspect → ...&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That will prevent the previous problem where the notebook became technically complicated before we had established exactly what each part was doing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start now with Step 01.
&lt;/h3&gt;

&lt;p&gt;Run the Step 01 cell using your actual Carbon Catalogue file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Send me the output of:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dataset shape
Columns
Data types
Missing values
Duplicate rows
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I will give you &lt;strong&gt;Step 02 only&lt;/strong&gt;, using the actual structure of your dataset.&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>confusion-10</title>
      <dc:creator>Talha Bin Rais</dc:creator>
      <pubDate>Wed, 19 Aug 2026 13:51:53 +0000</pubDate>
      <link>https://dev.to/talha_binrais_4323bd7bb4/confusion-10-1j5n</link>
      <guid>https://dev.to/talha_binrais_4323bd7bb4/confusion-10-1j5n</guid>
      <description>&lt;p&gt;Yes — &lt;strong&gt;if you want to restart the ML part from the beginning, this is actually a good point to simplify it properly.&lt;/strong&gt; We do not need to redesign the whole project; we can rebuild the hybrid experiment cleanly around the idea you originally intended.&lt;/p&gt;

&lt;p&gt;And yes, your understanding of PCA is correct:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Sentence-BERT gives a 384-dimensional embedding. PCA can be used to reduce those 384 dimensions to a smaller number of dimensions.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But &lt;strong&gt;384 dimensions is not automatically "too high"&lt;/strong&gt;. With your dataset size, the question is whether keeping all 384 dimensions is useful and stable.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Start from the simplest possible architecture
&lt;/h2&gt;

&lt;p&gt;I recommend starting with this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 CARBON CATALOGUE
                       │
              Fixed 80/20 split
                       │
          ┌────────────┴────────────┐
          │                         │
          ▼                         ▼
   STRUCTURED FEATURES          TEXT FEATURES
          │                         │
   Year, Weight, etc.       Product + Company
          │                   + Country
          │                         │
          │                         ▼
          │                  Sentence-BERT
          │                         │
          │                    384-D embedding
          │                         │
          └────────────┬────────────┘
                       ▼
                 FEATURE FUSION
                       │
                       ▼
             HYBRID FEATURE VECTOR
                       │
                       ▼
                  ML REGRESSOR
                       │
                       ▼
                  PCF prediction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the &lt;strong&gt;core hybrid model&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Don't introduce PCA yet.&lt;/p&gt;

&lt;p&gt;First establish that this model works.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. What exactly happens to the text?
&lt;/h1&gt;

&lt;p&gt;Suppose one row contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Product Name:
Organic cotton T-shirt

Company:
Example Textile Ltd

Country:
Bangladesh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You combine those text fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Organic cotton T-shirt | Example Textile Ltd | Bangladesh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                  Combined text
                       │
                       ▼
               Sentence-BERT
                       │
                       ▼
          [e1, e2, e3, ..., e384]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So each row gets &lt;strong&gt;384 numerical features&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example, conceptually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;e1       = 0.034
e2       = -0.127
e3       = 0.082
...
e384     = 0.041
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are the &lt;strong&gt;embedding features&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. Is 384-D too high?
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Short answer: No.
&lt;/h3&gt;

&lt;p&gt;384 dimensions is actually quite modest for a text embedding.&lt;/p&gt;

&lt;p&gt;The bigger issue is your &lt;strong&gt;dataset size&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You have approximately:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;866 total rows
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and therefore roughly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;553 training
139 validation
174 test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So you have around &lt;strong&gt;553 inner-training observations&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you directly use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;384 embedding features
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you have a relatively high feature-to-sample ratio.&lt;/p&gt;

&lt;p&gt;It is not impossible, but it creates a reasonable research question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Does dimensionality reduction improve generalisation?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's exactly where PCA becomes useful.&lt;/p&gt;




&lt;h1&gt;
  
  
  4. PCA's role becomes very clear now
&lt;/h1&gt;

&lt;p&gt;Think of PCA like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sentence-BERT
     │
     ▼
384 dimensions
     │
     │ PCA
     ▼
smaller representation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;384 → 200
384 → 100
384 → 75
384 → 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PCA attempts to preserve as much of the variation/information in the original embedding as possible while representing it using fewer dimensions.&lt;/p&gt;

&lt;p&gt;So PCA is &lt;strong&gt;not creating the hybrid model&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Sentence-BERT creates the text representation. PCA optionally compresses that representation. Feature fusion creates the hybrid representation.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This distinction is very important.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. Therefore, don't immediately test 50, 75, 100, 150, 200
&lt;/h1&gt;

&lt;p&gt;This is where I would change the previous notebook.&lt;/p&gt;

&lt;p&gt;If we start again, I recommend a &lt;strong&gt;two-step experiment&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Experiment 1 — Full embedding
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text
 ↓
Sentence-BERT
 ↓
384-D
 ↓
Fusion
 ↓
ML
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This establishes your baseline hybrid model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Experiment 2 — PCA
&lt;/h3&gt;

&lt;p&gt;Then investigate whether PCA improves it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Text
 ↓
Sentence-BERT
 ↓
384-D
 ↓
PCA
 ↓
Fusion
 ↓
ML
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now PCA has a clear scientific purpose.&lt;/p&gt;




&lt;h1&gt;
  
  
  6. What should PCA dimensions be?
&lt;/h1&gt;

&lt;p&gt;Don't arbitrarily choose many values simply because they are available.&lt;/p&gt;

&lt;p&gt;I would use a small, justified set such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;384
200
100
50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;384&lt;/strong&gt; = no PCA&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;200&lt;/strong&gt; = moderate reduction&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;100&lt;/strong&gt; = substantial reduction&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;50&lt;/strong&gt; = strong reduction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then compare validation performance.&lt;/p&gt;

&lt;p&gt;You could also select the PCA dimension based on &lt;strong&gt;explained variance&lt;/strong&gt;, which is arguably more principled.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PCA → retain 90% variance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PCA → retain 95% variance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is actually preferable academically because you are not saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I randomly decided to use 50 dimensions."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Instead:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The number of principal components was selected according to the amount of variance retained."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However, because your dissertation has a practical time constraint, I would &lt;strong&gt;first run 384/200/100/50&lt;/strong&gt; and inspect the results. We don't need to over-engineer this.&lt;/p&gt;




&lt;h1&gt;
  
  
  7. The important leakage issue
&lt;/h1&gt;

&lt;p&gt;This is very important when you rebuild it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PCA must be fitted only on the training data.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Train + Validation + Test
        ↓
      PCA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That would leak information.&lt;/p&gt;

&lt;p&gt;Instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Inner training embeddings
        │
        ▼
    FIT PCA
        │
        ├──────────────► transform training
        │
        └──────────────► transform validation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, after selecting the configuration, the final model is evaluated on the untouched test set.&lt;/p&gt;

&lt;p&gt;So:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TRAIN
 ↓
fit Sentence-BERT? → no training required if using pre-trained frozen SBERT
fit PCA
fit ML model
 ↓
VALIDATION
 ↓
select PCA + model
 ↓
FREEZE
 ↓
TEST
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the clean experimental protocol.&lt;/p&gt;




&lt;h1&gt;
  
  
  8. Why keep the 553 / 139 / 174 split?
&lt;/h1&gt;

&lt;p&gt;I would keep it.&lt;/p&gt;

&lt;p&gt;It is actually one of the stronger parts of the previous notebook.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;866 total
│
├── 692 development = 80%
│   │
│   ├── 553 inner training
│   └── 139 validation
│
└── 174 final test = 20%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The roles are:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Data&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;553&lt;/td&gt;
&lt;td&gt;Train models&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;139&lt;/td&gt;
&lt;td&gt;Select model/PCA configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;174&lt;/td&gt;
&lt;td&gt;Final unbiased evaluation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You should &lt;strong&gt;not use the 174 test rows to decide whether PCA=50 or PCA=384 is better&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  9. Then compare structured vs hybrid
&lt;/h1&gt;

&lt;p&gt;This is where your dissertation becomes much stronger.&lt;/p&gt;

&lt;p&gt;Don't only report:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Our hybrid model achieved X."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Instead ask:&lt;/p&gt;

&lt;h3&gt;
  
  
  Baseline model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Structured features
        ↓
Random Forest / XGBoost / etc.
        ↓
PCF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Hybrid model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Structured features
        +
Sentence-BERT text representation
        ↓
Feature fusion
        ↓
Same ML model
        ↓
PCF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             Baseline       Hybrid
RMSE            X             Y
MAE             X             Y
R²              X             Y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can answer the real research question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Does incorporating semantic information from textual PCF metadata improve PCF prediction compared with structured features alone?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is much more academically meaningful than simply testing 25 combinations.&lt;/p&gt;




&lt;h1&gt;
  
  
  10. And the "best ML model" issue
&lt;/h1&gt;

&lt;p&gt;I recommend we handle this in a controlled way.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 STRUCTURED
                     │
          ┌──────────┼──────────┐
          ▼          ▼          ▼
        Ridge       RF       XGBoost
          │          │          │
          └──────────┼──────────┘
                     ▼
              Best baseline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             HYBRID FEATURES
                    │
          ┌─────────┼─────────┐
          ▼         ▼         ▼
        Ridge      RF      XGBoost
          │         │         │
          └─────────┼─────────┘
                    ▼
              Best hybrid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can retain LightGBM and CatBoost if those are already part of your project methodology, but &lt;strong&gt;don't let the number of models obscure the central experiment&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  11. So the complete experiment becomes
&lt;/h1&gt;

&lt;p&gt;I would freeze this as your new ML workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;STEP 1
Carbon Catalogue
       │
       ▼
Fixed 80/20 split
       │
       ├─────────────────────┐
       │                     │
       ▼                     ▼
Structured branch       Text branch
       │                     │
       │              Sentence-BERT
       │                     │
       │                  384-D
       │                     │
       │                Optional PCA
       │                     │
       └──────────┬──────────┘
                  ▼
            Feature Fusion
                  │
                  ▼
          Hybrid Feature Set
                  │
                  ▼
            ML Regression
                  │
                  ▼
             Validation
                  │
                  ▼
          Select best setup
                  │
                  ▼
                Freeze
                  │
                  ▼
          Final 20% test
                  │
                  ▼
          Final performance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  12. My recommendation about PCA
&lt;/h2&gt;

&lt;p&gt;I &lt;strong&gt;would not decide now that 384 is too high&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let the experiment answer that.&lt;/p&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hybrid-384
Hybrid-PCA-200
Hybrid-PCA-100
Hybrid-PCA-50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and compare validation performance.&lt;/p&gt;

&lt;p&gt;If 384 performs best:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Keep 384.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If 100 performs similarly or better:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use 100 and explain that dimensionality reduction achieved comparable/better predictive performance with a lower-dimensional representation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If 50 performs best:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use 50.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So PCA becomes an &lt;strong&gt;empirical dimensionality-reduction experiment&lt;/strong&gt;, rather than an assumption.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. One thing I would change from the previous notebook
&lt;/h2&gt;

&lt;p&gt;I would make the notebook extremely explicit with four sections:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;01. DATA SPLIT
02. STRUCTURED FEATURES
03. SENTENCE-BERT TEXT EMBEDDINGS
04. HYBRID FEATURE FUSION
05. PCA EXPERIMENT
06. MODEL COMPARISON
07. MODEL SELECTION
08. FINAL TEST
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then anybody opening the notebook can understand exactly what is happening.&lt;/p&gt;

&lt;h3&gt;
  
  
  The core idea in one sentence
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Sentence-BERT converts textual PCF metadata into a 384-dimensional semantic representation; PCA is optionally used to reduce this representation; the resulting text features are concatenated with structured PCF features to form a hybrid feature set, which is then used by a regression model to predict PCF.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the model I recommend you build from the beginning.&lt;/p&gt;

&lt;p&gt;And &lt;strong&gt;yes, we can restart the notebook from Step 1 and build it cleanly rather than trying to repair the current complicated version.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>datascience</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
