def fit_transform(self, X, y=None, sample_weight=None):
X = check_array(X, accept_sparse=['csc'], ensure_2d=False)
if sp.issparse(X):
# Pre-sort indices to avoid that each individual tree of the
# ensemble sorts the indices.
X.sort_indices()
X_, y_ = generate_discriminative_dataset(X)
super(RandomForestEmbedding, self).fit(X_, y_,
sample_weight=sample_weight)
self.one_hot_encoder_ = OneHotEncoder(sparse=True)
if self.sparse_output:
return self.one_hot_encoder_.fit_transform(self.apply(X))
return self.apply(X)
forest_embedding.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录