Reputation: 1332
I use XGBoost Algortihm for text mining but in below code I keep getting an error.
from xgboost import XGBClassifier
from numpy import *
xgb=XGBClassifier()
xgb.fit(df['doc_vector'],df.cat1)
How can I fix this? Thank you.
Below types and print of the objects
Upvotes: 1
Views: 5810
Reputation: 1332
Actually I got the solution from ValueError: matrix must be 2-dimensional when passing two arrays to the function Thanks.
xgb=XGBClassifier()
xgb.fit(np.vstack(df['doc_vector']),df.cat1)
predictions = xgb.predict(np.vstack(val['doc_vector']))
Upvotes: 4