Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroDivisionError: division by zero #15

Closed
pbebbo opened this issue Apr 17, 2018 · 4 comments
Closed

ZeroDivisionError: division by zero #15

pbebbo opened this issue Apr 17, 2018 · 4 comments

Comments

@pbebbo
Copy link

pbebbo commented Apr 17, 2018


ZeroDivisionError Traceback (most recent call last)
in ()
1 br = BoostARoota(metric='logloss',delta=0.05)
----> 2 br.fit(all_feats,target_data);

~/anaconda2/envs/py3k/lib/python3.6/site-packages/boostaroota/boostaroota.py in fit(self, x, y)
51 max_rounds=self.max_rounds,
52 delta=self.delta,
---> 53 silent=self.silent)
54 return self
55

~/anaconda2/envs/py3k/lib/python3.6/site-packages/boostaroota/boostaroota.py in _BoostARoota(x, y, metric, clf, cutoff, iters, max_rounds, delta, silent)
224 n_iterations=iters,
225 delta=delta,
--> 226 silent=silent)
227 else:
228 crit, keep_vars = _reduce_vars_sklearn(new_x,

~/anaconda2/envs/py3k/lib/python3.6/site-packages/boostaroota/boostaroota.py in _reduce_vars_xgb(x, y, metric, this_round, cutoff, n_iterations, delta, silent)
139 #Check for the stopping criteria
140 #Basically looking to make sure we are removing at least 10% of the variables, or we should stop
--> 141 if (len(real_vars['feature']) / len(x.columns)) > (1-delta):
142 criteria = True
143 else:

ZeroDivisionError: division by zero

@chasedehan
Copy link
Owner

Please see this issue:
#9

Looks like you need to limit the number of rounds that the model goes through or adjust criteria to cut out less. Basically, it is removing every feature.

I'm going to close this, please open another issue if it persists or reach out to me directly.

@pbebbo
Copy link
Author

pbebbo commented Apr 17, 2018 via email

@chasedehan
Copy link
Owner

Ahh, in your code you passed in 'logloss' as the metric. If you have a multiclass target, the only metric that will be accepted is 'mlogloss'.

@pbebbo
Copy link
Author

pbebbo commented Apr 17, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants