I'm new to machine leaning so this is my first time using sklearn packages. In this classification problem I want to get confusion matrix for each fold, but I get only one, this is what I have done so far. I haven't added the preprocessing part here.
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import cross_val_predict
target = df["class"]
features = df.drop("class", axis=1)
split_df = round(0.8 * len(df))
features = features.sample(frac=1, random_state=0)
target = target.sample(frac=1, random_state=0)
trainFeatures, trainClassLabels = features.iloc[:split_df], target.iloc[:split_df]
testFeatures, testClassLabels = features.iloc[split_df:], target.iloc[split_df:]
tree = DecisionTreeClassifier(random_state=0)
tree.fit(X=trainFeatures, y=trainClassLabels)
y_pred = cross_val_predict(tree, X=features, y=target, cv=10)
conf_matrix = confusion_matrix(target, y_pred)
print("Confusion matrix:\n", conf_matrix)