try:
predictions = self.model.predict_proba(X)
if X.shape[0] == 1:
return predictions[0]
else:
return predictions
except AttributeError as e:
// print("This model has no predict_proba method. Returning results of .predict instead.")
raw_predictions = self.model.predict(X)
tupled_predictions = []
After Change
try:
predictions = self.model.predict(X)
except TypeError as e:
if scipy.sparse.issparse(X):
X = X.todense()
predictions = self.model.predict(X)
except TypeError as e:
if scipy.sparse.issparse(X):