def compute_auc_prc(A_true,
                    W_xcorr=None,
                    bfgs_model=None,
                    sgd_model=None,
                    gibbs_samples=None,
                    vb_models=None,
                    svi_models=None,
                    average="macro"):
    A_flat = A_true.ravel()
    aucs = {}
    precs = {}
    recalls = {}

    if W_xcorr is not None:
        aucs['xcorr'] = average_precision_score(A_flat,
                                                W_xcorr.ravel(),
                                                average=average)
        precs['xcorr'], recalls['xcorr'], _ = precision_recall_curve(A_flat, W_xcorr.ravel())

    if bfgs_model is not None:
        assert isinstance(bfgs_model, DiscreteTimeStandardHawkesModel)
        W_bfgs = bfgs_model.W.copy()
        W_bfgs -= np.diag(np.diag(W_bfgs))
        aucs['bfgs'] = average_precision_score(A_flat,
                                               W_bfgs.ravel(),
                                               average=average)
        precs['bfgs'], recalls['bfgs'], _ = precision_recall_curve(A_flat, W_bfgs.ravel())

    if sgd_model is not None:
        assert isinstance(sgd_model, DiscreteTimeStandardHawkesModel)
        aucs['sgd'] = average_precision_score(A_flat,
                                              sgd_model.W.ravel(),
                                              average=average)
        # precs['sgd'], recalls['sgd'], _ = precision_recall_curve(A_flat, W_sgd.ravel())

    if gibbs_samples is not None:
        # Compute ROC based on mean value of W_effective in second half of samples
        Weff_samples = np.array([s.weight_model.W_effective for s in gibbs_samples])
        N_samples    = Weff_samples.shape[0]
        offset       = N_samples // 2
        Weff_mean    = Weff_samples[offset:,:,:].mean(axis=0)

        aucs['gibbs'] = average_precision_score(A_flat, Weff_mean.ravel(),
                                                average=average)

    if vb_models is not None:
        # Compute ROC based on E[A] under variational posterior
        aucs['vb'] = average_precision_score(A_flat,
                                             vb_models[-1].weight_model.expected_A().ravel(),
                                             average=average)

    if svi_models is not None:
        # Compute ROC based on E[A] under variational posterior
        W_svi = svi_models[-1].weight_model.expected_W()
        aucs['svi'] = average_precision_score(A_flat,
                                              W_svi.ravel(),
                                              average=average)
        precs['svi'], recalls['svi'], _ = precision_recall_curve(A_flat, W_svi.ravel())

    return aucs, precs, recalls
Initialize this accessor.
dataset/ETHPy150Open slinderman/pyhawkes/experiments/chalearn_small_comparison.py/compute_auc_prc--crossover with--dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/vec_wrapper.py/Accessor.__init__