Skip to content

Broadcasting error in avg_score #193

Description

@shubhamgp47

I get the following error with avg_score multilabel strategy -

File "C:\Users\localuserSKSG\anaconda3\envs\alenv\lib\site-packages\modAL\models\base.py", line 175, in query
query_result, query_metrics = self.query_strategy( File "C:\Users\localuserSKSG\anaconda3\envs\alenv\lib\site-packages\modAL\multilabel.py",
line 258, in avg_score classwise_scores = classwise_confidence*(classwise_predictions-1/2)
ValueError: operands could not be broadcast together with shapes (26872,2,3) (26872,3)

During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "avg-score.py", line 264, in
query_index, query_instance = learner.query(X_pool_np, n_instances=n_instances)
File "C:\Users\localuserSKSG\anaconda3\envs\alenv\lib\site-packages\modAL\models\base.py", line 180, in query
query_result = self.query_strategy( File "C:\Users\localuserSKSG\anaconda3\envs\alenv\lib\site-packages\modAL\multilabel.py", line 258, in
avg_score classwise_scores = classwise_confidence*(classwise_predictions-1/2) ValueError: operands could not be broadcast together with shapes (26872,2,3) (26872,3)

We do not see this error with avg_confidence. Clearly this is because of these lines of code in avg_score which are not present in avg_confidence-

classwise_predictions = classifier.predict(X_pool)
classwise_scores = classwise_confidence*(classwise_predictions-1/2)

Does anyone has a solution/workaround for this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions