Skip to content

Commit 284e3c4

Browse files
hmstepaneklrafeei
andauthored
Fix logic bug in warning (#915)
Co-authored-by: Lalleh Rafeei <[email protected]>
1 parent 127ad0c commit 284e3c4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

newrelic/hooks/mlmodel_sklearn.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ def _calc_prediction_label_stats(labels, class_, label_column_names, tags):
171171
def _get_label_names(user_defined_label_names, prediction_array):
172172
import numpy as np
173173

174-
if user_defined_label_names is None or len(user_defined_label_names) != prediction_array.shape[1]:
174+
if user_defined_label_names is None:
175+
return np.array(range(prediction_array.shape[1]))
176+
if user_defined_label_names and len(user_defined_label_names) != prediction_array.shape[1]:
175177
_logger.warning(
176178
"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."
177179
)

0 commit comments

Comments
 (0)