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 wrote: > Thanks for your responses. I've been using a worka

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 indep

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 wrote: > Why do you want to put a random forest in a numpy

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 wrote: > 2014-05-24 0:28 GMT+02:00 Steven Kearnes : > > a is a list of the individual DecisionTreeClassifier objects belonging to > > the model, instead of a list contai

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 : > 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?

Re: [Scikit-learn-general] "Re: CSVM"

2014-05-26 Thread Mathieu Blondel
Eq. (7) shows that their method reduces to a standard SVM objective if you prepare input data as given in Eq. (6). Using a LinearSVC will give you w tilde in Eq. (5) and you can make predictions with Eq. (1). I said something wrong in my previous email, the shape of X should be [n_samples, n_featur

[Scikit-learn-general] "Re: CSVM"

2014-05-26 Thread Kathy Hida
I did send to the author, but he does not reply. Yes, I've implemented the normalization and k-means using scikit. Can you please explain a bit about your proposed solution? It is completely different from what I was thinking it should be. The paper suggests to subtract the global classifier fro

Re: [Scikit-learn-general] CSVM

2014-05-26 Thread Mathieu Blondel
Hi, Have you tried to ask the authors for their source code? If your implementation is based on scikit-learn, it could be interesting to share it as a gist. I had a quick look at the paper and it seems to me that you don't even need to change liblinear. You just need to prepare a sparse matrix X