Discussion:
Online learning
(too old to reply)
Jim
2013-11-05 19:46:45 UTC
Permalink
1) This might sound like a basic question, but when performing a partial_fit
in SGD Classifiers, does the new data to train on have to be in the
categories that are already in the set? Or conversely, if I come across/ want
to add a few documents(in a document classifier example) in a new category to
the classifier would partial_fit be correct and work fine or do I have to re-
fit the model.
2) Will there be a interface for online learning in OnevsRestClassifier?
Lars Buitinck
2013-11-05 22:28:56 UTC
Permalink
Post by Jim
1) This might sound like a basic question, but when performing a partial_fit
in SGD Classifiers, does the new data to train on have to be in the
categories that are already in the set? Or conversely, if I come across/ want
to add a few documents(in a document classifier example) in a new category to
the classifier would partial_fit be correct and work fine or do I have to re-
fit the model.
They have to be from the same classes that were in previous batches,
i.e. you need to know all the classes upfront. This is what the
classes parameter on partial_fit is for.
Post by Jim
2) Will there be a interface for online learning in OnevsRestClassifier?
If you care to implement it, then we're happy to accept a patch. Are
you doing multi-label classification?
Jim
2013-11-06 03:24:12 UTC
Permalink
Post by Lars Buitinck
Post by Jim
2) Will there be a interface for online learning in OnevsRestClassifier?
If you care to implement it, then we're happy to accept a patch. Are
you doing multi-label classification?
No I am primarily working on multiclass classification with constantly
increasing number of classes
Lars Buitinck
2013-11-06 10:45:17 UTC
Permalink
Post by Jim
No I am primarily working on multiclass classification with constantly
increasing number of classes
Then you don't need a OneVsRestClassifier as OvR is the default
strategy for SGD. You do need to put a maximum on the number of
classes before you start learning, though.
Jim
2013-11-07 01:00:22 UTC
Permalink
Post by Lars Buitinck
Then you don't need a OneVsRestClassifier as OvR is the default
strategy for SGD. You do need to put a maximum on the number of
classes before you start learning, though.
I see. Thank you for the advice. This was initial novice iteration of the
solution and needs improvement of course. In terms of which, in order to
keep the behaviour of the classifier consistent, instead of a single
classifier with thousands of categories wouldn't it be better
to build an ensemble of classifiers with a hierarchy(similar dataset, less
collision since the noise from the other classes is reduced and
I can define the solution-flow custom to the category chosen) say,

Classifiers
|
----------------------------------------
| | ------- |
Type A Type B Type N (total types = 5 or 6)
|
| --
-----------------------------------
| | -------- |
Category A Category B Category N (N = atmost 1000)

Is there a way I can achieve this with scikit [i.e. unless I am mistaken
for a sample I need to also negatively train on the other classifiers]
I do appreciate clearing up the holes in my understanding.
Andy
2013-11-07 06:44:58 UTC
Permalink
Post by Jim
Post by Lars Buitinck
Then you don't need a OneVsRestClassifier as OvR is the default
strategy for SGD. You do need to put a maximum on the number of
classes before you start learning, though.
I see. Thank you for the advice. This was initial novice iteration of the
solution and needs improvement of course. In terms of which, in order to
keep the behaviour of the classifier consistent, instead of a single
classifier with thousands of categories wouldn't it be better
to build an ensemble of classifiers with a hierarchy(similar dataset, less
collision since the noise from the other classes is reduced and
I can define the solution-flow custom to the category chosen) say,
Classifiers
|
----------------------------------------
| | ------- |
Type A Type B Type N (total types = 5 or 6)
|
| --
-----------------------------------
| | -------- |
Category A Category B Category N (N = atmost 1000)
I would venture that which one is better would depend on the nature of
your data.
Do you know the number of types beforehand? And do all types have 1000
categories?
Jim
2013-11-07 18:33:21 UTC
Permalink
Post by Andy
I would venture that which one is better would depend on the nature of
your data.
Do you know the number of types beforehand? And do all types have 1000
categories?
The number of Types is defined, however the number of categories keeps
increasing...but as I see it is unlikely to go beyond 1000 categories per
type. Also the count of categories in each type is not same.
e.g. for 5 types the number of categories is 810, 546, 723, 553, 891
respectively.

Jim
2013-11-07 03:49:10 UTC
Permalink
[Mistakenly posted as separate thread before, please ignore previous post]

I see. Thank you for the advice. This was initial novice iteration of the
solution and needs improvement of course. In terms of which, in order to
keep the behaviour of the classifier consistent, instead of a single
classifier with thousands of categories wouldn't it be better
to build an ensemble of classifiers with a hierarchy(similar dataset, less
collision since the noise from the other classes is reduced and
I can define the solution-flow custom to the category chosen) say,

Classifiers
|
----------------------------------------
| | ------- |
Type A Type B Type N (total types = 5 or 6)
|
| --
-----------------------------------
| | -------- |
Category A Category B Category N (N = atmost 1000)

Is there a way I can achieve this with scikit [i.e. unless I am mistaken
for a sample I need to also negatively train on the other classifiers]
I do appreciate clearing up the holes in my understanding.
Lars Buitinck
2013-11-05 22:28:56 UTC
Permalink
Post by Jim
1) This might sound like a basic question, but when performing a partial_fit
in SGD Classifiers, does the new data to train on have to be in the
categories that are already in the set? Or conversely, if I come across/ want
to add a few documents(in a document classifier example) in a new category to
the classifier would partial_fit be correct and work fine or do I have to re-
fit the model.
They have to be from the same classes that were in previous batches,
i.e. you need to know all the classes upfront. This is what the
classes parameter on partial_fit is for.
Post by Jim
2) Will there be a interface for online learning in OnevsRestClassifier?
If you care to implement it, then we're happy to accept a patch. Are
you doing multi-label classification?
Continue reading on narkive:
Loading...