Post 5 Companion · Core Algorithms

📐 Linear Regression Explorer

Fit a band gap model live · explore the math · visualise gradient descent

📋 Dataset — Binary Semiconductors (DFT-PBE Band Gaps)
#Compounda (Å)ΔENVal. e⁻Eg DFT (eV)Êg Pred. (eV)|Error|
⚙️ Feature Selection
🔒 Regularisation
📈 Model Performance
MAE (eV)
RMSE (eV)
🧮 Fitted Equation
Select features and fit the model
🔮 Predict a New Material
Predicted Band Gap
eV
🔄 Gradient Descent — Watch the Model Learn

The algorithm starts with all weights = 0 and iteratively adjusts them to minimise the MSE cost. Watch the loss decrease toward the optimal solution.

⚙️ Hyperparameters
📊 Current Weights
θ₀ (bias)
0.000
θ₁ (a)
0.000
θ₂ (ΔEN)
0.000
MSE Cost J(θ)
📉 Loss Curve — MSE vs. Iteration
▶ Press "Run GD" to start gradient descent...
🎯 Parity Plot — DFT vs. Predicted Band Gap

A perfect model places all points on the diagonal y = x line. Points above the line = underpredicted. Points below = overpredicted.

II-VI oxides / wide gap
III-V nitrides
III-V standard
IV-IV / elemental

Fit the model in the Model tab first.

🔬 Feature Importance — Coefficient Magnitudes

After standardising features (mean=0, std=1), the coefficient magnitudes tell us which features the model relies on most.

📊 Band Gap vs. Lattice Constant — Regression Line
📊 Band Gap vs. ΔEN — Regression Line
🔢 Feature Correlation Matrix

Cell values show Pearson correlation (−1 to +1). High correlation between features (multicollinearity) can destabilise linear regression coefficients.

📝 Quiz — Test Your Understanding
Progress0 / 5