_interval_index() may raise "TypeError: bad operand type for abs(): 'str'" and the rootcause is that series_datatype() determined a string series as CONTINUOUS, but didn't convert the data to numeric.
The commit ensures consistency of the deduced DataType and the dtype of a data series.
Major changes:
Deduce data type of facet series, label series and predicted label series, and then convert the series to category or numeric according to the data type. Use the converted data series (instead of the original data series) to calculate bias metrics.
Keep the validations and preprocessing in _report, but move the actual reporting to _do_report for clarity (and to avoid using wrong data by chance e.g., label_data_series should be used, instead of label_column.data).
Rename some variables for clarity, e.g. data_series => facet_data_series,
Fix the naming of parameters/variables in _interval_index(), the function is NOT just for facet.
Fix the mypy type of facet/label values. It should be List[Any] instead of List[str]
Add more unit tests and raise the code coverage bar
Testing Done:
Local devtool all passed
Local devtool integ_tests passed
Installed the new whl to the analyzer repo and container devtool all passed.
Issue #, if available:
https://tiny.amazon.com/r0677v90
Description of changes:
_interval_index() may raise "TypeError: bad operand type for abs(): 'str'" and the rootcause is that series_datatype() determined a string series as CONTINUOUS, but didn't convert the data to numeric.
The commit ensures consistency of the deduced DataType and the dtype of a data series.
Major changes:
_report
, but move the actual reporting to_do_report
for clarity (and to avoid using wrong data by chance e.g., label_data_series should be used, instead of label_column.data).data_series
=>facet_data_series
,_interval_index()
, the function is NOT just for facet.Testing Done:
devtool all
passeddevtool integ_tests
passeddevtool all
passed.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.