'Fit estimator and transform dataset.
Parameters
X : array-like or sparse matrix, shape=(n_samples, n_features)
Input data used to build forests. Use ``dtype=np.float32`` for
maximum efficiency.
sample_weight : array-like, shape = [n_samples] or None
Sample weights. If None, then samples are equally weighted. Splits
that would create child nodes with net zero or negative weight are
ignored while searching for a split in each node. In the case of
classification, splits are also ignored if they would result in any
single class carrying a negative weight in either child node.
Returns
X_transformed : sparse matrix, shape=(n_samples, n_out)
Transformed dataset.'

def fit_transform(self, X, y=None, sample_weight=None):

    X = check_array(X, accept_sparse=['csc'])
    if issparse(X):
        X.sort_indices()
    rnd = check_random_state(self.random_state)
    y = rnd.uniform(size=X.shape[0])
    super(RandomTreesEmbedding, self).fit(X, y, sample_weight=sample_weight)
    self.one_hot_encoder_ = OneHotEncoder(sparse=self.sparse_output)
    return self.one_hot_encoder_.fit_transform(self.apply(X))
