Skip to content

🟡 [Enhancement] Add Gradient Boosting model alongside Random Forest for ensemble prediction #11

Description

@AkshatRaj00

Feature Request

Summary

train_models.py already has GradientBoosting code but predict.py only uses Random Forest. Adding an ensemble of both models would improve accuracy by 10-15%.

Current State

  • Only rf_model.pkl is used for predictions
  • train_models.py trains both RF and GB but GB is unused

Proposed Implementation

In predict.py:

# Load both models
rf_model = joblib.load('rf_model.pkl')
gb_model = joblib.load('gb_model.pkl')  # Add this

def predict_ensemble(data_dict: dict):
    """Average predictions from RF + GB for better accuracy."""
    X = _build_features(data_dict)
    
    rf_pred = float(rf_model.predict(X)[0])
    gb_pred = float(gb_model.predict(X)[0])
    
    # Weighted average (RF slightly better for variance)
    ensemble = round(0.55 * rf_pred + 0.45 * gb_pred, 1)
    return ensemble

In app.py:

model_choice = st.radio("Model", ["Random Forest", "Gradient Boosting", "Ensemble (Best)"])

Expected Improvement

  • MAE reduction: ~8-12 days
  • More stable predictions for edge cases
  • User can compare models

enhancement ml accuracy gradient-boosting

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions