Commit fdb093d6 authored by extremin's avatar extremin Committed by Guolin Ke
Browse files

Update engine.py (#291)

When setting the parameter 'shuffle' of cv method to False ,the program raises the error below:
UnboundLocalError:local variable 'randidx' referenced before assignment

fixed.
parent 59c116fe
......@@ -236,6 +236,8 @@ def _make_n_folds(full_data, nfold, params, seed, fpreproc=None, stratified=Fals
full_data.construct()
if shuffle:
randidx = np.random.permutation(full_data.num_data())
else:
randidx = np.arange(full_data.num_data())
kstep = int(len(randidx) / nfold)
idset = [randidx[(i * kstep): min(len(randidx), (i + 1) * kstep)] for i in range_(nfold)]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment