[scikit-learn] How to get the factorization from NMF in scikit learn

2016-09-07 Thread Raphael C
I am trying to use NMF from scikit learn. Given a matrix A this should give me a factorization into matrices W and H so that WH is approximately equal to A. As a sanity check I tried the following: from sklearn.decomposition import NMF import numpy as np A = np.array([[0,1,0],[1,0,1],[1,1,0]]) nmf

Re: [scikit-learn] How to get the factorization from NMF in scikit learn

2016-09-07 Thread Vlad Niculae
Hi Raphael, The other matrix in the factorization is the output of nmf.transform(A). In your example you forgot to fit the estimator; if you're just interested in the decomposition the recommended way is to get it in one line with W = nmf.fit_transform(A). While the mathematical description doesn

[scikit-learn] Tuning custom parameters using grid_search

2016-09-07 Thread Piotr Bialecki
Hi all, I am currently tuning some parameters of my xgboost model using scikit's grid_search, e.g.: param_test1 = {'max_depth':range(3,10,2), 'min_child_weight':range(1,6,2) } gsearch1 = GridSearchCV(estimator = XGBClassifier(learning_rate =0.1, n_estimators=762,

Re: [scikit-learn] Tuning custom parameters using grid_search

2016-09-07 Thread Jacob Schreiber
You can use a pipeline object to contain both feature selection/transformation steps and an estimator. All elements of a pipeline can then be tuned using gridsearch. You can see a simple example here: http://scikit-learn.org/stable/modules/pipeline.html You may also be interested seeing if the Fea

Re: [scikit-learn] Tuning custom parameters using grid_search

2016-09-07 Thread Sebastian Raschka
Hi, Piotr, > These preprocessing steps have some parameters too, which I would like to > tune. > I know that it is possible to tune the parameters of the preprocessing steps, > if they are part pf my pipeline. > E.g. if I am using PCA, I could tune the parameter n_components, right? > > But w

[scikit-learn] Mailing list "slow"?

2016-09-07 Thread Sebastian Raschka
Hi, all, I noticed that it takes forever now until something is posted on the mailing list after I sent it out. Since the switch to Python.org, it takes about ~15 - 45min after hitting “sent”. I’ve noticed this for months now and was wondering if this is normal or of there’s something going on w

Re: [scikit-learn] Tuning custom parameters using grid_search

2016-09-07 Thread Piotr Bialecki
Hi Sebastian, thanks a lot. That was exactly what I was looking for! :) I will have a look into the base classes of other preprocessing steps as well. @Jacob Thank you too! :) Greets, Piotr On 07.09.2016 20:26, Sebastian Raschka wrote: > Hi, Piotr, > > >> These preprocessing steps have some p