remove one_hot, first try

I tend to vote for allowing repeated indices. In that way it allows us to
deal with multi-label classification tasks whose training cases have
different number of tags. And that situation is very common in multi label
classification.

On Thursday, October 30, 2014, Pascal Lamblin <notifications@github.com>
wrote:

> In pylearn2/format/tests/test_target_format.py:
>
> > +def test_one_hot_formatter_merge_simple():
> > +    def check_one_hot_formatter(seed, max_labels, dtype, ncases, nmultis):
> > +        rng = numpy.random.RandomState(seed)
> > +        fmt = OneHotFormatter(max_labels=max_labels, dtype=dtype)
> > +        integer_labels = rng.random_integers(0, max_labels - 1,
> > +            size=ncases*nmultis).reshape(ncases, nmultis)
> > +        one_hot_labels = fmt.format(integer_labels, mode='merge')
> > +        assert len(zip(*one_hot_labels.nonzero())) == ncases * nmultis
> > +        for case, label in enumerate(integer_labels):
> > +            assert one_hot_labels[case, label] == 1
> > +    rng = numpy.random.RandomState(0)
> > +    for seed, dtype in enumerate(all_types):
> > +        yield (check_one_hot_formatter, seed, rng.random_integers(11, 30),
> > +               dtype, rng.random_integers(1, 100),
> > +               rng.random_integers(1, 10))
> > +
>
> I think all cases of the dataset must have the same number of classes, as
> y is a matrix.
> I have to check what we should do if some indices are repeated.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/lisa-lab/pylearn2/pull/1185/files#r19632211>.
>


-- 
LIN, Zhouhan
Department of Information Engineering
Harbin Institute of Technology

Phone: +86-151-2457-3193
Email: lin.zhouhan@gmail.com
Homepage:http://zhouhanlin.webs.com/