random forest sklearn categories to predict code example
Example 1: sklearn random forest feature importance
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
X, y = make_classification(
n_samples=1000, n_features=10, n_informative=3, n_redundant=0,
n_repeated=0, n_classes=2, random_state=0, shuffle=False)
X_train, X_test, y_train, y_test = train_test_split(
X, y, stratify=y, random_state=42)
Example 2: sklearn random forest feature importance
RandomForestClassifier(random_state=0)