美文网首页
展平numpy数组

展平numpy数组

作者: 菌子甚毒 | 来源:发表于2022-05-18 21:04 被阅读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))
    

    相关文章

      网友评论

          本文标题:展平numpy数组

          本文链接:https://www.haomeiwen.com/subject/vdywurtx.html