imblearn.ensemble.BalancedRandomForestClassifier.apply

BalancedRandomForestClassifier.apply(X)[source]

Apply trees in the forest to X, return leaf indices.

Parameters
X{array-like, sparse matrix} of shape (n_samples, n_features)

The input samples. Internally, its dtype will be converted to dtype=np.float32. If a sparse matrix is provided, it will be converted into a sparse csr_matrix.

Returns
X_leavesndarray of shape (n_samples, n_estimators)

For each datapoint x in X and for each tree in the forest, return the index of the leaf x ends up in.