luispedro / milk

MILK: Machine Learning Toolkit
http://www.luispedro.org/software/milk
MIT License
605 stars 146 forks source link

ValueError: too many boolean indices #6

Closed audy closed 12 years ago

audy commented 12 years ago

I'm getting this error:

try_milk/1.9.3 $ python bug.py 
Traceback (most recent call last):
  File "bug.py", line 14, in <module>
    learner.train(features, labels)
  File "/Users/b/.pythonbrew/pythons/Python-2.7/lib/python2.7/site-packages/milk/supervised/multi.py", line 120, in train
    model = self.base.train(features[idxs], (labels[idxs]==i).astype(int), **child_kwargs)
  File "/Users/b/.pythonbrew/pythons/Python-2.7/lib/python2.7/site-packages/milk/supervised/adaboost.py", line 86, in train
    H,A = _adaboost(features, labels, self.base, self.max_iters)
  File "/Users/b/.pythonbrew/pythons/Python-2.7/lib/python2.7/site-packages/milk/supervised/adaboost.py", line 39, in _adaboost
    train_out = names[train_out]
ValueError: too many boolean indices

When I run this code from the examples:

#!/usr/bin/env python

import milk.supervised.randomforest
import milk.supervised.adaboost
import milksets.wine
from milk.supervised.multi import one_against_one

weak = milk.supervised.randomforest.rf_learner()
learner = milk.supervised.adaboost.boost_learner(weak)
learner = one_against_one(learner)

features, labels = milksets.wine.load()

learner.train(features, labels)

system information

try_milk/1.9.3 $ python --version
Python 2.7
try_milk/1.9.3 $ uname -a
Darwin username.local 12.0.0 Darwin Kernel Version 12.0.0: Sun Jun 24 23:00:16 PDT 2012; root:xnu-2050.7.9~1/RELEASE_X86_64 x86_64

Virtualenv:

try_milk/1.9.3 $ yolk -l
Pygments        - 1.5          - active 
Python          - 2.7          - active development (/Users/b/.pythonbrew/pythons/Python-2.7/lib/python2.7/lib-dynload)
bpython         - 0.11         - active 
distribute      - 0.6.26       - active 
ipython         - 0.12.1       - active 
irckit          - 0.1.1        - active 
milk            - 0.4.2        - active 
milksets        - 0.1.3        - active 
numpy           - 1.6.2        - active 
pandas          - 0.8.1        - active 
pip             - 1.1          - active 
python-dateutil - 1.5          - active 
pytz            - 2012c        - active 
setuptools      - 0.6c11       - active 
virtualenv-clone - 0.2.4        - active 
virtualenv      - 1.7.2        - active 
virtualenvwrapper - 3.5          - active 
wsgiref         - 0.1.2        - active development (/Users/b/.pythonbrew/pythons/Python-2.7/lib/python2.7)
yolk            - 0.4.3        - active
luispedro commented 12 years ago

Just fixed it.

Thanks for the excelent bug report. I am sorry it took so long, but I only got back home yesterday.

audy commented 12 years ago

Awesome, Thanks!