Skip to content

Commit 1f83120

Browse files
committed
Add Quick Reference: Loss Functions and Feature Engineering sections
- Added Section 16: Quick Reference: Loss Functions - Regression Losses (MSE, MAE, Huber) - Classification Losses (Binary Cross-Entropy, Categorical Cross-Entropy, Hinge) - Added Section 17: Feature Engineering - Normalization Techniques (Min-Max, Z-Score, Max Abs) - Polynomial Features (Degree 2 & 3) - Encoding Categorical Variables (One-Hot, Label) - Updated navigation with 2 new section buttons - Updated hero stats to show "17 Topics"
1 parent 12de50b commit 1f83120

1 file changed

Lines changed: 80 additions & 1 deletion

File tree

index.html

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
<h1>📊 Mathematics for Data Science & Machine Learning</h1>
136136
<p>A comprehensive, beautifully rendered reference for formulas and concepts.</p>
137137
<div class="hero-stats" aria-hidden="true">
138-
<div class="stat-box"><span class="stat-number">15</span><span class="stat-label">Topics</span></div>
138+
<div class="stat-box"><span class="stat-number">17</span><span class="stat-label">Topics</span></div>
139139
<div class="stat-box"><span class="stat-number">200+</span><span class="stat-label">Formulas</span></div>
140140
<div class="stat-box"><span class="stat-number"></span><span class="stat-label">Applications</span></div>
141141
</div>
@@ -159,6 +159,8 @@ <h1>📊 Mathematics for Data Science & Machine Learning</h1>
159159
<button class="nav-btn" onclick="scrollToSection('svm')">SVM</button>
160160
<button class="nav-btn" onclick="scrollToSection('decision-trees')">Decision Trees</button>
161161
<button class="nav-btn" onclick="scrollToSection('bias-variance')">Bias-Variance</button>
162+
<button class="nav-btn" onclick="scrollToSection('loss-functions')">Loss Functions</button>
163+
<button class="nav-btn" onclick="scrollToSection('feature-engineering')">Feature Eng.</button>
162164
</div>
163165
<div class="expand-collapse-all">
164166
<button class="expand-collapse-btn" onclick="expandAllSections()">📂 Expand All</button>
@@ -916,6 +918,83 @@ <h2 id="bv-title" class="section-title">Bias-Variance Tradeoff</h2>
916918
</div>
917919
</section>
918920

921+
<!-- 16. QUICK REFERENCE: LOSS FUNCTIONS -->
922+
<section id="loss-functions" class="section" aria-labelledby="loss-title">
923+
<div class="section-header" onclick="toggleSection(this)">
924+
<div class="section-number">16</div>
925+
<h2 id="loss-title" class="section-title">Quick Reference: Loss Functions</h2>
926+
<div class="section-toggle"></div>
927+
</div>
928+
<div class="section-content">
929+
<div class="subsection">
930+
<div class="subsection-title">📉 Regression Losses</div>
931+
<table class="formula-table">
932+
<tr><th>Loss</th><th>Formula</th><th>Use Case</th></tr>
933+
<tr><td>MSE</td><td>$$L=\frac{1}{n}\sum_{i=1}^n(y_i-\hat{y}_i)^2$$</td><td>Standard regression</td></tr>
934+
<tr><td>MAE</td><td>$$L=\frac{1}{n}\sum_{i=1}^n|y_i-\hat{y}_i|$$</td><td>Robust to outliers</td></tr>
935+
<tr><td>Huber</td><td>$$L=\begin{cases}\frac{1}{2}(y-\hat{y})^2&|y-\hat{y}|\leq\delta\\\delta|y-\hat{y}|-\frac{1}{2}\delta^2&\text{otherwise}\end{cases}$$</td><td>Combines MSE & MAE</td></tr>
936+
</table>
937+
</div>
938+
939+
<div class="subsection">
940+
<div class="subsection-title">🎯 Classification Losses</div>
941+
<table class="formula-table">
942+
<tr><th>Loss</th><th>Formula</th><th>Use Case</th></tr>
943+
<tr><td>Binary Cross-Entropy</td><td>$$L=-[y\log(\hat{y})+(1-y)\log(1-\hat{y})]$$</td><td>Binary classification</td></tr>
944+
<tr><td>Categorical Cross-Entropy</td><td>$$L=-\sum_i y_i\log(\hat{y}_i)$$</td><td>Multi-class classification</td></tr>
945+
<tr><td>Hinge Loss</td><td>$$L=\max(0,1-y\cdot\hat{y})$$</td><td>SVM classification</td></tr>
946+
</table>
947+
</div>
948+
</div>
949+
</section>
950+
951+
<!-- 17. FEATURE ENGINEERING -->
952+
<section id="feature-engineering" class="section" aria-labelledby="fe-title">
953+
<div class="section-header" onclick="toggleSection(this)">
954+
<div class="section-number">17</div>
955+
<h2 id="fe-title" class="section-title">Feature Engineering</h2>
956+
<div class="section-toggle"></div>
957+
</div>
958+
<div class="section-content">
959+
<div class="subsection">
960+
<div class="subsection-title">📊 Normalization Techniques</div>
961+
<table class="formula-table">
962+
<tr><th>Method</th><th>Formula</th><th>Range</th></tr>
963+
<tr><td>Min-Max Scaling</td><td>$$x'=\frac{x-\min}{\max-\min}$$</td><td>[0, 1]</td></tr>
964+
<tr><td>Z-Score Normalization</td><td>$$x'=\frac{x-\mu}{\sigma}$$</td><td>~ [-3, 3]</td></tr>
965+
<tr><td>Max Abs Scaling</td><td>$$x'=\frac{x}{|\max|}$$</td><td>[-1, 1]</td></tr>
966+
</table>
967+
</div>
968+
969+
<div class="subsection">
970+
<div class="subsection-title">🔢 Polynomial Features</div>
971+
<div class="formula-card">
972+
<div class="formula-name">Degree 2</div>
973+
<div class="formula">$$[x_1, x_2] \rightarrow [1, x_1, x_2, x_1^2, x_1 x_2, x_2^2]$$</div>
974+
</div>
975+
<div class="formula-card">
976+
<div class="formula-name">Degree 3</div>
977+
<div class="formula">$$[x_1, x_2] \rightarrow [1, x_1, x_2, x_1^2, x_1 x_2, x_2^2, x_1^3, x_1^2 x_2, x_1 x_2^2, x_2^3]$$</div>
978+
</div>
979+
<div class="info-box">
980+
<strong>💡 Tip:</strong> Polynomial features help capture non-linear relationships in data, but be careful of overfitting with high degrees.
981+
</div>
982+
</div>
983+
984+
<div class="subsection">
985+
<div class="subsection-title">🏷️ Encoding Categorical Variables</div>
986+
<div class="formula-card">
987+
<div class="formula-name">One-Hot Encoding</div>
988+
<div class="formula">$$\text{Category } c \rightarrow [0, 0, \ldots, 1, \ldots, 0] \text{ (1 at position } c\text{)}$$</div>
989+
</div>
990+
<div class="formula-card">
991+
<div class="formula-name">Label Encoding</div>
992+
<div class="formula">$$\text{Categories } \{A, B, C\} \rightarrow \{0, 1, 2\}$$</div>
993+
</div>
994+
</div>
995+
</div>
996+
</section>
997+
919998
<!-- CONTRIBUTOR SECTION -->
920999
<section id="contributor" class="section" style="text-align:center;">
9211000
<div class="section-header" onclick="toggleSection(this)">

0 commit comments

Comments
 (0)