Spaces:
Sleeping
Sleeping
File size: 932 Bytes
6b7b77f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | """
One-time training script.
Run: python scripts/train.py
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from db.supabase_client import fetch_user_profiles
from ml.roommate_model import RoommateMatchingModel
def main():
print("π Starting model training...")
profiles = fetch_user_profiles()
if not profiles:
print("β No user profiles found. Check your Supabase credentials.")
return
print(f"π Found {len(profiles)} user profiles")
model = RoommateMatchingModel()
model.train(profiles)
os.makedirs("models", exist_ok=True)
model.save("models/")
print("β
Training complete! Models saved to models/")
print(" β models/gb_model.pkl")
print(" β models/kmeans.pkl")
print(" β models/scaler.pkl")
print("\nβΆ Now run: uvicorn main:app --reload")
if __name__ == "__main__":
main()
|