Views
No views yet
scikit-learn Ridge inside a Pipeline) that predicts
engagement_score for brand-creator campaign content, part of the Viralst
application.engagement_score
((likes + comments + shares) / views).POST /engagement/predict endpoint of the Viralst
ai/ service.training/generate_poc_data.py. Feature-to-target relationships were
deliberately encoded (with variable noise per row) so the training pipeline
— feature engineering, model selection, evaluation, and serving — could be
validated end-to-end ahead of onboarding real campaign data. Results below
characterize how well the model recovers the encoded synthetic relationships,
not real-world campaign performance.sklearn.linear_model.Ridge inside a Pipeline (OneHotEncoder
for single-value categorical features, StandardScaler for numeric and
multi-hot features).GroupKFold (grouped by brief_id),
so evaluation reflects generalization to unseen briefs rather than
leaking the same brief across train/test folds.skops.io.dump (not raw pickle) for safer loading.{
"alpha": 10.0,
"n_rows": 2000,
"n_groups": 300,
"cv_mae": 0.011419824566734465,
"cv_rmse": 0.01458130687031906,
"cv_r2": 0.7102257580449983,
"baseline_mae": 0.021489796999999998,
"baseline_rmse": 0.027087352583401354
}0.027087352583401354. The final model outperforms
this baseline by a wide margin on the synthetic dataset described above.config.json in this repo for the full list and order of feature
columns the model expects. The canonical definition lives in
src/engagement_predictor/features.py in the application repository
(https://github.com/dataset/ (brands.csv, briefs.csv, contents.csv — 30
brands, 300 briefs, 2000 content rows). It was generated by
training/generate_poc_data.py; see "Training data and methodology" above
for why it is synthetic and what it does and does not represent.1import pandas as pd
2import skops.io as sio
3from huggingface_hub import hf_hub_download
4
5path = hf_hub_download(repo_id="raviearjun/engagement-predictor", filename="engagement_ridge.skops")
6untrusted = sio.get_untrusted_types(file=path)
7model = sio.load(path, trusted=untrusted)
8
9# X must be a DataFrame with columns matching config.json -> feature_columns
10prediction = model.predict(X)requirements.txt in this repo for exact pins):scikit-learn==1.7.2
skops==0.14.0
numpy==1.26.4
pandas==2.3.3