I think you may be reinventing sklearn.pipeline.FeatureUnion. If one of the
transformers returns sparse, it will hstack all the outputs to a sparse
format.


On 3 July 2014 02:35, ZORAIDA HIDALGO SANCHEZ <
[email protected]> wrote:

> Dear all,
>
> For a given dataset, I can have more than one source(differente csv) and
> each of these sources needs a different transformer(for instance, one
> source could be text and
> uses TfidfVectorizer whereas other is composed by attributes of type float
> and needs to be normalized using StandardScaler). What the fit_transform
> function returns depends
> on the transformer. Some transformers return narrays whereas others
> scipy.sparces matrix. I need to generalize the way I transform each
> source:
>
> for train, test in kfolds:
>     X_train = []
>     for src in sources:
>         transformer.fit_transform(X_src_train, y_train)
>         transformer.transform(X_src_test)
>         X_train = np.concatenate(X_train, X_src_train, axis=1)
>         X_test = np.concatenate(X_test, X_src_test, axis=1)
>
>
>         for k in range(0, len(score_funcs)):
>             ...
>             for i in range(0, len(classifiers)):
>                 ...
>
>
> Does it make sense? I know there are different methods for concatenating
> narrays and sparse matrix but separately. How do you deal with this?
>
> Thanks in advance.
>
> ________________________________
>
> Este mensaje y sus adjuntos se dirigen exclusivamente a su destinatario,
> puede contener información privilegiada o confidencial y es para uso
> exclusivo de la persona o entidad de destino. Si no es usted. el
> destinatario indicado, queda notificado de que la lectura, utilización,
> divulgación y/o copia sin autorización puede estar prohibida en virtud de
> la legislación vigente. Si ha recibido este mensaje por error, le rogamos
> que nos lo comunique inmediatamente por esta misma vía y proceda a su
> destrucción.
>
> The information contained in this transmission is privileged and
> confidential information intended only for the use of the individual or
> entity named above. If the reader of this message is not the intended
> recipient, you are hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited. If you have received
> this transmission in error, do not read it. Please immediately reply to the
> sender that you have received this communication in error and then delete
> it.
>
> Esta mensagem e seus anexos se dirigem exclusivamente ao seu destinatário,
> pode conter informação privilegiada ou confidencial e é para uso exclusivo
> da pessoa ou entidade de destino. Se não é vossa senhoria o destinatário
> indicado, fica notificado de que a leitura, utilização, divulgação e/ou
> cópia sem autorização pode estar proibida em virtude da legislação vigente.
> Se recebeu esta mensagem por erro, rogamos-lhe que nos o comunique
> imediatamente por esta mesma via e proceda a sua destruição
>
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to