milk.nfoldcrossvalidation.foldgenerator: nfolds was reduced to 1 because minimum class size was 1.

32 views
Skip to first unread message

Jud

unread,
May 5, 2012, 12:19:47 PM5/5/12
to milk users
I'm trying to get a simple webservice up which will allow me to post
image urls and classify them as matching a certain criteria or not. I
have a simple bottle.py server that accepts image urls to api
endpoints that determine the classification - something like:

/decisions/red/[positive, negative]

I would like for the model to be able to train and classify (even bad
classifications are okay) as people submit urls - but I am running
into this error, which I assume is happening because I am not training
on the entire dataset at once.

If that is the case, is there a way to train a model iteratively when
the entire dataset isn't available when the initial model is trained?

Here is a snippet of what my bottle.py setup looks like:

@post('/decisions/red/<decision>')
def decisions(decision='answer'):
# -- snipped --
# set answer to 0 for this snippet
answer = 0
tmpfile = tempfile.NamedTemporaryFile()

urllib.urlretrieve(request.forms.url, tmpfile.name)
img = mahotas.imread(tmpfile.name)
features = mahotas.features.haralick(img).mean(0)

learner.train([features], [answer])

Luis Pedro Coelho

unread,
May 5, 2012, 6:02:23 PM5/5/12
to milk-...@googlegroups.com
On Saturday, May 05, 2012 09:19:47 AM Jud wrote:
> I would like for the model to be able to train and classify (even bad
> classifications are okay) as people submit urls - but I am running
> into this error, which I assume is happening because I am not training
> on the entire dataset at once.

Yes, there are no methods in milk for online learning, currently. The code you
showed actually only trains with the current element.

I have always wanted to have online learning, but I never had an excuse to
implement it (i.e., it never showed up in my research work).

> If that is the case, is there a way to train a model iteratively when
> the entire dataset isn't available when the initial model is trained?

Sorry, not in milk.

Good luck
--
Luis Pedro Coelho | Institute for Molecular Medicine | http://luispedro.org
signature.asc
Reply all
Reply to author
Forward
0 new messages