Why do you want to put a random forest in a numpy array in the first place?

Best,
Gilles


On 26 May 2014 13:11, Lars Buitinck <[email protected]> wrote:

> 2014-05-24 0:28 GMT+02:00 Steven Kearnes <[email protected]>:
> > a is a list of the individual DecisionTreeClassifier objects belonging to
> > the model, instead of a list containing the model itself. The same result
> > occurs if I add dtype=object to np.asarray.
> >
> > Why is this happening? Is there a way to prevent it?
>
> It's because a random forest is an ensemble model and ensemble models
> behave like lists:
>
> >>> len(estimator)
> 10
> >>> estimator[0]
> DecisionTreeClassifier(compute_importances=None, criterion='gini',
>             max_depth=None, max_features='auto', max_leaf_nodes=None,
>             min_density=None, min_samples_leaf=1, min_samples_split=2,
>             random_state=1854205873, splitter='best')
>
> NumPy picks this up and acts accordingly: asarray, when given a
> sequence of things, makes an array of the elements of the sequence.
>
> This behavior was introduced in
> https://github.com/scikit-learn/scikit-learn/commit/7bd3f88f. I don't
> see an easy way to turn this off with modifying the library code.
>
>
> ------------------------------------------------------------------------------
> The best possible search technologies are now affordable for all companies.
> Download your FREE open source Enterprise Search Engine today!
> Our experts will assist you in its installation for $59/mo, no commitment.
> Test it for FREE on our Cloud platform anytime!
>
> http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to