from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification

X, y = make_classification(n_samples=1000, n_features=20, n_informative=10, n_classes=2, random_state=42)

param_grid = {
    'n_estimators': [10, 20, 50],
    'max_depth': [2, 5, 10, None]
}

model = RandomForestClassifier()

grid_search = GridSearchCV(estimator=model, param_grid=param_grid, scoring='accuracy', cv=5, n_jobs=-1)
grid_search.fit(X, y)

print(grid_search.best_params_)
print(grid_search.best_score_)
predictions = grid_search.predict(X)
print(predictions[0:5])