On Tue, 2013-02-26 at 14:39 +0100, Lars Buitinck wrote:
>
> Good question. I say don't export classes_, because (a) then there's
> no reason to not do this for any other attribute.
Well, I'm more in favour of being able to smoothly exchange estimators
with pipelines, where first some preprocessing is done and then the
final step is an estimator.
Maybe it's worth considering the nice things that could be done if
estimators and pipelines ending with estimators would be
interchangeable?
> If you know the
> classifier's identifier within the pipeline, you should be able to
> work around this without too much trouble.
Yes, the work-around is not too much trouble. I'm using the following:
if hasattr(estimator, "classes_"):
classes = estimator.classes_
elif isinstance(estimator, pipeline.Pipeline) and \
hasattr(estimator.steps[-1][1], "classes_"):
classes = estimator.steps[-1][1].classes_
else:
raise ValueError("The given estimator does not have a 'classes_'
property")
Best regards,
Tadej
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general