[Python] Streamlit App Always Predicts the Same Result

Discussão em 'Python' iniciado por Stack, Julho 13, 2025.

  1. Stack

    Stack Membro Participativo

    I’ve built a machine learning project to predict student employability:

    • Trained and evaluated multiple ML models (SVM, Decision Tree, Logistic Regression, KNN) using Python.
    • Choose the best-performing model (SVM) based on F1-score after applying SMOTE to balance the dataset.
    • Saved the trained model and scaler using joblib.
    • Deployed the model using a Streamlit app where users can play around with predict the employability.

    When I run predictions in the Streamlit app:

    All predictions are always the same (Less Employable) — even if I adjust the input sliders to extreme values.

    The predicted probabilities also don’t change much.

    What I’ve Checked


    • In the notebook: model evaluation works fine. The SVM produces correct predictions & probabilities.


    • .pkl files (model & scaler) are generated and loaded correctly.


    • The input features in Streamlit are named and ordered the same way as during training.


    • I scale the input using the same scaler.

    I’ve uploaded all my code and data to this GitHub repo.

    It contains:


    • Training notebook (Train_Employability_Model_Final.ipynb)


    • Streamlit app (student_employability_app_final.py)


    • Dataset (Student_Employability_CP2_2025.xlsx)


    • Trained model & scaler (employability_predictor.pkl, scaler.pkl)


    • requirements.txt

    Could someone help me review:


    • My training notebook: to confirm that the .pkl files are correct.


    • My app.py Streamlit code: to check if the way I prepare and scale the input before prediction is correct.

    Continue reading...

Compartilhe esta Página