XGBoost is not working

Hi Everyone!

I am trying to create an app which uses XGBoost to classify users input.
App URL: manudb.streamlit.app
GitHub: GitHub - balintbiro/MANUDB: Database + GUI for mammalian NUMTs.
Streamlit version: 1.33.0
Python version: 3.11.2
Minimal reproducible code:

import xgboost
import numpy as np
import pandas as pd
import streamlit as st


X=pd.DataFrame(np.random.randint(0,100,size=(100,4)),columns=list('ABCD'))
y=np.random.choice([0,1],100)

clf=xgboost.XGBClassifier()
clf.fit(X,y)
clf.get_params()

Error msg:
ImportError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script
    exec(code, module.__dict__)File "/mount/src/manudb/codes/pages/2_Predict.py", line 10, in <module>
    clf=xgboost.XGBClassifier()
        ^^^^^^^^^^^^^^^^^^^^^^^File "/home/adminuser/venv/lib/python3.11/site-packages/xgboost/core.py", line 620, in inner_f
    feature_types,File "/home/adminuser/venv/lib/python3.11/site-packages/xgboost/sklearn.py", line 1396, in __init__
    config = json.loads(b.save_config())File "/home/adminuser/venv/lib/python3.11/site-packages/xgboost/sklearn.py", line 584, in __init__
    feature_weights: Optional[Any],
            ^^^^^^^^^^^^^^^^^^^^^^^

It is okay locally but the deployment is not working somehow…
You guys have any idea what is going on? Any suggestions would be appreciated.
Thanks In advance!

The directory structure was cleaned (no data or results dir) and the pages subdirectories was also removed and don’t know why but it seems working fine.

Hi @B_lint

Have you tried rebooting the app? Also, are you using a pickled version of the XGBoost model in the app or is the model trained in the app?

Hi @dataprofessor
Yep, I have tried to reboot the app several times. Yes, it is a pickled version of a trained XGB.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.