1 回答

TA貢獻1869條經(jīng)驗 獲得超4個贊
循環(huán)中的最后一行:
precision_score = precision_score(y_test,preds,average='micro')
temp_scores = pd.DataFrame({'depth':[depth],
'test_score':[test_score],
'train_score':[train_score],
'precision_score:':[precision_score]})
scores_data = scores_data.append(temp_scores)
應改為:
precision_score_ = precision_score(y_test,preds,average='micro')
temp_scores = pd.DataFrame({'depth':[depth],
'test_score':[test_score],
'train_score':[train_score],
'precision_score:':[precision_score_]})
scores_data = scores_data.append(temp_scores)
您定義precision_score為 numpy 數(shù)組,然后像函數(shù)一樣調(diào)用它(下一個周期)。
添加回答
舉報