Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnpicklingError: NEWOBJ class argument isn't a type object #1

Open
jacobsmith575161 opened this issue Jul 11, 2020 · 1 comment
Open

Comments

@jacobsmith575161
Copy link

No description provided.

@jacobsmith575161 jacobsmith575161 changed the title Hi Data Professor, Hi Data Professor Jul 11, 2020
@jacobsmith575161 jacobsmith575161 changed the title Hi Data Professor UnpicklingError: NEWOBJ class argument isn't a type object Jul 11, 2020
@jacobsmith575161
Copy link
Author

jacobsmith575161 commented Jul 11, 2020

Hi Data Professor,
I followed the instruction in the video tutorial, all went well until i load the model in the streamlit app. I get:

UnpicklingError: NEWOBJ class argument isn't a type object
Traceback:
File "c:\users\user-pc\appdata\local\programs\python\python37\lib\site-packages\streamlit\ScriptRunner.py", line 322, in _run_script
exec(code, module.dict)
File "C:\Users\user-pc\Desktop\ML Projects\Expresso_app.py", line 88, in
load_clf = pickle.load(open('expresso_churn_model.pkl', 'rb'))

Here's my code:

import streamlit as st
import pandas as pd
import pickle
import numpy as np
from xgboost import XGBClassifier

from PIL import Image
img = Image.open("logo2.jpg")
st.image(img)

st.sidebar.header('User Input features')

def user_input_features():
# REGION = st.sidebar.selectbox('REGION', ('DAKAR','DIOURBEL','FATICK','KAFFRINE','KAOLACK','KEDOUGOU','KOLDA','LOUGA','MATAM','SAINT-LOUIS','SEDHIOU','TAMBACOUNDA','THIES','ZIGUINCHOR'))
# TENURE = st.sidebar.selectbox('TENURE',('D 3-6 month',' E 6-9 month','F 9-12 month','G 12-15 month','H 15-18 month','I 18-21 month','J 21-24 month','K > 24 month'))
MONTANT = st.sidebar.slider('MONTANT', 2.0, 4.4, 3.4)
FREQUENCE_RECH = st.sidebar.slider('FREQUENCE_RECH', 0.1, 2.5, 0.2)
REVENUE = st.sidebar.slider('REVENUE', 0.1, 2.5, 0.2)
ARPU_SEGMENT = st.sidebar.slider('ARPU_SEGMENT', 0.1, 2.5, 0.2)
FREQUENCE = st.sidebar.slider('FREQUENCE', 0.1, 2.5, 0.2)
DATA_VOLUME = st.sidebar.slider('DATA_VOLUME', 0.1, 2.5, 0.2)
ON_NET = st.sidebar.slider('ON_NET', 0.1, 2.5, 0.2)
ORANGE = st.sidebar.slider('ORANGE', 0.1, 2.5, 0.2)
TIGO = st.sidebar.slider('TIGO', 0.1, 2.5, 0.2)
ZONE1 = st.sidebar.slider('ZONE1', 0.1, 2.5, 0.2)
ZONE2 = st.sidebar.slider('ZONE2', 0.1, 2.5, 0.2)
REGULARITY = st.sidebar.slider('REGULARITY', 0.1, 2.5, 0.2)
FREQ_TOP_PACK = st.sidebar.slider('FREQ_TOP_PACK', 0.1, 2.5, 0.2)
data = {
#'REGION': REGION,
#'TENURE': TENURE,
'MONTANT': MONTANT,
'FREQUENCE_RECH': FREQUENCE_RECH,
'REVENUE': REVENUE,
'ARPU_SEGMENT': ARPU_SEGMENT,
'FREQUENCE': FREQUENCE,
'DATA_VOLUME': DATA_VOLUME,
'ON_NET': ON_NET,
'ORANGE': ORANGE,
'TIGO': TIGO,
'ZONE1': ZONE1,
'ZONE2': ZONE2,
'REGULARITY': REGULARITY,
'FREQ_TOP_PACK': FREQ_TOP_PACK
}
features = pd.DataFrame(data, index=[0])
return features

df = user_input_features()

#The Code below is what gives me the error
load_clf = pickle.load(open('expresso_churn_model.pkl', 'rb'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant