You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good catch... I looked into it and this is happening because the way predict is implemented right now is a bit silly and only works for distributions that have a loc parameter.
The way to fix this, imo, is to define a predict method for all distributions that returns the conditional mean (i.e. the loc parameter for those we've implemented) for continuous distributions and the conditional mode (i.e. the most likely class) for discrete distributions. We can probably even use the underlying scipy distributions for this. I'll do that sometime soon.
In the meantime, you can easily get the predicted class by doing ngb.pred_dist(X_test).prob > 0.5.
Running your code from https://github.com/stanfordmlgroup/ngboost/blob/master/examples/classification.py
I received the following error when I try
ngb.predict(X_test)
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in ()
----> 1 ngb.predict(X_test)
/usr/local/lib/python3.6/dist-packages/ngboost/ngboost.py in predict(self, X)
133 def predict(self, X):
134 dist = self.pred_dist(X)
--> 135 return list(dist.loc.flatten())
136
137 def score(self, X, Y):
AttributeError: 'NoneType' object has no attribute 'flatten'
----------------------------------------------------------------`
ngb.pred_dist(X_test)
works properly but the above error is also obtained when using the sklearn function with cross validation, "cross_validate()".Regards,
The text was updated successfully, but these errors were encountered: