Skip to content

Commit

Permalink
update dataset upload validation to handle the case where all feature…
Browse files Browse the repository at this point in the history
…s are non-numeric

Addresses the tic-tac-toe dataset error during upload found while testing #209
  • Loading branch information
hjwilli committed Aug 9, 2019
1 parent d9a88ac commit dcdd1dc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lab/pyutils/validateDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,12 @@ def validate_data(df, target_column = None, categories = None, ordinals = None):
if target_column:
# check that non-cat feature columns contain only numeric data
num_df = num_df.drop(columns=target_column, axis=1)
try:
check_array(num_df, dtype=np.float64, order="C", force_all_finite=True)
except Exception as e:
logger.warn("sklearn.check_array() validation " + str(e))
return False, "sklearn.check_array() validation " + str(e)
if (len(num_df.columns)) > 0:
try:
check_array(num_df, dtype=np.float64, order="C", force_all_finite=True)
except Exception as e:
logger.warn("sklearn.check_array() validation " + str(e))
return False, "sklearn.check_array() validation " + str(e)

# Check rows per class
counts = df.groupby(target_column).count()
Expand Down

0 comments on commit dcdd1dc

Please sign in to comment.