Can I do online learning with random forests? I have a few million datapoints and the classifier fails to finish on the cross validation step.
Can i break it up in chunks sequentially?
Current code:
X_train, y_train, X_val, y_val, X_test, y_test = load_dataset()
print('Planting trees...')
clf = RandomForestClassifier(
n_estimators=50,
max_depth=None,
min_samples_split=1,
random_state=0
)
print('Growing trees...')
classifier = clf.fit(X_train, y_train)
# see how we did
print('Testing trees...')
scores = cross_val_score(classifier, X_test, y_test)
print(scores)
print('accuracy: %d' % (scores.mean()))
Can I change it to something like:
for chunk in df:
clf.fit(...)
cross_validate...
None
. The trees will be built until node purity is achieved or until all leaves contain less than min_samples_split samples. With a few million data points this can lead to very deep and large trees. $\endgroup$