展平numpy数组

2022-05-18  本文已影响0人  菌子甚毒
  1. 展平numpy数组
np.arange(10).reshape(2,5).ravel()
np.arange(10).reshape(2,5).reshape(-1)
outputs = np.concatenate(outputs, axis=0)
  1. list append
a = []
a+[55]+[66]+[77]
# output: [55, 66, 77]
  1. 评估
import sklearn.metrics
y_real = [0,1,0,1,0,1]
y_pred = [0,1,0,1,0,0]

print(sklearn.metrics.f1_score(y_real,y_pred,average='macro'))
print(sklearn.metrics.classification_report(y_real,y_pred))
print(sklearn.metrics.accuracy_score(y_real,y_pred))
上一篇下一篇

猜你喜欢

热点阅读