[Python] I get multi-class error when trying to use roc_auc_score from scikit-learn even...

Discussão em 'Python' iniciado por Stack, Agosto 4, 2025.

  1. Stack

    Stack Membro Participativo

    Even if I put the multi class argument, the next error is about the dimension:

    numpy.exceptions.AxisError: axis 1 is out of bounds for array of dimension 1


    This is the original run:

    Number of gates for each filter: 784
    1591it [00:15, 102.42it/s]
    ACC TRAIN 0 valid 0.5849989190888902
    RMSE: 0
    [0 2 1 ... 2 0 1]
    [ 0.77736357 0.3725196 1.01126466 ... 0.26738772 -0.063023
    0.77434902]
    The y_label is 1D.
    The pred_proba is 1D.
    Traceback (most recent call last):
    File "C:\Users\user\Desktop\Fairness\infer_truth_tables.py", line 359, in <module>
    print("ROC (%)", 100 * roc_auc_score(y_label, pred_proba)) #y_true, #y_score
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\utils\_param_validation.py", line 211, in wrapper
    return func(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\metrics\_ranking.py", line 619, in roc_auc_score
    raise ValueError("multi_class must be in ('ovo', 'ovr')")
    ValueError: multi_class must be in ('ovo', 'ovr')


    I am using scikit-learn v1.3 (latest).

    Continue reading...

Compartilhe esta Página