himalaya.ridge.make_column_transformer_no_stack¶
- himalaya.ridge.make_column_transformer_no_stack(*transformers, **kwargs)[source]¶
Construct a ColumnTransformerNoStack from the given transformers.
This is a shorthand for the ColumnTransformerNoStack constructor; it does not require, and does not permit, naming the transformers. Instead, they will be given names automatically based on their types. It also does not allow weighting with
transformer_weights
.- Parameters
- *transformerstuples
Tuples of the form (transformer, columns) specifying the transformer objects to be applied to subsets of the data.
- transformer{‘drop’, ‘passthrough’} or estimator
Estimator must support
fit
andtransform
. Special-cased strings ‘drop’ and ‘passthrough’ are accepted as well, to indicate to drop the columns or to pass them through untransformed, respectively.- columnsstr, array-like of str, int, array-like of int, slice, array-like of bool or callable
Indexes the data on its second axis. Integers are interpreted as positional columns, while strings can reference DataFrame columns by name. A scalar string or int should be used where
transformer
expects X to be a 1d array-like (vector), otherwise a 2d array will be passed to the transformer. A callable is passed the input data X and can return any of the above. To select multiple columns by name or dtype, you can usemake_column_selector
.
- remainder{‘drop’, ‘passthrough’} or estimator, default=’drop’
By default, only the specified columns in transformers are transformed and combined in the output, and the non-specified columns are dropped. (default of
'drop'
). By specifyingremainder='passthrough'
, all remaining columns that were not specified in transformers will be automatically passed through. This subset of columns is concatenated with the output of the transformers. By settingremainder
to be an estimator, the remaining non-specified columns will use theremainder
estimator. The estimator must supportfit
andtransform
.- n_jobsint, default=None
Number of jobs to run in parallel.
None
means 1 unless in ajoblib.parallel_backend
context.-1
means using all processors. n_jobs does not work with with GPU backends.- verbosebool, default=False
If True, the time elapsed while fitting each transformer will be printed as it is completed.
- Returns
- column_transformer_no_stackColumnTransformerNoStack
See also
himalaya.ridge.ColumnTransformerNoStack
Class that allows combining the outputs of multiple transformer objects used on column subsets of the data into a single feature space.
Examples
>>> from sklearn.preprocessing import StandardScaler >>> from himalaya.ridge import make_column_transformer_no_stack >>> ct = make_column_transformer_no_stack( ... (StandardScaler(), [0, 1, 2]), ... (StandardScaler(), slice(3, 5))) >>> # Group separately the first three columns and the last two >>> # columns, creating two feature spaces. >>> Xs = ct.fit_transform(X) >>> print([Xi.shape for Xi in Xs]) [(4, 3), (4, 2)]