Fix this problem "The feature names should match those that were passed during fit."
In line [37] I got this error:
ValueError: The feature names should match those that were passed during fit.
Feature names unseen at fit time:
- Price_Range
- Promotion
Feature names seen at fit time, yet now missing:
- Mean_Price
- Mean_Promotion
Hi Le,
thanks for reaching out! Could you send a screenshot of your notebook with the cell in question, which causes the error?
Thanks in advance!
Best,
365 Eli
change columns names:
- Price_Range
- Promotion
and
- Mean_Price
- Mean_Promotion
to the same ones, ie eg Price, Promotion for both data frames
ValueError
Cell In[99], line 1
----> 1 Y_promotion = model_incidence_promotion.predict_proba(df_price_elasticity_promotion)
...
- Promotion
Feature names seen at fit time, yet now missing:
- Mean_Price
- Mean_Promotion
Run the model_incidence_promotion.fit(X, Y) again before going on to using it as a feature in the predict_proba. That way it will contain the newly defined characteristics
the score function is not giving value even lineaRegression is not providing value just shows this function
I found that rather than using columns named Price Point and Promotion, we should use the exactly the same columns name for prediction.
so for df_price_elasticity_promotion, the columns should be ['Mean_Price', 'Mean_Promotion'].
Dunno why it can be run without problem in the video.