Downloads · 30 days
8
17% of all-time downloads
B4S/california-housing-predictor
california-housing-predictor is a machine learning model from B4S. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
使用 scikit-learn 在 California Housing 数据集上训练随机森林回归模型,并通过 GitHub Actions 在推送到 main 时自动训练并上传到 Hugging Face Hub。
Downloads · 30 days
8
17% of all-time downloads
All-time downloads
46
Public
Repo size
12.3 MB
Likes
0
Public
Click a slice to open those files.
.joblib12.3 MB · 100%
From the Hugging Face model README
使用 scikit-learn 在 California Housing 数据集上训练随机森林回归模型,并通过 GitHub Actions 在推送到 main 时自动训练并上传到 Hugging Face Hub。
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python train.py
训练后会生成:model.joblib、metrics.json、config.json。
california-housing-predictor)。你的HF用户名/仓库名(例如 EmporioSabo/california-housing-predictor)。HF_TOKEN:上一步的 Hugging Face token。HF_REPO:上一步的 Hub 完整路径(同上例)。在本项目目录执行(将 YOUR_USER/REPO 换成你的 GitHub 仓库):
cd california-housing-predictor
git init -b main
git add train.py requirements.txt .gitignore README.md .github/workflows/train-and-upload.yml
git commit -m "Add California housing model and HF upload workflow"
git remote add origin https://github.com/YOUR_USER/REPO.git
git push -u origin main
推送后可在 Actions 查看 Train and Upload to Hugging Face 是否成功;也可在 Actions 里手动 Run workflow 重跑。
main 分支可见:model.joblib、metrics.json、config.json、README.md。将 GitHub 仓库 URL 与 Hugging Face 仓库 URL 发到课程微信群。