Adaptor to use arbitrary sklearn transformer as a mapper.
This basic adaptor support forward mapping only. It is clever enough to call fit_transform() instead of a serial fit() and transform() combo when an untrained instance is called with a dataset.
>>> from sklearn.manifold import MDS
>>> from mvpa2.misc.data_generators import normal_feature_dataset
>>> ds = normal_feature_dataset(perlabel=10, nlabels=2)
>>> print ds.shape
(20, 4)
>>> mds = SKLTransformer(MDS())
>>> mapped = mds(ds)
>>> print mapped.shape
(20, 2)
Notes
Available conditional attributes:
(Conditional attributes enabled by default suffixed with +)
Methods
forward(data) | Map data from input to output space. |
forward1(data) | Wrapper method to map single samples. |
generate(ds) | Yield processing results. |
get_postproc() | Returns the post-processing node or None. |
get_space() | Query the processing space name of this node. |
reset() | |
reverse(data) | Reverse-map data from output back into input space. |
reverse1(data) | Wrapper method to map single samples. |
set_postproc(node) | Assigns a post-processing node |
set_space(name) | Set the processing space name of this node. |
train(ds) | The default implementation calls _pretrain(), _train(), and finally _posttrain(). |
untrain() | Reverts changes in the state of this node caused by previous training |
Parameters: | transformer : sklearn.transformer instance space : str or None, optional
enable_ca : None or list of str
disable_ca : None or list of str
auto_train : bool
force_train : bool
pass_attr : str, list of str|tuple, optional
postproc : Node instance, optional
descr : str
|
---|
Methods
forward(data) | Map data from input to output space. |
forward1(data) | Wrapper method to map single samples. |
generate(ds) | Yield processing results. |
get_postproc() | Returns the post-processing node or None. |
get_space() | Query the processing space name of this node. |
reset() | |
reverse(data) | Reverse-map data from output back into input space. |
reverse1(data) | Wrapper method to map single samples. |
set_postproc(node) | Assigns a post-processing node |
set_space(name) | Set the processing space name of this node. |
train(ds) | The default implementation calls _pretrain(), _train(), and finally _posttrain(). |
untrain() | Reverts changes in the state of this node caused by previous training |