Re: [Scikit-learn-general] Unexpected behavior using numpy.asarray with RandomForestClassifier

2014-05-26 Thread Lars Buitinck
2014-05-24 0:28 GMT+02:00 Steven Kearnes skear...@gmail.com: 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

Re: [Scikit-learn-general] Unexpected behavior using numpy.asarray with RandomForestClassifier

2014-05-26 Thread Gilles Louppe
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 larsm...@gmail.com wrote: 2014-05-24 0:28 GMT+02:00 Steven Kearnes skear...@gmail.com: a is a list of the individual DecisionTreeClassifier objects belonging to the

Re: [Scikit-learn-general] Unexpected behavior using numpy.asarray with RandomForestClassifier

2014-05-26 Thread Joel Nothman
It's possible to put a sequence as an object into an array, but you cannot do it with asarray or array directly. Use, for example: a = np.empty(1) a[0] = estimator # alternatively: a[:] = [estimator] On 26 May 2014 21:17, Gilles Louppe g.lou...@gmail.com wrote: Why do you want to put a random

Re: [Scikit-learn-general] Unexpected behavior using numpy.asarray with RandomForestClassifier

2014-05-26 Thread Steven Kearnes
Thanks for your responses. I've been using a workaround similar to Joel's suggestion in the meantime, and it sounds like I just have to stick with that for now. Essentially I'm doing a hyperparameter grid search, but in a context that doesn't support GridSearchCV, so I'm dealing with multiple

Re: [Scikit-learn-general] Unexpected behavior using numpy.asarray with RandomForestClassifier

2014-05-26 Thread Joel Nothman
FWIW, argsort in pure Python is possible given some list l with: sorted(range(len(l)), key=l.__getitem__) Sorting by best score would be: sorted(range(len(l)), key=lambda ind: l[ind].best_score_) On 27 May 2014 07:39, Steven Kearnes skear...@gmail.com wrote: Thanks for your responses. I've