Skip to content

Commit

Permalink
add check if the float can be converted to integer
Browse files Browse the repository at this point in the history
  • Loading branch information
hawestra committed Jun 26, 2023
1 parent 34b47b5 commit a294112
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion responsibleai/responsibleai/rai_insights/rai_insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,12 @@ def _validate_rai_insights_input_parameters(

# Validate that the target column isn't continuous if the
# user is running classification scenario
# To address error thrown from sklearn here: # noqa: E501
# https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/utils/multiclass.py#L197
y_data = train[target_column]
if (task_type == ModelTask.CLASSIFICATION and
pd.api.types.is_float_dtype(train[target_column].dtype)):
pd.api.types.is_float_dtype(y_data.dtype) and
np.any(y_data != y_data.astype(int))):
raise UserConfigValidationException(
"Target column type must not be continuous "
"for classification scenario.")
Expand Down

0 comments on commit a294112

Please sign in to comment.