pybrain integration

67 views
Skip to first unread message

Mike Axiak

unread,
Mar 17, 2012, 3:27:52 PM3/17/12
to milk users
Hi everyone,

I'm evaluating different algorithms for a classification problem I
have and I'd like to test the neural network facilities included in
pybrain. Milk contains a lot of really nifty features (built-in cross
validation, customizable multi strategies, feature selections, etc) so
I'm trying to whip up a quick wrapper for a simple pybrain neural
network to use in milk.

I've posted my first quick attempt here: https://gist.github.com/2064499

My question is, what is the interpretation of the return value of the
model's apply()? If I am understanding the code correctly, a model is
the trained result but I'm having trouble reconciling the multiple
label result. Do I create a separate neural network model for each
distinct label? If so, where would I place that code?

Thanks,
Mike

Mike Axiak

unread,
Mar 17, 2012, 3:27:52 PM3/17/12
to milk users

Luis Pedro Coelho

unread,
Mar 19, 2012, 7:12:49 AM3/19/12
to milk-...@googlegroups.com
Hi,

Thanks for your effort, maybe we can merge it into milk when it's done. Would
you be OK with that (ie., licensing it under MIT license)?

> My question is, what is the interpretation of the return value of the
> model's apply()? If I am understanding the code correctly, a model is
> the trained result but I'm having trouble reconciling the multiple
> label result. Do I create a separate neural network model for each
> distinct label? If so, where would I place that code?

Well, it really depends on what your model is doing.

If your NN is binary, then it should return a boolean, but if it's inherently
multi-label, then it should return the label (as 0..(N-1)).

If I am reading pybrains docs correctly, your apply would look something like:


class nn_model(...):
...
def apply(self, q):
v = self.nn.activate(q)
return np.argmax(v)

HTH,
--
Luis Pedro Coelho | Institute for Molecular Medicine | http://luispedro.org

Reply all
Reply to author
Forward
0 new messages