Downloads · 30 days
0
PatZhang0214/business-risk-xgboost
business-risk-xgboost is a machine learning model from PatZhang0214. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for xgboost. The card lists the license as mit.
XGBoost binary classifier predicting business closure risk using Yelp business data and FRED economic indicators from 2018.
Downloads · 30 days
0
Access
Public
Updated Jan 13, 2026
Repo size
829 KB
Likes
0
Public
Click a slice to open those files.
.pkl829 KB · 99%
From the Hugging Face model README
XGBoost binary classifier predicting business closure risk using Yelp business data and FRED economic indicators from 2018.
Task: Binary classification (open vs. closed)
Algorithm: XGBoost Classifier
Training Data: 16,000 businesses with 2018 economic data
Features: 61 total (Yelp engagement metrics, county economic indicators, business categories)
Yelp Engagement (6):
rating_x_reviews, review_count, num_categories, years_in_business, num_checkins, has_checkinEconomic Indicators (5):
pcpi, poverty_rate, median_household_income, unemployment_rate, avg_weekly_wagesGeographic (2):
latitude, longitudeBusiness Categories (50):
import joblib
import pandas as pd
from huggingface_hub import hf_hub_download
# Download artifacts
model_path = hf_hub_download(repo_id="yourusername/business-risk-xgboost", filename="xgboost_model.pkl")
scaler_path = hf_hub_download(repo_id="yourusername/business-risk-xgboost", filename="scaler.pkl")
config_path = hf_hub_download(repo_id="yourusername/business-risk-xgboost", filename="model_config.json")
# Load
model = joblib.load(model_path)
scaler = joblib.load(scaler_path)
# Prepare input (must match training features exactly)
input_data = pd.DataFrame([{
'rating_x_reviews': 450.0,
'review_count': 100,
'num_categories': 3,
'years_in_business': 5,
'num_checkins': 250,
'has_checkin': 1,
'pcpi': 55000,
'poverty_rate': 10.5,
'median_household_income': 65000,
'unemployment_rate': 4.2,
'avg_weekly_wages': 1100,
'latitude': 33.4484,
'longitude': -112.0740,
'cat_Restaurants': 1,
'cat_Food': 0,
# ... (include all 48 category features)
}])
# Predict
X_scaled = scaler.transform(input_data)
prob = model.predict_proba(X_scaled)[0, 1] # Probability of staying open
print(f"Risk Score: {prob:.3f}")
print(f"Prediction: {'Open' if prob > 0.5 else 'Closed'}")
model_config.jsonscale_pos_weight parameterrating_x_reviews), one-hot encoding for categoriesPortfolio project demonstrating end-to-end ML pipeline with economic data integration. Not for production financial decisions.
xgboost_model.pkl - Trained XGBoost modelscaler.pkl - StandardScaler for feature preprocessingmodel_config.json - Feature names, hyperparameters, metricsfeatures.txt - List of all 61 features in orderGitHub: [https://github.com/PatZhang0214/business-risk-prediction]