A single fully grown tree memorises. A forest of them votes, and their different mistakes cancel out. You want to see how many trees it takes.
Write tree_versus_forests(sizes) for the wine data.
load_wine(return_X_y=True, as_frame=True) and split it with train_test_split(X, y, test_size=0.25, random_state=0, stratify=y).DecisionTreeClassifier(random_state=0) and score it on the test rows.sizes, in order, fit RandomForestClassifier(n_estimators=value, random_state=0) and score it on the test rows.Return a dict:
"tree": the single tree's test score, rounded to 3 places."forests": a list of the forests' test scores, in the order of sizes, each rounded to 3 places.