1

I am predicting the IPL match win probability. While deploying the model using streamlit it show this error:

AttributeError:  'ColumnTransformer' object has no attribute '_name_to_fitted_passthrough'

That's my code:

from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder

trf = ColumnTransformer([('trf',OneHotEncoder(sparse=False,drop='first'), 
['batting_team','bowling_team','city'])],remainder='passthrough')

pipeline code

pipe = Pipeline(steps=[
('step1',trf),
('step2',LogisticRegression(solver='liblinear'))])
Alessandro Togni
  • 680
  • 1
  • 9
  • 24

2 Answers2

1

See the version of your sklearn in the environment while building and saving the model using

print(sklearn.__version__)

do the same in the environment where you are loading the model using the same.

probably they aren't the same. Hope this helps!

Aryan
  • 21
  • 2
0

Run your whole code/each cell again and then again run streamlit run file.py.

starball
  • 20,030
  • 7
  • 43
  • 238