I have made predictions, however the predictions tend to vary so I would like to perform many in a loop, save the prediction within a list and then find the average.
I am stuck at the list making step, here is what I have tried.
EmptyList =[]
for i in range(3):
model = DecisionTreeClassifier()
model.fit(X_train_selected, y_train)
predictions = model.predict(X_validation_selected)
Acc = accuracy_score(y_validation, predictions)
EmptyList[i] + Acc
print(EmptyList)
Can anyone suggest how to perform n number of predictions and then store these in a list?
question from:
https://stackoverflow.com/questions/66061330/how-to-append-an-empty-list-in-a-loop-in-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…