CoolFace
Apppublic

walgar/ckd

sourceHugging Faceupdated 1y agoView on Hugging Face
1likes
resave_model.py22 linesDownload Raw Back to root
1# resave_model.py2import joblib3import sklearn4from sklearn.ensemble import RandomForestClassifier5 6print(f"Using scikit-learn version: {sklearn.__version__}")7 8# Load the old model (should still work if same scikit-learn used)9old_model_path = "random_forest_model.pkl"10new_model_path = "random_forest_model_compatible.pkl"11 12try:13    print(f"Loading old model from: {old_model_path}")14    model = joblib.load(old_model_path)15 16    print(f"Saving new compatible model to: {new_model_path}")17    joblib.dump(model, new_model_path)18 19    print("✅ Model re-saved successfully!")20except Exception as e:21    print(f"❌ Error occurred: {e}")22