CWV-Predict: Core Web Vitals Prediction from Page Features

Type: Academic | Domain: SEO, Web Performance
Hugging Face: syeedalireza/cwv-predict

Predict LCP, INP/FID, and CLS from page and server features before deployment (pre-deployment CWV estimation).

Author

Alireza Aminzadeh

Problem

Core Web Vitals (CWV) affect rankings and UX. Estimating CWV before deployment helps prioritize fixes and avoid regressions.

Approach

  • Features: Resource counts, DOM size, script size, server response time, image dimensions, etc.
  • Targets: LCP (ms), INP/FID (ms), CLS (score).
  • Models: Gradient boosting (XGBoost/LightGBM) for tabular features; optional lightweight embeddings for URL/path.

Tech Stack

Category Tools
ML scikit-learn, XGBoost, LightGBM
Data pandas, NumPy
Evaluation sklearn metrics, optional MLflow

Setup

python -m venv .venv
.venv\Scripts\activate   # Windows
pip install -r requirements.txt

Usage

# Train (expects data in data/ or env DATA_PATH)
python train.py

# Predict on new samples
python inference.py --input data/sample.csv --output predictions.csv

Project structure

01_cwv-predict/
β”œβ”€β”€ config.py          # Paths and column names
β”œβ”€β”€ train.py           # Train XGBoost regressors per CWV metric
β”œβ”€β”€ inference.py       # Batch prediction from CSV
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env.example
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ cwv_features.csv   # Sample training data (features + targets)
β”‚   └── sample.csv         # Sample input for inference (features only)
└── models/                # Saved models and metrics (after train)

Data

  • Sample data (included): data/cwv_features.csv (features + lcp_ms, inp_ms, cls_score), data/sample.csv (features only for inference).
  • Columns: dom_size, resource_count, script_bytes, image_count, server_ttfb_ms; targets: lcp_ms, inp_ms, cls_score.
  • Override paths via DATA_PATH in .env. See .env.example.

License

MIT.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using syeedalireza/cwv-predict 1