def test_pred1_batB_seql1_user_confmat(pred1_batB_seql1_cls3_preds_confmat): Yt, Yp, confmat = [ pred1_batB_seql1_cls3_preds_confmat[k] for k in ['Yt', 'Yp', 'confmat'] ] assert_almost_equal(nu.confusion_matrix_forcategorical(Yt, Yp), confmat) yt, yp = [pred1_batB_seql1_cls3_preds_confmat[k] for k in ['yt', 'yp']] nclasses = Yt.shape[-1] assert_almost_equal(nu.confusion_matrix(yt, yp, nclasses), confmat) assert True
def test_predP_batB_seqlQ_user_confmat(predP_batB_seqlQ_cls3_preds_confmat): Yt, Yp, confmat = [ predP_batB_seqlQ_cls3_preds_confmat[k] for k in ['Yt', 'Yp', 'confmat'] ] print("\nTEST", Yt.shape, Yp.shape, confmat.shape) print() assert_almost_equal(nu.confusion_matrix_forcategorical(Yt, Yp), confmat) yt, yp = [predP_batB_seqlQ_cls3_preds_confmat[k] for k in ['yt', 'yp']] nclasses = Yt.shape[-1] print(yt.shape, yp.shape) assert_almost_equal(nu.confusion_matrix(yt, yp, nclasses), confmat) assert True
def test_pred1_batB_seqlQ_generic_confmat(pred1_batB_seqlQ_cls3_preds_confmat): Yt, Yp, confmat = [ pred1_batB_seqlQ_cls3_preds_confmat[k] for k in ['Ytg', 'Ypg', 'confmatg'] ] print("\nTEST", Yt.shape, Yp.shape, confmat.shape) print() assert_almost_equal( nu.confusion_matrix_forcategorical(Yt, Yp, keepdims=True), confmat ) yt, yp = [pred1_batB_seqlQ_cls3_preds_confmat[k] for k in ['ytg', 'ypg']] nclasses = Yt.shape[-1] print(yt.shape, yp.shape) assert_almost_equal(nu.confusion_matrix(yt, yp, nclasses, keepdims=True), confmat) assert True