Skip to content

Commit

Permalink
Fix logic bug in warning (#915)
Browse files Browse the repository at this point in the history
Co-authored-by: Lalleh Rafeei <84813886+lrafeei@users.noreply.github.com>
  • Loading branch information
hmstepanek and lrafeei committed Aug 31, 2023
1 parent 127ad0c commit 284e3c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion newrelic/hooks/mlmodel_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def _calc_prediction_label_stats(labels, class_, label_column_names, tags):
def _get_label_names(user_defined_label_names, prediction_array):
import numpy as np

if user_defined_label_names is None or len(user_defined_label_names) != prediction_array.shape[1]:
if user_defined_label_names is None:
return np.array(range(prediction_array.shape[1]))
if user_defined_label_names and len(user_defined_label_names) != prediction_array.shape[1]:
_logger.warning(
"The number of label names passed to the ml_model wrapper function is not equal to the number of predictions in the data set. Please supply the correct number of label names."
)
Expand Down

0 comments on commit 284e3c4

Please sign in to comment.