Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix label name warning #915

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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