<div dir="ltr"><div dir="ltr">Hi all,<div><br></div><div>I was hoping to get some guidance re: changing the result of the predict method of the OneVsRestClassifier to return a dense array rather than a sparse array, given that Google Cloud ML only accepts dense numpy arrays as a result of a given models predict method. Right now my model architecture looks like:</div><div><br></div><div>model = Pipeline([('tfidf', TfidfVectorizer()), ('clf', OneVsRestClassifier(XGBClassifier()))])</div><div><br></div><div>Which returns a sparse array with the predict method. I saw the Stack Overflow post here: <a href="https://stackoverflow.com/questions/52151548/google-cloud-ml-engine-scikit-learn-prediction-probability-predict-proba">https://stackoverflow.com/questions/52151548/google-cloud-ml-engine-scikit-learn-prediction-probability-predict-proba</a></div><div><br></div><div>which recommends overwriting the predict method with the predict_proba method, however I found that I can't serialize the model after doing so. I also have a stack overflow post here: <a href="https://stackoverflow.com/questions/55366454/how-to-convert-scikit-learn-onevsrestclassifier-predict-method-output-to-dense-a">https://stackoverflow.com/questions/55366454/how-to-convert-scikit-learn-onevsrestclassifier-predict-method-output-to-dense-a</a> which details the specific pickling error.</div><div><br></div><div>Is this a known issue? Is there an accepted way to convert this into a dense array?</div><div><br></div><div>Thanks,</div><div>Liam Geron</div></div></div>