Skip to content

Commit

Permalink
Move missing value validations before unique value validations (#2228)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Gupta <[email protected]>
  • Loading branch information
gaugup authored Aug 11, 2023
1 parent 1eeb20b commit cd2502a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions responsibleai/responsibleai/rai_insights/rai_insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ def _validate_rai_insights_input_parameters(
raise UserConfigValidationException(
f'Target name {target_column} not present in train/test data')

# Check if any of the data is missing in test and train data
self._validate_data_is_not_missing(test, "test")
self._validate_data_is_not_missing(train, "train")

categorical_features = feature_metadata.categorical_features
if (categorical_features is not None and
len(categorical_features) > 0):
Expand Down Expand Up @@ -597,10 +601,6 @@ def _validate_rai_insights_input_parameters(
"identified as categorical features: "
f"{non_categorical_or_time_string_columns}")

# Check if any of the data is missing in test and train data
self._validate_data_is_not_missing(test, "test")
self._validate_data_is_not_missing(train, "train")

self._validate_feature_metadata(
feature_metadata, train, task_type, model, target_column)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def test_mismatch_train_test_features(self):
str(ucve.value)

def test_dirty_train_test_data(self):
X_train = pd.DataFrame(data=[['1', np.nan], ['2', '3']],
X_train = pd.DataFrame(data=[['1', 1], ['2', '3']],
columns=['c1', 'c2'])
y_train = np.array([1, 0])
X_test = pd.DataFrame(data=[['1', '2'], ['2', '3']],
Expand Down

0 comments on commit cd2502a

Please sign in to comment.